Skip to content

No Enum flag in the enum value type when mixing with some trait #16008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
plokhotnyuk opened this issue Sep 9, 2022 · 2 comments · Fixed by #16857
Closed

No Enum flag in the enum value type when mixing with some trait #16008

plokhotnyuk opened this issue Sep 9, 2022 · 2 comments · Fixed by #16857
Labels
area:metaprogramming:reflection Issues related to the quotes reflection API

Comments

@plokhotnyuk
Copy link

Having definition:

trait MyMarker

enum MyEnum(val value: String):
  case Marked extends MyEnum("marked") with MyMarker

I got Flags.EmptyFlags instead of Flags.Enum in the following call for:

TypeRepr.of[Marked].typeSymbol.flags

@plokhotnyuk plokhotnyuk added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Sep 9, 2022
@mbovel mbovel added area:metaprogramming:reflection Issues related to the quotes reflection API and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Sep 9, 2022
@nicolasstucki
Copy link
Contributor

Marked is becomes a val case in the enum desugaring. This means that TypeRepr.of[Marked] or probably TypeRepr.of[Marked.type] is a TermRef. Therefore to get its symbol we need to use termSymbol instead of typeSymbol. The term symbol of Marked does contain the Enum flag.

Note that typeSymbol works in the simple cases because the val has a single class as a type and we can resolve the symbol. In this case we cannot resolve the type symbol because we have both MyEnum & MyMarker.

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Feb 8, 2023
@plokhotnyuk
Copy link
Author

@nicolasstucki Thanks for the clear explanation!

Closing as not a bug.

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Feb 9, 2023
nicolasstucki added a commit that referenced this issue Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:metaprogramming:reflection Issues related to the quotes reflection API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants