KT-6803 Subtyping breaks on star-projections for recursive generics

Star-projections have upper bounds of the form "parameter's bound where all parameter of the same class are substituted with their star-projections"

  #KT-6803 Fixed
This commit is contained in:
Andrey Breslav
2015-03-03 18:26:47 +03:00
parent 11b693c3be
commit e0b7e4efca
15 changed files with 127 additions and 17 deletions
@@ -10901,6 +10901,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("starProjections.kt")
public void testStarProjections() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/substitutions/starProjections.kt");
doTest(fileName);
}
@TestMetadata("upperBoundsSubstitutionForOverloadResolutionWithAmbiguity.kt")
public void testUpperBoundsSubstitutionForOverloadResolutionWithAmbiguity() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithAmbiguity.kt");
@@ -328,6 +328,23 @@ public class JetTypeCheckerTest extends JetLiteFixture {
assertSubtype("Nothing?", "Derived_T<*>?");
}
public void testStars() throws Exception {
assertSubtype("SubStar<*>", "Star<*>");
assertSubtype("SubStar<SubStar<*>>", "Star<*>");
assertSubtype("SubStar<SubStar<*>>", "Star<SubStar<*>>");
assertNotSubtype("SubStar<SubStar<*>>", "Star<Star<*>>");
assertSubtype("Star<Star<*>>", "Star<*>");
assertSubtype("Star<*>", "Star<out Star<*>>");
assertNotSubtype("Star<*>", "Star<Star<*>>");
assertSubtype("SubRec<*>", "Rec<*>");
assertSubtype("SubRec<*>", "Rec<out Any?>");
assertSubtype("Rec<*>", "Rec<out Any?>");
assertNotSubtype("Rec<*>", "Rec<out Any>");
}
public void testThis() throws Exception {
assertType("Derived_T<Int>", "this", "Derived_T<Int>");
// assertType("Derived_T<Int>", "super<Base_T>", "Base_T<Int>");