Reflection: add KClass.{isSubclassOf,isSuperclassOf}, KType.{isSubtypeOf,isSupertypeOf}

The behavior in primitives.kt is likely to be reconsidered

 #KT-8998 Fixed
This commit is contained in:
Alexander Udalov
2016-07-26 18:29:02 +03:00
parent 4cd252d9d5
commit 3702f4a7a7
9 changed files with 308 additions and 0 deletions
@@ -12993,6 +12993,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
@TestMetadata("isSubclassOfIsSuperclassOf.kt")
public void testIsSubclassOfIsSuperclassOf() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/supertypes/isSubclassOfIsSuperclassOf.kt");
doTest(fileName);
}
@TestMetadata("primitives.kt")
public void testPrimitives() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/supertypes/primitives.kt");
doTest(fileName);
}
@TestMetadata("simpleSupertypes.kt")
public void testSimpleSupertypes() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/supertypes/simpleSupertypes.kt");
@@ -13139,6 +13151,39 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
}
@TestMetadata("compiler/testData/codegen/box/reflection/types/subtyping")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Subtyping extends AbstractBlackBoxCodegenTest {
public void testAllFilesPresentInSubtyping() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/reflection/types/subtyping"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("platformType.kt")
public void testPlatformType() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/types/subtyping/platformType.kt");
doTest(fileName);
}
@TestMetadata("simpleGenericTypes.kt")
public void testSimpleGenericTypes() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/types/subtyping/simpleGenericTypes.kt");
doTest(fileName);
}
@TestMetadata("simpleSubtypeSupertype.kt")
public void testSimpleSubtypeSupertype() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/types/subtyping/simpleSubtypeSupertype.kt");
doTest(fileName);
}
@TestMetadata("typeProjection.kt")
public void testTypeProjection() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/types/subtyping/typeProjection.kt");
doTest(fileName);
}
}
}
}