summaryrefslogtreecommitdiff
path: root/test/files/run/t7120
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-02-13 17:01:36 +0100
committerJason Zaugg <jzaugg@gmail.com>2013-02-14 07:51:39 +0100
commitc11cf0b6c55cc2ec15820dceb6ba825726deed88 (patch)
tree8c8be976b8bb06f85bdad2364d6b62dce6ae9c5d /test/files/run/t7120
parentbafebe1c161f8db0be758c30fe5cc51082a56427 (diff)
downloadscala-c11cf0b6c55cc2ec15820dceb6ba825726deed88.tar.gz
scala-c11cf0b6c55cc2ec15820dceb6ba825726deed88.tar.bz2
scala-c11cf0b6c55cc2ec15820dceb6ba825726deed88.zip
SI-7120 Erasure must honor typeref prefixes
Erasure was discarding these, which led to unnecessarily wide types in quite particular circumstances. This showed up as a double definition error in the reported bug when the bridge method clashed with the erased signature.
Diffstat (limited to 'test/files/run/t7120')
-rw-r--r--test/files/run/t7120/Base_1.scala10
-rw-r--r--test/files/run/t7120/Derived_2.scala9
-rw-r--r--test/files/run/t7120/Run_3.scala3
3 files changed, 22 insertions, 0 deletions
diff --git a/test/files/run/t7120/Base_1.scala b/test/files/run/t7120/Base_1.scala
new file mode 100644
index 0000000000..be07b4f34f
--- /dev/null
+++ b/test/files/run/t7120/Base_1.scala
@@ -0,0 +1,10 @@
+// This bug doesn't depend on separate compilation,
+// in the interests of minimizing the log output during
+// debugging this problem, I've split the compilation.
+
+case class Container( v: String )
+
+trait Base[ T <: AnyRef ] {
+ type UserType = T
+ protected def defect: PartialFunction[ UserType, String ]
+}
diff --git a/test/files/run/t7120/Derived_2.scala b/test/files/run/t7120/Derived_2.scala
new file mode 100644
index 0000000000..e0de629f82
--- /dev/null
+++ b/test/files/run/t7120/Derived_2.scala
@@ -0,0 +1,9 @@
+trait Derived extends Base[ Container ] {
+ protected def defect = { case c: Container => c.v.toString }
+}
+
+// Erasure was ignoring the prefix `Derived#7001.this` when erasing
+// A1, and consequently used `Object` rather than `Container`, which
+// was only seen because that signature clashed with the bridge method.
+//
+// applyOrElse[A1 <: Derived#7001.this.UserType#7318, B1 >: String](x1: A1)
diff --git a/test/files/run/t7120/Run_3.scala b/test/files/run/t7120/Run_3.scala
new file mode 100644
index 0000000000..95e7f994ff
--- /dev/null
+++ b/test/files/run/t7120/Run_3.scala
@@ -0,0 +1,3 @@
+object Test extends Derived with App {
+ println( defect( Container( "8" ) ) )
+}