diff options
Diffstat (limited to 'test/files/pos')
-rw-r--r-- | test/files/pos/delambdafy_t6260_method.check | 13 | ||||
-rw-r--r-- | test/files/pos/delambdafy_t6260_method.flags | 1 | ||||
-rw-r--r-- | test/files/pos/delambdafy_t6260_method.scala | 17 | ||||
-rw-r--r-- | test/files/pos/t6260.flags | 1 | ||||
-rw-r--r-- | test/files/pos/t6260.scala | 17 | ||||
-rw-r--r-- | test/files/pos/t6260b.scala | 3 |
6 files changed, 52 insertions, 0 deletions
diff --git a/test/files/pos/delambdafy_t6260_method.check b/test/files/pos/delambdafy_t6260_method.check new file mode 100644 index 0000000000..f5cd6947d1 --- /dev/null +++ b/test/files/pos/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/pos/delambdafy_t6260_method.flags b/test/files/pos/delambdafy_t6260_method.flags new file mode 100644 index 0000000000..48b438ddf8 --- /dev/null +++ b/test/files/pos/delambdafy_t6260_method.flags @@ -0,0 +1 @@ +-Ydelambdafy:method diff --git a/test/files/pos/delambdafy_t6260_method.scala b/test/files/pos/delambdafy_t6260_method.scala new file mode 100644 index 0000000000..93b5448227 --- /dev/null +++ b/test/files/pos/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/pos/t6260.flags b/test/files/pos/t6260.flags new file mode 100644 index 0000000000..2349d8294d --- /dev/null +++ b/test/files/pos/t6260.flags @@ -0,0 +1 @@ +-Ydelambdafy:inline diff --git a/test/files/pos/t6260.scala b/test/files/pos/t6260.scala new file mode 100644 index 0000000000..93b5448227 --- /dev/null +++ b/test/files/pos/t6260.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/pos/t6260b.scala b/test/files/pos/t6260b.scala new file mode 100644 index 0000000000..73e2e58f73 --- /dev/null +++ b/test/files/pos/t6260b.scala @@ -0,0 +1,3 @@ + +class X(val value: Object) extends AnyVal { def or(alt: => X): X = this } +class Y { def f = new X("") or new X("") } |