From 0bb625b7823befafb170ef05f0493dd0a81a217a Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 30 Oct 2012 20:10:56 +0100 Subject: Fixes SI-6500 by making erasure more regular. With the introduction of value classes, erasure uses specialErasure where a value class C with underlying type T is unboxed to an ErasedValueType. ErasedValue types are eliminated on phase later, in post-erasure. This was done everywhere, except in the parameter types of bridge methods. That was a mistale, because that way bridge methods could not do the boxing/unboxing logic triggered by ErasedValueTypes. Note: there is one remaining use of erasure (not specialErasure) in Erasure.scala. I put in a comment why that is OK. --- test/files/run/t6500.scala | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 test/files/run/t6500.scala (limited to 'test') diff --git a/test/files/run/t6500.scala b/test/files/run/t6500.scala new file mode 100644 index 0000000000..03a68a3a24 --- /dev/null +++ b/test/files/run/t6500.scala @@ -0,0 +1,13 @@ +object Test extends App { + class Box(val value: Int) extends AnyVal + + trait Foo { + def append(box: Box): Foo + } + + class Bar extends Foo { + override def append(box: Box): Bar = this // produces bad forwarder + } + + ((new Bar): Foo).append(new Box(0)) +} -- cgit v1.2.3