diff options
author | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2013-12-19 09:32:07 -0800 |
---|---|---|
committer | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2013-12-19 09:32:07 -0800 |
commit | e94faee1a9b5ffdb2efa19f0934f01d87ad7ac10 (patch) | |
tree | 114bdc918fd9b7674ad5035738284b4a4b5294a8 /test/files/run | |
parent | fa20a1c9c479ceff93075fca40be6ee89a97e4c8 (diff) | |
parent | 6a4947c45c0b5fac3297da320b9627069a7b5ac4 (diff) | |
download | scala-e94faee1a9b5ffdb2efa19f0934f01d87ad7ac10.tar.gz scala-e94faee1a9b5ffdb2efa19f0934f01d87ad7ac10.tar.bz2 scala-e94faee1a9b5ffdb2efa19f0934f01d87ad7ac10.zip |
Merge pull request #3274 from retronym/ticket/8017
SI-8017 Value class awareness for -Ydelamdafy:method
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/t8017.flags | 1 | ||||
-rw-r--r-- | test/files/run/t8017/value-class-lambda.scala | 40 | ||||
-rw-r--r-- | test/files/run/t8017/value-class.scala | 3 |
3 files changed, 44 insertions, 0 deletions
diff --git a/test/files/run/t8017.flags b/test/files/run/t8017.flags new file mode 100644 index 0000000000..48b438ddf8 --- /dev/null +++ b/test/files/run/t8017.flags @@ -0,0 +1 @@ +-Ydelambdafy:method diff --git a/test/files/run/t8017/value-class-lambda.scala b/test/files/run/t8017/value-class-lambda.scala new file mode 100644 index 0000000000..370023b194 --- /dev/null +++ b/test/files/run/t8017/value-class-lambda.scala @@ -0,0 +1,40 @@ +object Test { + def testC { + val f1 = (c: C) => c.value + val f2 = (x: Int) => new C(x) + val f3 = (c1: C) => (c2: C) => (c1, c2) + val r1 = f2(2) + val r2 = f2(2) + val r3 = f3(r1)(r2) + val result = f1(r3._2) + assert(result == 2) + } + + def testD { + val f1 = (c: D) => c.value + val f2 = (x: String) => new D(x) + val f3 = (c1: D) => (c2: D) => (c1, c2) + val r1 = f2("2") + val r2 = f2("2") + val r3 = f3(r1)(r2) + val result = f1(r3._2) + assert(result == "2") + } + + def testE { + val f1 = (c: E[Int]) => c.value + val f2 = (x: Int) => new E(x) + val f3 = (c1: E[Int]) => (c2: E[Int]) => (c1, c2) + val r1 = f2(2) + val r2 = f2(2) + val r3 = f3(r1)(r2) + val result = f1(r3._2) + assert(result == 2) + } + + def main(args: Array[String]) { + testC + testD + testE + } +} diff --git a/test/files/run/t8017/value-class.scala b/test/files/run/t8017/value-class.scala new file mode 100644 index 0000000000..821239305f --- /dev/null +++ b/test/files/run/t8017/value-class.scala @@ -0,0 +1,3 @@ +class C(val value: Int) extends AnyVal +class D(val value: String) extends AnyVal +class E[A](val value: A) extends AnyVal |