-
Notifications
You must be signed in to change notification settings - Fork 21
SyntacticApply is too permissive #8387
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
Comments
Imported From: https://issues.scala-lang.org/browse/SI-8387?orig=1 |
@densh said: scala> val q"$expr[..$targs](...$argss)" = q"new C(1, 2)"
expr: reflect.runtime.universe.Tree = new C
targs: List[reflect.runtime.universe.Tree] = List()
argss: List[List[reflect.runtime.universe.Tree]] = List(List(1, 2)) |
@densh said: |
@adriaanm said: |
@xeno-by said (edited on Mar 15, 2014 3:36:40 PM UTC): |
@adriaanm said: |
@densh said (edited on Mar 25, 2014 12:52:21 PM UTC): I do agree that matching of new as an application is confusing though, as new is not an application from syntactical point of view but an instantiation of an object with given template. |
@densh said: |
At the moment q"$core..$targs" is going to match any tree. If the tree is not an application, then targs will be Nil, argss with be Nil, and core will be the entire tree.
This behavior is caused by the desire to have
val q"$core(...$argss)" = q"foo.bar"
working, which is I think a good thing, given the semantics of application in Scala. However, it also makes quasiquotes very permissive, which would probably lead to confusion.I also assigned Critical priority to this issue, because if we release Scala 2.11.0 with this not fixed, then everyone's going to depend on this behavior, and we might break a lot of code when fixing this issue.
The text was updated successfully, but these errors were encountered: