summaryrefslogtreecommitdiff
path: root/test/files/run/t5009.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@epfl.ch>2012-05-11 16:00:54 +0200
committerLukas Rytz <lukas.rytz@epfl.ch>2012-05-11 16:06:37 +0200
commit40e7cab7a22a8531bdd310bfb57fda51b798c690 (patch)
treebaf453e3316e46b17c7e1f1a1e58ce31eb1b1763 /test/files/run/t5009.scala
parent2422b064e7a52c04dfb2239fc8e7b9ffbab24251 (diff)
downloadscala-40e7cab7a22a8531bdd310bfb57fda51b798c690.tar.gz
scala-40e7cab7a22a8531bdd310bfb57fda51b798c690.tar.bz2
scala-40e7cab7a22a8531bdd310bfb57fda51b798c690.zip
Fix SI-5009: case-class copy method now eta-expands over higher parameter lists.
Example: Given case class C(a: Int)(b: Int) if you call (new C(1)(2)).copy(a = 10)), you get a function (f: Int => C) such that (f.apply(20)) yields a (new C(10)(20)).
Diffstat (limited to 'test/files/run/t5009.scala')
-rw-r--r--test/files/run/t5009.scala17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/files/run/t5009.scala b/test/files/run/t5009.scala
new file mode 100644
index 0000000000..b4fe1bc894
--- /dev/null
+++ b/test/files/run/t5009.scala
@@ -0,0 +1,17 @@
+object Test extends App {
+
+ case class C[T, U <: String, O >: Object](x: Int, y: T)(z: U, b: Boolean)(s: O, val l: Int)
+
+ val c = C(1, true)("dlkfj", true)("dlkfjlk", 10)
+ println(c)
+ println(c.l)
+
+ val f1a = c.copy(y = 20, x = 7283)
+
+ val f1b = c.copy[Int, String, Object](y = 20, x = 7283)
+ val f2b = f1b("lkdjen", false)
+ val res = f2b(new Object, 100)
+ println(res)
+ println(res.l)
+
+}