Fix crash with HK types.

Another page in the storied history of "call .tpe when one should have
called .tpeHK", in this case leading to a crash of stacktraciness.
Closes SI-5152, review by moors.

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@25953 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
extempore 2011-11-07 08:54:57 +00:00
parent 6202225a57
commit 728adbecc9
3 changed files with 27 additions and 1 deletions

View File

@ -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 {

View File

@ -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

View File

@ -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 { }
}