Star projection information preserved in substitutions

#KT-6700 Fixed
This commit is contained in:
Andrey Breslav
2015-01-30 19:53:04 +03:00
parent da639039bd
commit fecf6f9fdf
38 changed files with 412 additions and 216 deletions
@@ -4525,7 +4525,7 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
@TestMetadata("compiler/testData/diagnostics/tests/generics")
@TestDataPath("$PROJECT_ROOT")
@InnerTestClasses({Generics.TpAsReified.class, Generics.VarProjection.class})
@InnerTestClasses({Generics.StarProjections.class, Generics.TpAsReified.class, Generics.VarProjection.class})
@RunWith(JUnit3RunnerWithInners.class)
public static class Generics extends AbstractJetDiagnosticsTest {
public void testAllFilesPresentInGenerics() throws Exception {
@@ -4610,6 +4610,33 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("compiler/testData/diagnostics/tests/generics/starProjections")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class StarProjections extends AbstractJetDiagnosticsTest {
public void testAllFilesPresentInStarProjections() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/generics/starProjections"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("collectionInheritedFromJava.kt")
public void testCollectionInheritedFromJava() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/starProjections/collectionInheritedFromJava.kt");
doTest(fileName);
}
@TestMetadata("inheritedFromJava.kt")
public void testInheritedFromJava() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/starProjections/inheritedFromJava.kt");
doTest(fileName);
}
@TestMetadata("inheritedFromKotlin.kt")
public void testInheritedFromKotlin() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/starProjections/inheritedFromKotlin.kt");
doTest(fileName);
}
}
@TestMetadata("compiler/testData/diagnostics/tests/generics/tpAsReified")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -81,7 +81,10 @@ abstract class AbstractJetTypeBindingTest : JetLiteFixture() {
""
}
println("typeProjection: ${projection}${argument.typeProjection.getType().render()}")
print("typeProjection: ")
if (argument.typeProjection.isStarProjection())
printlnWithNoIndent("*")
else printlnWithNoIndent("${projection}${argument.typeProjection.getType().render()}")
print(argument.typeBinding)
return this
}
@@ -258,7 +258,7 @@ public class TypeSubstitutorTest extends KotlinTestWithEnvironment {
public void testInOutProjectionDeclarationSite() throws Exception {
doTest(
"In<out Any?>",
"In<*>",
"In<T>",
map("T", "out String")
);
@@ -266,7 +266,7 @@ public class TypeSubstitutorTest extends KotlinTestWithEnvironment {
public void testOutInProjectionDeclarationSite() throws Exception {
doTest(
"Out<Any?>",
"Out<*>",
"Out<T>",
map("T", "in String")
);
@@ -387,4 +387,20 @@ public class TypeSubstitutorTest extends KotlinTestWithEnvironment {
// );
//}
public void testStarProjection() throws Exception {
doTest(
"Rec<*>",
"Rec<*>",
map("T", "String")
);
}
public void testStarProjectionOut() throws Exception {
doTest(
"Out<*>",
"Out<*>",
map("T", "String")
);
}
}