goggles
goggles copied to clipboard
Can't access fields on varargs case class
If a case class field is marked as varargs, then "get" and "set" expressions cannot recognise the expected copy method.
Once #3 is resolved, "get" shouldn't be a problem at least.
scala> case class Foo(ns: Int*)
defined class Foo
scala> get"$res1.ns"
<console>:26: error: Can't update 'ns', because no 'copy' method found on Foo
get"$res1.ns"
^
scala> set"$res1.ns" := Nil
<console>:26: error: Can't update 'ns', because no 'copy' method found on Foo
set"$res1.ns" := Nil
^
A copy method actually doesn't get generated for varargs case classes. Our options are:
- Leave the (essentially accurate) error message as is
- Produce a custom error message explaining the situation with varargs case classes
- Put in a special case that can modify varargs case classes using the companion object or constructor, rather than
copy.
It can wait until after 1.0.