We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a98b901 commit a34c90eCopy full SHA for a34c90e
tests/run/i209.scala
@@ -0,0 +1,23 @@
1
+case class Foo(a: Int) {
2
+ def copy(i: Int = 9): Foo = Foo(i)
3
+}
4
+
5
+case class Bar(a: Int, b: Int) {
6
+ def copy(i: Int = 4, j: Int = 6): Bar = Bar(i, j)
7
8
9
+object Test {
10
+ def main(args: Array[String]): Unit = {
11
+ val a = Foo(2)
12
+ assert(a == Foo(2))
13
+ assert(a.copy(5) == Foo(5))
14
+ assert(a.copy() == Foo(9))
15
16
+ val b = Bar(2, 3)
17
+ assert(b == Bar(2, 3))
18
+ assert(b.copy(5, 7) == Bar(5, 7))
19
+ assert(b.copy(5) == Bar(5, 6))
20
+ assert(b.copy(j = 5) == Bar(4, 5))
21
+ assert(b.copy() == Bar(4, 6))
22
+ }
23
0 commit comments