Skip to content

Quoted expressions in annotations #7121

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
nicolasstucki opened this issue Aug 28, 2019 · 2 comments
Closed

Quoted expressions in annotations #7121

nicolasstucki opened this issue Aug 28, 2019 · 2 comments

Comments

@nicolasstucki
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.

Originally posted by @liufengyun in #7053 (comment)

@nicolasstucki
Copy link
Contributor Author

We should disallow them

@nicolasstucki
Copy link
Contributor Author

nicolasstucki commented Aug 28, 2019

And this one #7053 (comment)

import scala.quoted._

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants