summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Iry <jamesiry@gmail.com>2013-05-29 19:20:14 -0700
committerJames Iry <jamesiry@gmail.com>2013-05-29 19:20:14 -0700
commitd16786d1ec75c50a9934eb4d9203bc551c51e2d1 (patch)
tree7eecd6bb4d0dd56883cf6b6b07497cd568b9c947
parent810a6de757a44d7d481e0ee1bd9c2fb8abe6043d (diff)
parent403eadd0f10cf6e493b81913148b0b9065e80699 (diff)
downloadscala-d16786d1ec75c50a9934eb4d9203bc551c51e2d1.tar.gz
scala-d16786d1ec75c50a9934eb4d9203bc551c51e2d1.tar.bz2
scala-d16786d1ec75c50a9934eb4d9203bc551c51e2d1.zip
Merge pull request #2607 from retronym/ticket/7517
SI-7517 Fix higher kinded type inference regression
-rw-r--r--src/reflect/scala/reflect/internal/Types.scala7
-rw-r--r--test/files/pos/t7517.scala22
2 files changed, 25 insertions, 4 deletions
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala
index ee584bed2c..0cc2b91a44 100644
--- a/src/reflect/scala/reflect/internal/Types.scala
+++ b/src/reflect/scala/reflect/internal/Types.scala
@@ -3218,10 +3218,9 @@ trait Types extends api.Types { self: SymbolTable =>
sameLength(typeArgs, tp.typeArgs) && {
val lhs = if (isLowerBound) tp.typeArgs else typeArgs
val rhs = if (isLowerBound) typeArgs else tp.typeArgs
- // this is a higher-kinded type var with same arity as tp.
- // side effect: adds the type constructor itself as a bound
- addBound(tp.typeConstructor)
- isSubArgs(lhs, rhs, params, AnyDepth)
+ // This is a higher-kinded type var with same arity as tp.
+ // If so (see SI-7517), side effect: adds the type constructor itself as a bound.
+ isSubArgs(lhs, rhs, params, AnyDepth) && { addBound(tp.typeConstructor); true }
}
}
// The type with which we can successfully unify can be hidden
diff --git a/test/files/pos/t7517.scala b/test/files/pos/t7517.scala
new file mode 100644
index 0000000000..7ce4c6b13e
--- /dev/null
+++ b/test/files/pos/t7517.scala
@@ -0,0 +1,22 @@
+trait Box[ K[A[x]] ]
+
+object Box {
+ // type constructor composition
+ sealed trait ∙[A[_], B[_]] { type l[T] = A[B[T]] }
+
+ // composes type constructors inside K
+ type SplitBox[K[A[x]], B[x]] = Box[ ({ type l[A[x]] = K[ (A ∙ B)#l] })#l ]
+
+ def split[ K[A[x]], B[x] ](base: Box[K]): SplitBox[K,B] = ???
+
+ class Composed[B[_], L[A[x]] ] {
+ val box: Box[L] = ???
+
+ type Split[ A[x] ] = L[ (A ∙ B)#l ]
+ val a: Box[Split] = Box.split(box)
+
+ //Either of these work:
+ val a1: Box[Split] = Box.split[L,B](box)
+ val a2: Box[ ({ type l[A[x]] = L[ (A ∙ B)#l ] })#l ] = Box.split(box)
+ }
+} \ No newline at end of file