diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 93959f6cb375..93defdd1a4f6 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -5551,15 +5551,12 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper if (sameLength(tparams, args)) { // @M: kind-arity checking is done here and in adapt, full kind-checking is in checkKindBounds (in Infer) val args1 = map2Conserve(args, tparams) { (arg, tparam) => - def ptParams = Kind.FromParams(tparam.typeParams) - // if symbol hasn't been fully loaded, can't check kind-arity except when we're in a pattern, // where we can (we can't take part in F-Bounds) and must (scala/bug#8023) - val pt = if (mode.typingPatternOrTypePat) { - tparam.initialize; ptParams - } - else if (isComplete) ptParams - else Kind.Wildcard + val pt = if (mode.typingPatternOrTypePat || isComplete) + Kind.FromParams(tparam.initialize.typeParams) + else + Kind.Wildcard typedHigherKindedType(arg, mode, pt) } diff --git a/test/files/pos/t12187.scala b/test/files/pos/t12187.scala new file mode 100644 index 000000000000..d89ce1b86c02 --- /dev/null +++ b/test/files/pos/t12187.scala @@ -0,0 +1,8 @@ +object Test { + trait Foo[S[_[_], _[_]]] extends Bar[S] { + def m[F[_]](x: S[({ type G[A] = Bar[S] })#G, F]): Unit + } + trait Bar[S[_[_], _[_]]] { + def m[F[_]](x: S[({ type G[A] = Bar[S] })#G, F]): Unit + } +}