-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
Following code does not compile in Scala 2 and it should not compile in Scala 3. It is accepted instead, but the modify does nothing at all:
import com.softwaremill.quicklens._
object Main {
case class Content(x: String)
class A(val c: Content) {
override def toString = s"x:${c.x}"
def copy(x: String = c.x): A = new A(Content(x))
}
def main(args: Array[String]): Unit = {
val a = new A(Content("A"))
val am = a.modify(_.c).setTo(Content("B"))
println(am)
}
}There is no copy accepting c parameter, therefore modify(_.c) is impossible to implement.
Result when running this in Scala 3 is:
x:A
Metadata
Metadata
Assignees
Labels
No labels