Skip to content
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

q"foo.bar(..$args)" matches empty arg lists #8008

Closed
scabug opened this issue Nov 24, 2013 · 4 comments
Closed

q"foo.bar(..$args)" matches empty arg lists #8008

scabug opened this issue Nov 24, 2013 · 4 comments
Assignees
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Nov 24, 2013

15:42 ~/Projects/Master (master)$ scala
Welcome to Scala version 2.11.0-20131122-180524-744425aab4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_65).
Type in expressions to have them evaluated.
Type :help for more information.

scala> val q"$foo.$bar(..$args)" = q"foo.bar"
foo: reflect.runtime.universe.Tree = foo
bar: reflect.runtime.universe.Name = bar
args: List[reflect.runtime.universe.Tree] = List()

scala> q"$foo.$bar(..$args)"
res0: reflect.runtime.universe.Tree = foo.bar()

Looks like the aforementioned roundtrip adds spurious argument list to argless applications. This is fine for empty-arglist methods, but nullary methods are going to get hurt.

@scabug
Copy link
Author

@scabug scabug commented Nov 24, 2013

Imported From: https://issues.scala-lang.org/browse/SI-8008?orig=1
Reporter: @xeno-by
Affected Versions: 2.11.0-M7

@scabug
Copy link
Author

@scabug scabug commented Nov 29, 2013

@densh said:
This change was introduced to make q"f(..$args)" behave similarly to q"f[..$targs]" but we've not considered the fact that this not applicable here due to different semantics of q"f(..$Nil)" and q"f[..$Nil]". Later case is equivalent to q"f" but former is not.

@scabug
Copy link
Author

@scabug scabug commented Nov 29, 2013

@densh said:
Fixed in my wip branch.

@scabug
Copy link
Author

@scabug scabug commented Dec 13, 2013

@densh said:
Fixed in scala/scala#3255

@scabug scabug closed this Dec 13, 2013
@scabug scabug added this to the 2.11.0-M8 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants