From 96408154f46dce623d3b3c3fdc67f5ccc3779f8f Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 10 Sep 2012 18:07:20 +0200 Subject: Fixes SI-6260 Guards against bridge methods that clash with other methods. Two tests: The neg test is the original ticket. The run test tweaks things slightly so that the generated bridge method does not clash, and tests that the necessary unboxings are indeed performed at runtime. --- test/files/run/t6260.scala | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 test/files/run/t6260.scala (limited to 'test/files/run/t6260.scala') diff --git a/test/files/run/t6260.scala b/test/files/run/t6260.scala new file mode 100644 index 0000000000..cfe9e1e640 --- /dev/null +++ b/test/files/run/t6260.scala @@ -0,0 +1,12 @@ +class Box[X <: CharSequence](val x: X) extends AnyVal { + def map[Y <: CharSequence](f: X => Y): Box[Y] = + ((bx: Box[X]) => new Box(f(bx.x)))(this) + override def toString = s"Box($x)" +} + +object Test { + def main(args: Array[String]) { + val g = (x: String) => x + x + println(new Box("abc") map g) + } +} -- cgit v1.2.3