Support Nothing type in typeOf

The proper support will come in KT-15518, but that would be a breaking
change even for stable Kotlin without kotlin-reflect. Before that issue
is fixed, represent Nothing in types with the Void class, and use a flag
in the no-reflect implementation to remember that it's not actually the
Void class itself.

 #KT-39166 Fixed
This commit is contained in:
Alexander Udalov
2021-07-07 13:04:59 +02:00
parent 02774fae0c
commit ddfa94e7e9
15 changed files with 338 additions and 15 deletions
@@ -37467,6 +37467,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/reflection/typeOf/mutableCollections_before.kt");
}
@Test
@TestMetadata("nothing_after.kt")
public void testNothing_after() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/nothing_after.kt");
}
@Test
@TestMetadata("nothing_before.kt")
public void testNothing_before() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/nothing_before.kt");
}
@Test
@TestMetadata("rawTypes_after.kt")
public void testRawTypes_after() throws Exception {
@@ -37540,6 +37552,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/reflection/typeOf/noReflect/mutableCollections_before.kt");
}
@Test
@TestMetadata("nothing_after.kt")
public void testNothing_after() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/noReflect/nothing_after.kt");
}
@Test
@TestMetadata("nothing_before.kt")
public void testNothing_before() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/noReflect/nothing_before.kt");
}
@Test
@TestMetadata("rawTypes_after.kt")
public void testRawTypes_after() throws Exception {
@@ -37509,6 +37509,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/reflection/typeOf/mutableCollections_before.kt");
}
@Test
@TestMetadata("nothing_after.kt")
public void testNothing_after() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/nothing_after.kt");
}
@Test
@TestMetadata("nothing_before.kt")
public void testNothing_before() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/nothing_before.kt");
}
@Test
@TestMetadata("rawTypes_after.kt")
public void testRawTypes_after() throws Exception {
@@ -37582,6 +37594,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/reflection/typeOf/noReflect/mutableCollections_before.kt");
}
@Test
@TestMetadata("nothing_after.kt")
public void testNothing_after() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/noReflect/nothing_after.kt");
}
@Test
@TestMetadata("nothing_before.kt")
public void testNothing_before() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/noReflect/nothing_before.kt");
}
@Test
@TestMetadata("rawTypes_after.kt")
public void testRawTypes_after() throws Exception {