-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #4758: Revert "New phase for entering annotations" #4776
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
Conversation
This reverts commit 2b12868. Since we do not plan to run annotation macros during Namer, there's no need to annotate before completing. This allows again to define an annotation in the same scope as an annotated definition. So i3702.scala goes from neg to pos.
@@ -822,6 +746,22 @@ class Namer { typer: Typer => | |||
else completeInCreationContext(denot) | |||
} | |||
|
|||
protected def addAnnotations(sym: Symbol): Unit = original match { | |||
case original: untpd.MemberDef => | |||
var hasInlineAnnot = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dead variable.
protected def addAnnotations(sym: Symbol): Unit = original match { | ||
case original: untpd.MemberDef => | ||
var hasInlineAnnot = false | ||
lazy val annotCtx = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you're at it, you may want to make an annotCtx def that can be used both here and for https://github.com/lampepfl/dotty/blob/64bd0fe5210cacd7c17ab285c80712944157c212/compiler/src/dotty/tools/dotc/typer/Typer.scala#L1345 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Martin. It fixes the cyclic errors while compiling the standard library
Should we also revert #1249? |
Good point to check this also. I just had a close look and think it's better to leave it as is. With #1249, we process annotations before marking the symbol as completed. That prevents some races we would otherwise have to worry about. We know then that, once a symbol was completed, it will have up-to-date annotations. |
5e47371
to
0c35b8f
Compare
The last commit caused double definitions of the Annotations class, so the context was too far out. I don't have the time to dig deeper now, so for the moment I am reverting. |
This reverts commit 2b12868.
Since we do not plan to run annotation macros during Namer, there's no need
to annotate before completing. This allows again to define an annotation in the
same scope as an annotated definition. So i3702.scala goes from neg to pos.