-
Notifications
You must be signed in to change notification settings - Fork 53
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
Compilation failure when using closure #41
Comments
Hi, Same problem, but with a The following code is ok: case class B(n: Int)
val xs = Seq(B(1), B(2), B(3), B(4))
val ys = xs.modify(_.eachWhere(_.n % 2 == 0).n).using(_ * 2) But this one is not: case class B(n: Int)
val xs = Seq(B(1), B(2), B(3), B(4))
val test = 0
val ys = xs.modify(_.eachWhere(_.n % 2 == test).n).using(_ * 2) The error is:
PS: scala |
As a workaround, I found out that you can rewrite
to
Not as nice, but at least it compiles. |
i ran into the same
however, i wasn't getting any exception; sbt simply failed with the cryptic:
|
There is a workaround (see @erikvanoosten post):
I wish if the original eachWhere worked. |
we stumbled across this bug as well after switching to 2.12. took ages to understand this was due to this very bug, but better late than never. the workaround does work. please let me know if I could help, I am willing to spend time on this fixing it. But would need at least some guidance |
@pete-proton I wish I could help you, but I'm not sure where to start as well :) Did you try on 2.13 - is the problem there as well? If not, this might indicate that this is some 2.12-compiler-specific hmm ... let's say "feature", that might be hard to overcome. If this happens also on 2.13, maybe we incorrectly use the tree api in the macro |
@adamw I see, I will try with 2.13 and see how that goes. thanks for the quick response |
Hi there. Is there any idea about when it would be available? |
@adamw thank you for the guidance. the issue seems to be reproducible using scala 2.13, see. If you could give directions on how to fix it, I would be very grateful. I just have not worked with macros before. thank you in advance. |
@pete-proton If I only knew I would fix it :) I would start by looking at usages of |
thank you, @adamw |
For Scala 2 untypecheck args to automatically rewrite owners of functions. For Scala 3 change owners of args manually. closes softwaremill#41 closes softwaremill#60 closes softwaremill#86
Using scala 2.12.4, JDK 8u141, Quicklens 1.4.11.
Using the following setup with an example from the documentation:
Then this will work:
but this will fail with a compilation error:
The exception is quite long, but it starts like this:
So it looks like closures don't work.
The text was updated successfully, but these errors were encountered: