Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
"""
Expand Down
Loading