Skip to content

Conversation

@nicolasstucki
Copy link
Contributor

No description provided.

@nicolasstucki nicolasstucki self-assigned this Aug 16, 2019
@nicolasstucki nicolasstucki marked this pull request as ready for review August 17, 2019 16:09
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

  • check PCP for annotations
  • check annotations other than ConcreteAnnotation

@nicolasstucki nicolasstucki force-pushed the fix-#7052 branch 2 times, most recently from 8a8595e to f4280ab Compare August 19, 2019 12:20
@nicolasstucki
Copy link
Contributor Author

@liufengyun the two points where addressed

val nestedCtx = ctx.fresh.setNewScope
defs foreach {
case d: DefTree => nestedCtx.enter(d.symbol)
case d: DefTree if d.symbol.isOneOf(GivenOrImplicit) => nestedCtx.enter(d.symbol)
Copy link
Contributor

Choose a reason for hiding this comment

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

This change seems to break the originally intended semantics?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is supposed to add the missing implicits into the scope. But adding other definitions interacts badly with on of the Yckeck while transforming an annotation containing a definition.

def traverse(tree: Tree)(implicit ctx: Context): Unit = {
tree match {
case d: DefTree => nestedCtx.enter(d.symbol)
case d: DefTree if d.symbol.isOneOf(GivenOrImplicit) => nestedCtx.enter(d.symbol)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question as above.

@liufengyun
Copy link
Contributor

@nicolasstucki The printing of the following program shows that the '{4} in the annotation is not reified during compilation:

import scala.quoted._

class annot[T: Type](x: Expr[T]) extends scala.annotation.Annotation

class Test()(implicit qtx: QuoteContext) {
  @annot('{4})
  def foo(str: String) = '{4}
}

I'm not sure if it's a bug or not, as annotations don't have runtime semantics.

@nicolasstucki
Copy link
Contributor Author

We should probably disallow quotes inside annotations.

@liufengyun
Copy link
Contributor

@nicolasstucki Do you prefer to handle the case in this PR, or in a later PR?

@nicolasstucki
Copy link
Contributor Author

Maybe let's open a separate issue.

Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

LGTM

@liufengyun
Copy link
Contributor

The issue is created: #7123

@nicolasstucki nicolasstucki merged commit b7d691f into scala:master Aug 28, 2019
@nicolasstucki nicolasstucki deleted the fix-#7052 branch August 28, 2019 13:44
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