summaryrefslogtreecommitdiff
path: root/test/files/run/t7521b.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-11-10 14:29:39 +1000
committerJason Zaugg <jzaugg@gmail.com>2014-11-10 14:45:23 +1000
commit362aa5cb055e8073d640ed20e2b3f838d0c05b20 (patch)
tree9f347249325445c2d3b4084ebf3c5f5bbd046c54 /test/files/run/t7521b.scala
parent15ae8ddd1cc68bee0b4b38b3830720d422656642 (diff)
downloadscala-362aa5cb055e8073d640ed20e2b3f838d0c05b20.tar.gz
scala-362aa5cb055e8073d640ed20e2b3f838d0c05b20.tar.bz2
scala-362aa5cb055e8073d640ed20e2b3f838d0c05b20.zip
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.)
Diffstat (limited to 'test/files/run/t7521b.scala')
-rw-r--r--test/files/run/t7521b.scala20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/files/run/t7521b.scala b/test/files/run/t7521b.scala
new file mode 100644
index 0000000000..c9e27f28b4
--- /dev/null
+++ b/test/files/run/t7521b.scala
@@ -0,0 +1,20 @@
+class Wrapper[X](x: X)
+
+class C {
+ def a(w: Wrapper[Array[Int]]) = 0
+ def b(w: Wrapper[Int]) = 0
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val c = new C
+ c.a(new Wrapper(Array(1, 2)))
+ c.b(new Wrapper(1))
+
+ val methods = classOf[C].getDeclaredMethods.sortBy(_.getName)
+ println("= Java Erased Signatures =")
+ println(methods.mkString("\n"))
+ println("\n= Java Generic Signatures =")
+ println(methods.map(_.toGenericString).mkString("\n"))
+ }
+}