Skip to content

Use standard annotation format for dollarvalues #10101

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

Merged
merged 1 commit into from
Oct 28, 2020

Conversation

bishabosha
Copy link
Member

@bishabosha bishabosha commented Oct 27, 2020

enum companions define the following:

val $values: Array[E] @unchecked = ...

currently the @unchecked annotation is represented as

New(typeOf[scala.unchecked])

it should be

Apply(Select(New(typeOf[scala.unchecked]), <init>), Nil)

this ends up with a special case in TASTy

enum companions define the following:

val $values: Array[E] @unchecked = ...

currently the @unchecked annotation is represented as

New(typeOf[scala.unchecked])

it should be

Apply(Select(New(typeOf[scala.unchecked]), <init>), Nil)
@bishabosha bishabosha requested a review from smarter October 27, 2020 15:13
@@ -125,7 +125,7 @@ object DesugarEnums {
// Singleton enum values always construct a new anonymous class, which will not be checked by the init-checker,
// so this warning will always persist even if the implementation of the anonymous class is safe.
// TODO: remove @unchecked after https://github.com/lampepfl/dotty-feature-requests/issues/135 is resolved.
Annotated(ArrayLiteral(enumValues, rawEnumClassRef), New(ref(defn.UncheckedAnnot.typeRef)))
Copy link
Member

Choose a reason for hiding this comment

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

If this isn't supposed to be supported, we need a check somewhere to disallow it. What happens if a macro constructs such a tree?

Copy link
Member Author

Choose a reason for hiding this comment

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

I opened the issue #10113 for this

@bishabosha bishabosha merged commit 6a73701 into scala:master Oct 28, 2020
@bishabosha bishabosha deleted the topic/enum-normalise-annot branch October 28, 2020 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants