diff options
author | James Iry <james.iry@typesafe.com> | 2013-08-28 20:51:31 -0700 |
---|---|---|
committer | James Iry <james.iry@typesafe.com> | 2013-11-06 15:25:55 -0800 |
commit | 8d4a5bab2666c7006f31645b59cf063f07a8a12d (patch) | |
tree | 368194b114a0ee815fce5b8c62a0a7711dd79afb /test/files/neg | |
parent | 13ea5909ea25e4bad184e9e4581d94230dc11d9f (diff) | |
download | scala-8d4a5bab2666c7006f31645b59cf063f07a8a12d.tar.gz scala-8d4a5bab2666c7006f31645b59cf063f07a8a12d.tar.bz2 scala-8d4a5bab2666c7006f31645b59cf063f07a8a12d.zip |
Create test variants where delambdafication alters signatures.
This commit includes several tests where there's a variation in
signatures between inline delambdafication and method based
delambdafication.
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/delambdafy_t6260_method.check | 13 | ||||
-rw-r--r-- | test/files/neg/delambdafy_t6260_method.flags | 1 | ||||
-rw-r--r-- | test/files/neg/delambdafy_t6260_method.scala | 17 | ||||
-rw-r--r-- | test/files/neg/t6260.flags | 1 |
4 files changed, 32 insertions, 0 deletions
diff --git a/test/files/neg/delambdafy_t6260_method.check b/test/files/neg/delambdafy_t6260_method.check new file mode 100644 index 0000000000..f5cd6947d1 --- /dev/null +++ b/test/files/neg/delambdafy_t6260_method.check @@ -0,0 +1,13 @@ +delambdafy_t6260_method.scala:3: error: bridge generated for member method apply: (bx: Object)Object in class map$extension1 +which overrides method apply: (v1: Object)Object in trait Function1 +clashes with definition of the member itself; +both have erased type (bx: Object)Object + ((bx: Box[X]) => new Box(f(bx.x)))(this) + ^ +delambdafy_t6260_method.scala:8: error: bridge generated for member method apply: (bx: Object)Object in class map21 +which overrides method apply: (v1: Object)Object in trait Function1 +clashes with definition of the member itself; +both have erased type (bx: Object)Object + ((bx: Box[X]) => new Box(f(bx.x)))(self) + ^ +two errors found diff --git a/test/files/neg/delambdafy_t6260_method.flags b/test/files/neg/delambdafy_t6260_method.flags new file mode 100644 index 0000000000..48b438ddf8 --- /dev/null +++ b/test/files/neg/delambdafy_t6260_method.flags @@ -0,0 +1 @@ +-Ydelambdafy:method diff --git a/test/files/neg/delambdafy_t6260_method.scala b/test/files/neg/delambdafy_t6260_method.scala new file mode 100644 index 0000000000..93b5448227 --- /dev/null +++ b/test/files/neg/delambdafy_t6260_method.scala @@ -0,0 +1,17 @@ +class Box[X](val x: X) extends AnyVal { + def map[Y](f: X => Y): Box[Y] = + ((bx: Box[X]) => new Box(f(bx.x)))(this) +} + +object Test { + def map2[X, Y](self: Box[X], f: X => Y): Box[Y] = + ((bx: Box[X]) => new Box(f(bx.x)))(self) + + def main(args: Array[String]) { + val f = (x: Int) => x + 1 + val g = (x: String) => x + x + + map2(new Box(42), f) + new Box("abc") map g + } +} diff --git a/test/files/neg/t6260.flags b/test/files/neg/t6260.flags new file mode 100644 index 0000000000..2349d8294d --- /dev/null +++ b/test/files/neg/t6260.flags @@ -0,0 +1 @@ +-Ydelambdafy:inline |