From 362aa5cb055e8073d640ed20e2b3f838d0c05b20 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Mon, 10 Nov 2014 14:29:39 +1000 Subject: SI-7521 Fix erasure of parametric value classes. `Erasure.boxingErasure` exists to ensure that we use boxed primitives to represent the value, if the value class has type parameters referred to by its element type. However, this is implenented with a type map that runs deeply across the type. In the enclosed test case, we have `Repr=Array[Int]`, which should be erased to `Array[Int]`, _not_ to `Array[Integer]`. This commit ensures that the `boxingErasure` map only applies boxing at the top level, and not within array arguments. (Other type arguments will be erased, so we don't have to deal with them.) --- test/files/run/t7521/Test.scala | 5 +++++ test/files/run/t7521/Wrapper.scala | 1 + 2 files changed, 6 insertions(+) create mode 100644 test/files/run/t7521/Test.scala create mode 100644 test/files/run/t7521/Wrapper.scala (limited to 'test/files/run/t7521') diff --git a/test/files/run/t7521/Test.scala b/test/files/run/t7521/Test.scala new file mode 100644 index 0000000000..e9816ad6cb --- /dev/null +++ b/test/files/run/t7521/Test.scala @@ -0,0 +1,5 @@ +object Test { + def main(args: Array[String]): Unit = { + new Wrapper(new Array[Int](1)) + } +} diff --git a/test/files/run/t7521/Wrapper.scala b/test/files/run/t7521/Wrapper.scala new file mode 100644 index 0000000000..0b923f8924 --- /dev/null +++ b/test/files/run/t7521/Wrapper.scala @@ -0,0 +1 @@ +class Wrapper[Repr](val xs: Repr) extends AnyVal -- cgit v1.2.3