【发布时间】:2014-01-03 12:57:55
【问题描述】:
以下代码在 Scala 2.9.1 中编译:
scala> case class Foo(a: String)(val b: Int = 1)
defined class Foo
scala> val foo = Foo("some")(2)
foo: Foo = Foo(some)
scala> foo.copy("another")()
res1: Foo = Foo(another)
但在 2.10.3 中,我们收到以下错误:
scala> foo.copy("another")()
<console>:11: error: not enough arguments for method copy: (b: Int)Foo.
Unspecified value parameter b.
foo.copy("another")()
有人能解释一下为什么会这样吗?而且我还想知道除了 foo.copy("another")(foo.b)
是否有一些聪明的方法可以做到这一点【问题讨论】:
-
貌似回归了,请举报here。
标签: scala scala-2.10 case-class