-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
Following opaque type has defined both getters and copy, but it is not possible to use quicklens on it:
import com.softwaremill.quicklens.*
object Types {
case class V(x: Double, y: Double)
opaque type Vec = V
object Vec {
def apply(x: Double, y: Double): Vec = V(x, y)
}
extension (v: Vec) {
def x: Double = v.x
def y: Double = v.y
def copy(x: Double = v.x, y: Double = v.y): Vec = V(x, y)
}
}
object Main {
import Types.*
def main(args: Array[String]): Unit = {
val a = Vec(1, 2)
val b = a.modify(_.x).using(_ + 1)
println(b)
}
}With Scala 3.4.2 the error is:
Unsupported path element. Path must have shape: .field1.field2.each.field3.(...), got: (($1: Types.Vec) => Types.x($1))
val b = a.modify(.x).using(_ + 1)
Metadata
Metadata
Assignees
Labels
No labels