You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I confirmed that the bug is not related to functionality that was deprecated: lifted transformers (TransformerFs) or unsafeOption flags
Describe the bug
Transforming into a class with a mutable field no longer works as of 0.8.0 - I did not find this in a list of removed functionality
Reproduction
The following works in 0.7.5, fails to compile on 0.8.0
object Main extends App {
def fromRow(row: Bar): Foo = row.transformInto[Foo]
}
case class Foo(var string: String)
case class Bar(string: String)
Expected behavior
As per the documentation 'every class with a public primary constructor can be the target of the transformation.' - a case class with a mutable field is very much a class with a public primary constructor - I would expect this to continue to work as before
Actual behavior
~/chimney_min_bug/src/main/scala/chimney_min_bug/Main.scala:7:49: Chimney can't derive transformation from chimney_min_bug.Bar to chimney_min_bug.Foo
[error]
[error] chimney_min_bug.Foo
[error] setStri(stri: java.lang.String) - no accessor named stri in source type chimney_min_bug.Bar
[error]
[error]
[error] Consult https://chimney.readthedocs.io for usage examples.
[error]
[error] def fromRow(row: Bar): Foo = row.transformInto[Foo]
[error] ^
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
Which Chimney version do you use
Succeeds with 0.7.5, fails with 0.8.0
Which platform do you use
JVM
Scala.js
Scala Native
If you checked JVM
$ java -version
openjdk version "17.0.6" 2023-01-17
OpenJDK Runtime Environment GraalVM CE 22.3.1 (build 17.0.6+10-jvmci-22.3-b13)
OpenJDK 64-Bit Server VM GraalVM CE 22.3.1 (build 17.0.6+10-jvmci-22.3-b13, mixed mode, sharing)
Additional context
N/A
The text was updated successfully, but these errors were encountered:
hughsimpson
changed the title
Transforming into case class with mutable field breads from
Transforming into case class with mutable field breads from 0.8.0
Oct 16, 2023
hughsimpson
changed the title
Transforming into case class with mutable field breads from 0.8.0
Transforming into case class with mutable field breaks from 0.8.0
Oct 16, 2023
Checklist
TransformerF
s) orunsafeOption
flagsDescribe the bug
Transforming into a class with a mutable field no longer works as of 0.8.0 - I did not find this in a list of removed functionality
Reproduction
The following works in 0.7.5, fails to compile on 0.8.0
Expected behavior
As per the documentation 'every class with a public primary constructor can be the target of the transformation.' - a case class with a mutable field is very much a class with a public primary constructor - I would expect this to continue to work as before
Actual behavior
Which Chimney version do you use
Succeeds with 0.7.5, fails with 0.8.0
Which platform do you use
If you checked JVM
Additional context
N/A
The text was updated successfully, but these errors were encountered: