summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-02-23 10:31:14 -0800
committerPaul Phillips <paulp@improving.org>2013-02-23 10:31:14 -0800
commitbf118cfe90349f023bd5ea7b060b0cbf76d7ab46 (patch)
treec6c98165f44b16508abcd17f82c03841b0eef3d2 /test/files
parent08b2def5d18898388655a4c69a00de538f3aecde (diff)
parentc11cf0b6c55cc2ec15820dceb6ba825726deed88 (diff)
downloadscala-bf118cfe90349f023bd5ea7b060b0cbf76d7ab46.tar.gz
scala-bf118cfe90349f023bd5ea7b060b0cbf76d7ab46.tar.bz2
scala-bf118cfe90349f023bd5ea7b060b0cbf76d7ab46.zip
Merge pull request #2125 from retronym/ticket/7120
SI-7120 Erasure must honor typeref prefixes
Diffstat (limited to 'test/files')
-rw-r--r--test/files/run/t7120.check1
-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
-rw-r--r--test/files/run/t7120b.check2
-rw-r--r--test/files/run/t7120b.scala27
6 files changed, 52 insertions, 0 deletions
diff --git a/test/files/run/t7120.check b/test/files/run/t7120.check
new file mode 100644
index 0000000000..45a4fb75db
--- /dev/null
+++ b/test/files/run/t7120.check
@@ -0,0 +1 @@
+8
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" ) ) )
+}
diff --git a/test/files/run/t7120b.check b/test/files/run/t7120b.check
new file mode 100644
index 0000000000..aa2f5e7c9f
--- /dev/null
+++ b/test/files/run/t7120b.check
@@ -0,0 +1,2 @@
+public int C$D.foo(java.lang.String)
+public int C$D.foo(java.lang.String)
diff --git a/test/files/run/t7120b.scala b/test/files/run/t7120b.scala
new file mode 100644
index 0000000000..9f6591aa06
--- /dev/null
+++ b/test/files/run/t7120b.scala
@@ -0,0 +1,27 @@
+trait Base[A] { type B = A; }
+class C extends Base[String] {
+ class D {
+ def foo[B1 <: B](b: B1) = 0
+ }
+}
+
+trait BaseHK[M[_], A] { type B = M[A]; }
+object BaseHK { type Id[X] = X }
+class CHK extends BaseHK[BaseHK.Id, String] {
+ class D {
+ def foo[B1 <: B](b: B1) = 0
+ }
+}
+
+
+object Test extends App {
+ val c = new C
+ val d = new c.D()
+ val meth = d.getClass.getMethods.find(_.getName == "foo").get
+ println(meth)
+
+ val chk = new CHK
+ val dhk = new chk.D()
+ val methhk = d.getClass.getMethods.find(_.getName == "foo").get
+ println(methhk)
+}