-
Notifications
You must be signed in to change notification settings - Fork 15
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
Fix implicit parameter list capture #52
Conversation
case Apply(x, ys) => Apply(recordAllValues(x), ys.map(recordAllValues)) | ||
case Apply(x, ys) => | ||
val allParametersAreImplicit = | ||
ys.map(x => Option(x.symbol).fold(false)(_.isImplicit)).forall(_ == true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.symbol
can be null
🎉 :D
Nice. Thanks for the fix! |
The journey is not over, apparently :D I spotted this in my own project, and even publishing with this fix doesn't seem to help it. I will keep reproducing and fixing I guess :-/ |
Gonna keep my notes I added a Scala3-only test, using givens instead of implicits. And that's what broke. Because in the AST, if you use givens: ------------------------------
expression: z.hello[scala.Int](50)(given_Test_Int)
parameters: List(Ident(given_Test_Int))
flags: List(Flags.Final | Flags.Lazy | Flags.Module | Flags.StableRealizable)
apply on: z.hello[scala.Int](50) But if you use implicits: ------------------------------
z.hello[scala.Int](50)(testInt)
List(Ident(testInt))
List(Flags.Implicit)
z.hello[scala.Int](50) And the problem is that using givens this is not passing the flags check :( |
@eed3si9n @Baccata I think this is in a better state for review. The reason original fix was insufficient is that For the simple reason that it's not mentioned here :) https://github.com/lampepfl/dotty/blob/master/compiler/src/scala/quoted/runtime/impl/printers/Extractors.scala#L37 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Squash the commits please, and I think it's good to go.
dedd3de
to
8fc7d18
Compare
This particular case seems to have slipped through in #51
Wasn't working before Oli's PR as well.
Problem is breaking apart multiple argument lists - adding
recordValue
in the wrong place (between an implicit and non-implicit parameter list), seems to break things.The way to fix it is to avoid putting recorders on the implicit parameters (not tearing them away from a method call).
This, obviously, is the stuff of nightmares in Scala 3, where you can do anything: