summaryrefslogtreecommitdiff
path: root/test/files/pos/t8170b.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-01-22 16:05:29 +0100
committerJason Zaugg <jzaugg@gmail.com>2014-01-22 16:05:29 +0100
commit52379b66f96bf7e0ca22f7835ddb06c58d94d4a0 (patch)
tree45003ff926db4fa8e5b08eeadb5dd67fa86ef678 /test/files/pos/t8170b.scala
parent115cd16aca35c8b4000b86f4affd4df243202fd2 (diff)
downloadscala-52379b66f96bf7e0ca22f7835ddb06c58d94d4a0.tar.gz
scala-52379b66f96bf7e0ca22f7835ddb06c58d94d4a0.tar.bz2
scala-52379b66f96bf7e0ca22f7835ddb06c58d94d4a0.zip
SI-8170 Fix regression in TypeRef#transform w. PolyTypes
Regressed in SI-8046 / edc9edb7, by my hand. At the time, I noticed the problem: transform wasn't accounting for the potential Poly-Type-ness of its argument, and this would lead to under-substituted types. The commit comment of edc9edb7 shows an example. But the remedy wasn't the right one. The root problem is that a TypeMap over a PolyType can return one with cloned type parameter symbols, which means we've lose the ability to substitute the type arguments into the result. This commit detects up front whether the type-under-transform is a PolyType with the current TypeRef's type parameters, and just runs the `asSeenFrom` over its result type.
Diffstat (limited to 'test/files/pos/t8170b.scala')
-rw-r--r--test/files/pos/t8170b.scala25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/files/pos/t8170b.scala b/test/files/pos/t8170b.scala
new file mode 100644
index 0000000000..53036f6c8a
--- /dev/null
+++ b/test/files/pos/t8170b.scala
@@ -0,0 +1,25 @@
+import language._
+
+object ScalaZeee {
+ trait HFold[M[_], U] {
+ type Apply[E, A <: U] <: U
+ }
+ trait GenericCons[M[_], H, +T <: GenericList[M]] extends GenericList[M] {
+ val tail: T
+ override type Folded[N[X] >: M[X], U, F <: HFold[N, U]] = F#Apply[H, tail.Folded[N, U, F]]
+ }
+ val KNil: GenericList[Nothing] = ???
+ sealed trait GenericList[+M[_]] {
+ type Folded[N[X] >: M[X], U, F <: HFold[N, U]] <: U
+ }
+}
+
+object TypelevelUsage {
+ import ScalaZeee._
+ type T = GenericCons[Some, String, KNil.type]
+ val klist1: T = ???
+ type T2 = klist1.Folded[Option, Int, HFold[Option, Int]]
+ val count2: T2 = ???
+
+ count2.ensuring(x => true).toChar // trigger an implicit search
+}