-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Regression in arainko/ducktape
under -Xcheck-macros
when comparing field types
#18754
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
Project-wise bisect results: The commit-based bisect failed due to missing sbt-bridge |
We need a self-contained version of this code to make any progress on this issue. @arainko could you help us with that? |
Sure, I'll try to minimize this over the weekend |
Ok, so my findings so far (I couldn't get a full minimization yet) - the error happens after a call to LiftTransformation.liftTransformation is made and then when the macro falls into the liftDerivedTransformation(transformer, appliedTo) case. What this specific piece of code does:
Transformer.ForProduct.make((p: Person) => new Person2(p.int, p.str)) We'll get
final case class ToplevelPrimitive(value: ReproPrimitive)
final case class ToplevelComplex(value: ReproComplex)
final case class ReproPrimitive(name: String)
final case class ReproComplex(name: Name)
final case class Name(value: String)
given Transformer[String, Name] = str => Name(str + "-LOCAL")
val primitive: ToplevelPrimitive = ???
inline def manualTransformer = Transformer.ForProduct.make[ToplevelPrimitive, ToplevelComplex](
(source: ToplevelPrimitive) =>
new ToplevelComplex(value =
new ReproComplex(
name = given_Transformer_String_Name.transform(source.value.name)
)
)
).transform(primitive) will be rewritten to this: (new ToplevelComplex(value = new ReproComplex(name = given_Transformer_String_Name.transform(primitive.value.name))): ToplevelComplex) so it kind of 'lifts' the transformation from the Transformer's body by getting the RHS of the SAM lambda that creates it and replaces all of the references to the lambda parameter with the expression passed into The error seems to occur when the body of (I'm writing this in hopes that it gives an AHA moment to somebody 😄 ) I'll try to tackle this once again when I've got some free time. |
Fixed in both LTS (3.3.3) and 3.nightly. Failing in 3.4.0, compiles in 3.4.1-RC1 |
Open CB failure found in @arainko /ducktape under
-Xcheck-macros
. Builds logsThe issue is only present when checking types of nested members (
contact.phoneNo
)Compiler version
3.4.0-RC1-bin-20231023-44a537b-NIGHTLY
Works in 3.3.1
Minimized code
No minimization yet, reproducer:
Output
Expectation
Should not raise an error
The text was updated successfully, but these errors were encountered: