summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-12-08 22:37:38 +0100
committerJason Zaugg <jzaugg@gmail.com>2013-12-10 14:23:35 +0100
commit6f42bd6881f9b1a6fa25d744cded38f53058538c (patch)
tree39b8ea92d8841e56ff0c319670ac7cb8cac760a7 /test
parent0de991ffea7c0d461cb4435fb8385c52ee39f7e3 (diff)
downloadscala-6f42bd6881f9b1a6fa25d744cded38f53058538c.tar.gz
scala-6f42bd6881f9b1a6fa25d744cded38f53058538c.tar.bz2
scala-6f42bd6881f9b1a6fa25d744cded38f53058538c.zip
SI-8046 Only use fast TypeRef#baseTypeSeq with concrete base types
We can only compute the base type sequence (BTS) of a `TypeRef` by element-wise transforming the BTS of the referenced symbol if there are no abstract types in its BTS type symbols. In the now-working test case, `pos/t8046.scala`, the difference between the old and new calculation of the BTS is: this = Three.this.Alias[Int] sym.info.baseTypeSeq = BTS(One.this.Op[A],Any) mapped BTS = BTS(Three.this.Op[Int],Any) full BTS = BTS(Three.this.Op[Int],Int => Int,Object,Any) The change to account for PolyType in ArgsTypeRef#transform is now needed to avoid the full BTS of: BTS(Three.this.Op[A],A => A,Object,Any) Interestingly, everything actually works without that change.
Diffstat (limited to 'test')
-rw-r--r--test/files/pos/t8046c.scala (renamed from test/pending/pos/t8046c.scala)2
-rw-r--r--test/files/run/t8046.check2
-rw-r--r--test/files/run/t8046/Test.scala18
-rw-r--r--test/files/run/t8046/t8046c.scala13
4 files changed, 34 insertions, 1 deletions
diff --git a/test/pending/pos/t8046c.scala b/test/files/pos/t8046c.scala
index 9a8616828d..f05b4c15b5 100644
--- a/test/pending/pos/t8046c.scala
+++ b/test/files/pos/t8046c.scala
@@ -5,7 +5,7 @@ trait One {
trait Three extends One {
trait Op[A] extends (A => A)
-
+
def f1(f: Op[Int]) = f(5)
def f2(f: Alias[Int]) = f(5)
def f3[T <: Op[Int]](f: T) = f(5)
diff --git a/test/files/run/t8046.check b/test/files/run/t8046.check
new file mode 100644
index 0000000000..905b0b35ca
--- /dev/null
+++ b/test/files/run/t8046.check
@@ -0,0 +1,2 @@
+List(trait Op, trait Function1, class Object, class Any)
+BTS(T,Three.this.Op[Int],Int => Int,Object,Any)
diff --git a/test/files/run/t8046/Test.scala b/test/files/run/t8046/Test.scala
new file mode 100644
index 0000000000..f6b525d1b5
--- /dev/null
+++ b/test/files/run/t8046/Test.scala
@@ -0,0 +1,18 @@
+import scala.tools.partest._
+
+object Test extends DirectTest {
+ override def code = ""
+ override def extraSettings: String = "-usejavacp"
+
+ override def show() {
+ val c = newCompiler()
+ new c.Run
+ import c._
+
+ val f4 = typeOf[Three].member(newTermName("f4"))
+ val f4ParamInfo = f4.paramss.head.head.info
+ println(f4ParamInfo.baseClasses)
+ println(f4ParamInfo.baseTypeSeq)
+ }
+}
+
diff --git a/test/files/run/t8046/t8046c.scala b/test/files/run/t8046/t8046c.scala
new file mode 100644
index 0000000000..0b484da530
--- /dev/null
+++ b/test/files/run/t8046/t8046c.scala
@@ -0,0 +1,13 @@
+import language._
+
+trait One {
+ type Op[A]
+ type Alias[A] = Op[A]
+}
+
+trait Three extends One {
+ trait Op[A] extends (A => A)
+
+ def f4[T <: Alias[Int]](f: T) = 0
+}
+