Skip to content

Conversation

@neundorf
Copy link
Contributor

This unit test uses "using UEnum = Enum;" and imports that into Carbon.

This is my very first try at contributing something to carbon, I'm looking forward to your feedback.
The test is very basic.
What other cases should it test ?
What other comments do you have ?

@neundorf neundorf requested a review from a team as a code owner October 26, 2025 16:53
@neundorf neundorf requested review from zygoloid and removed request for a team October 26, 2025 16:53
@neundorf
Copy link
Contributor Author

The test currently simply tests one using enum on global scope.
Should I add an enum inside a class ? An enum class inside a class ? Other variations ?

@zygoloid
Copy link
Contributor

zygoloid commented Oct 27, 2025

If this is for the "using enum support" item in the toolchain tasks document, that's talking about the C++20 using enum feature:

enum class A { x, y };
// Cannot name `A::x` as simply `x` here.
using enum A;
// Can now name `A::x` as simply `x`.
A a = x;

The using B = A; syntax is an alternative syntax for typedef declarations, and we have tests for that in toolchain/check/testdata/interop/cpp/typedef.carbon already.

@neundorf
Copy link
Contributor Author

If this is for the "using enum support" item in the toolchain tasks document, that's talking about the C++20 using enum feature:

enum class A { x, y };
// Cannot name `A::x` as simply `x` here.
using enum A;
// Can now name `A::x` as simply `x`.
A a = x;

The using B = A; syntax is an alternative syntax for typedef declarations, and we have tests for that in toolchain/check/testdata/interop/cpp/typedef.carbon already.

thanks, I'll update it.

@neundorf
Copy link
Contributor Author

neundorf commented Nov 3, 2025

If this is for the "using enum support" item in the toolchain tasks document, that's talking about the C++20 using enum feature:

enum class A { x, y };
// Cannot name `A::x` as simply `x` here.
using enum A;
// Can now name `A::x` as simply `x`.
A a = x;

The using B = A; syntax is an alternative syntax for typedef declarations, and we have tests for that in toolchain/check/testdata/interop/cpp/typedef.carbon already.

thanks, I'll update it.

Ok, I'm not sure what should be tested here actually.
Should using enum Foo; actually have an effect when this is imported into Carbon ?
Should it then be possible to write

let a : cpp.Foo = SomeValue; 

(instead of cpp.Foo.SomeValue) ?

@zygoloid
Copy link
Contributor

zygoloid commented Nov 3, 2025

Should using enum Foo; actually have an effect when this is imported into Carbon ? Should it then be possible to write

let a : cpp.Foo = SomeValue; 

(instead of cpp.Foo.SomeValue) ?

It should be possible to write

let a: Cpp.Foo = Cpp.SomeValue;

instead of Cpp.Foo.SomeValue.

This unit test uses the C++20 "using enum SomeEnum;" and
imports that into Carbon.
Copy link
Contributor

@zygoloid zygoloid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@zygoloid zygoloid enabled auto-merge November 10, 2025 22:11
@zygoloid zygoloid added this pull request to the merge queue Nov 10, 2025
Merged via the queue into carbon-language:trunk with commit 711cd56 Nov 10, 2025
8 checks passed
@neundorf
Copy link
Contributor Author

@zygoloid does the "Carbon Language - Toolchain tasks" document have to be updated ? Who is taking care of this ?

@zygoloid
Copy link
Contributor

Thanks for the reminder, done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants