-
Notifications
You must be signed in to change notification settings - Fork 77
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
sourcecode.Text and math #8
Comments
I believe this is due to constant folding within the Scala compiler. I think it disappears the |
That sounds plausible. What about this one? Is it because of the :-ending operator? @ x(1 :: List(2, 3))
res4: String = ":: List(2, 3)" |
Not sure, but doubtful. That's probably a different matter, will have to dig into it. Keep these coming! |
@ x("a" +: Vector("b", "c"))
res6: String = """
+: Vector("b", "c")
"""
@ x("a" +: Vector("b", "c") :+ "q")
res7: String = """
"a" +: Vector("b", "c") :+ "q" wtf... |
Hmm. Put 'em all together, and they do rather sound like :-ending operators are causing confusion. I don't recall the precedence rules off the top of my head, but if :+ is higher precedence than +:, then the latter three examples all seem to suggest that, if the highest-precedence operator is :-ending, then that's considered the location of the expression. (In other words, my suspicion is that the :+ in the last example overrides the problem introduced by the +: in the previous one, changing the inferred location.) |
@lihaoyi Any tips on how we might help debug this? How might we add code or compiler flags to spit out intermediate representations with positioning information (sorry, I've not programmed macros beyond 1-liners, but am willing to help). |
Desugaring tests: These work:
This does not:
This is with Scala 2.11.7 (wondering if behavior might be slightly different in 2.10 since the library is using calls to deprecated positioning APIs.) |
The text was updated successfully, but these errors were encountered: