diff --git a/scala/scala-impl/src/org/jetbrains/plugins/scala/annotator/element/ScParameterizedTypeElementAnnotator.scala b/scala/scala-impl/src/org/jetbrains/plugins/scala/annotator/element/ScParameterizedTypeElementAnnotator.scala index 9f3a0439595..cfe0c57cb46 100644 --- a/scala/scala-impl/src/org/jetbrains/plugins/scala/annotator/element/ScParameterizedTypeElementAnnotator.scala +++ b/scala/scala-impl/src/org/jetbrains/plugins/scala/annotator/element/ScParameterizedTypeElementAnnotator.scala @@ -139,11 +139,10 @@ object ScParameterizedTypeElementAnnotator extends ElementAnnotator[ScParameteri (arg, param) <- args.zip(params) argTy <- getType(arg).toOption range = if (isForContextBound) annotationRange else arg.getTextRange - if !argTy.is[ScExistentialArgument, ScExistentialType] && - !argIsDesignatedToTypeVariable(arg) && + if !argIsDesignatedToTypeVariable(arg) && !KindProjectorUtil.syntaxIdsFor(arg).contains(arg.getText) } { - checkBounds(range, argTy, param, substitute) + if(!argTy.is[ScExistentialArgument, ScExistentialType]) checkBounds(range, argTy, param, substitute) checkHigherKindedType(range, argTy, param, substitute) } } diff --git a/scala/scala-impl/test/org/jetbrains/plugins/scala/annotator/ScGenericCallAnnotatorTest.scala b/scala/scala-impl/test/org/jetbrains/plugins/scala/annotator/ScGenericCallAnnotatorTest.scala index 2d26318d281..6d5f7b7dccb 100644 --- a/scala/scala-impl/test/org/jetbrains/plugins/scala/annotator/ScGenericCallAnnotatorTest.scala +++ b/scala/scala-impl/test/org/jetbrains/plugins/scala/annotator/ScGenericCallAnnotatorTest.scala @@ -60,6 +60,10 @@ class ScGenericCallAnnotatorTest extends SimpleTestCase { assertMessages(messages("testHk[HkArg]"))( Error("HkArg", "Type constructor HkArg does not conform to CC[X >: B <: B, _]") ) + + assertMessages(messages("class Test[X, Y]; testHk[Test[_, _]]"))( + Error("Test[_, _]", "Expected type constructor CC[X >: B <: B, _]") + ) } def testTypeConstructorParameter(): Unit = { diff --git a/scala/scala-impl/test/org/jetbrains/plugins/scala/annotator/ScParameterizedTypeElementAnnotatorTest.scala b/scala/scala-impl/test/org/jetbrains/plugins/scala/annotator/ScParameterizedTypeElementAnnotatorTest.scala index 9263867f187..614262c3b00 100644 --- a/scala/scala-impl/test/org/jetbrains/plugins/scala/annotator/ScParameterizedTypeElementAnnotatorTest.scala +++ b/scala/scala-impl/test/org/jetbrains/plugins/scala/annotator/ScParameterizedTypeElementAnnotatorTest.scala @@ -227,6 +227,19 @@ class ScParameterizedTypeElementAnnotatorTest_scala_2 extends ScParameterizedTyp )) } + def testExistentialTypeKindMismatch(): Unit = { + assertMessages(messages( + """ + |class Option[A] + |class TestClass[F[_]] + | + |def test: TestClass[Option[_]] = ??? + |""".stripMargin + ))( + Error("Option[_]", "Expected type constructor F[_]") + ) + } + def testUnresolved(): Unit = { assertNothing(messages( """