summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala2
-rw-r--r--test/files/neg/t5152.check9
-rw-r--r--test/files/neg/t5152.scala17
3 files changed, 27 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index ad71f8c21a..ec30e49ae6 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1161,7 +1161,7 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser {
val supertparams = if (supertpt.hasSymbol) supertpt.symbol.typeParams else List()
var supertpe = supertpt.tpe
if (!supertparams.isEmpty)
- supertpe = PolyType(supertparams, appliedType(supertpe, supertparams map (_.tpe)))
+ supertpe = PolyType(supertparams, appliedType(supertpe, supertparams map (_.tpeHK)))
// A method to replace a super reference by a New in a supercall
def transformSuperCall(scall: Tree): Tree = (scall: @unchecked) match {
diff --git a/test/files/neg/t5152.check b/test/files/neg/t5152.check
new file mode 100644
index 0000000000..80e0141b64
--- /dev/null
+++ b/test/files/neg/t5152.check
@@ -0,0 +1,9 @@
+t5152.scala:7: error: kinds of the type arguments (Test.B) do not conform to the expected kinds of the type parameters (type E) in class A.
+Test.B's type parameters do not match type E's expected parameters: type E has one type parameter, but type _ has none
+ class B[E[_]] extends A[B] { } // B is depth 2 but A requires 1
+ ^
+t5152.scala:11: error: kinds of the type arguments (Test.B1) do not conform to the expected kinds of the type parameters (type E) in class A1.
+Test.B1's type parameters do not match type E's expected parameters: type _ has no type parameters, but type G has one
+ class B1[E[_]] extends A1[B1] // B1 is depth 2 but A1 requires 3
+ ^
+two errors found
diff --git a/test/files/neg/t5152.scala b/test/files/neg/t5152.scala
new file mode 100644
index 0000000000..5efc76af24
--- /dev/null
+++ b/test/files/neg/t5152.scala
@@ -0,0 +1,17 @@
+object Test {
+ new C
+ new C1
+ new C2
+
+ class A[E[_]] { }
+ class B[E[_]] extends A[B] { } // B is depth 2 but A requires 1
+ class C extends B { }
+
+ class A1[E[F[G[_]]]] { }
+ class B1[E[_]] extends A1[B1] // B1 is depth 2 but A1 requires 3
+ class C1 extends B1 { }
+
+ class A2[E[_]] { }
+ class B2[E] extends A2[B2] { } // this one is correct
+ class C2 extends B2 { }
+}