Skip to content

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

Merged
merged 2 commits into from
Jul 8, 2018

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jul 7, 2018

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.

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.
@odersky odersky requested a review from allanrenucci July 7, 2018 11:36
@@ -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
Copy link
Member

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 =
Copy link
Member

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 :)

Copy link
Contributor

@allanrenucci allanrenucci left a 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

@allanrenucci
Copy link
Contributor

Should we also revert #1249?

@odersky
Copy link
Contributor Author

odersky commented Jul 7, 2018

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.

@odersky odersky force-pushed the undo-annotations-phase branch from 5e47371 to 0c35b8f Compare July 8, 2018 08:48
@odersky
Copy link
Contributor Author

odersky commented Jul 8, 2018

I think this needs to be implicit ctx => typedAnnotation(annotTree)(annotContext(original, sym))

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.

@odersky odersky merged commit ff184cc into scala:master Jul 8, 2018
@allanrenucci allanrenucci deleted the undo-annotations-phase branch July 8, 2018 10:22
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.

3 participants