Minor, add test on typeOf with intersection type

This commit is contained in:
Alexander Udalov
2021-07-08 22:58:54 +02:00
parent a7e48c3af1
commit d43ed1cf75
8 changed files with 61 additions and 0 deletions
@@ -37485,6 +37485,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/reflection/typeOf/inlineClasses.kt");
}
@Test
@TestMetadata("intersectionType.kt")
public void testIntersectionType() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/intersectionType.kt");
}
@Test
@TestMetadata("manyTypeArguments.kt")
public void testManyTypeArguments() throws Exception {
@@ -0,0 +1,23 @@
// !USE_EXPERIMENTAL: kotlin.ExperimentalStdlibApi
// IGNORE_BACKEND: JS
// WITH_REFLECT
// KJS_WITH_FULL_RUNTIME
import kotlin.reflect.typeOf
class Inv<T>(val v: T)
interface X
interface Y
object A : X, Y
object B : X, Y
fun <T> sel(a: T, b: T) = a
inline fun <reified T> T.valueTypeOf() = typeOf<T>()
fun box(): String {
val t = sel(Inv(A), Inv(B)).v.valueTypeOf()
return if (t == typeOf<Any>()) "OK" else "Fail: $t"
}
@@ -37443,6 +37443,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/reflection/typeOf/inlineClasses.kt");
}
@Test
@TestMetadata("intersectionType.kt")
public void testIntersectionType() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/intersectionType.kt");
}
@Test
@TestMetadata("manyTypeArguments.kt")
public void testManyTypeArguments() throws Exception {
@@ -37485,6 +37485,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/reflection/typeOf/inlineClasses.kt");
}
@Test
@TestMetadata("intersectionType.kt")
public void testIntersectionType() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/intersectionType.kt");
}
@Test
@TestMetadata("manyTypeArguments.kt")
public void testManyTypeArguments() throws Exception {
@@ -29810,6 +29810,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/reflection/typeOf/inlineClasses.kt");
}
@TestMetadata("intersectionType.kt")
public void testIntersectionType() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/intersectionType.kt");
}
@TestMetadata("manyTypeArguments.kt")
public void testManyTypeArguments() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/manyTypeArguments.kt");
@@ -25490,6 +25490,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
runTest("compiler/testData/codegen/box/reflection/typeOf/inlineClasses.kt");
}
@TestMetadata("intersectionType.kt")
public void testIntersectionType() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/intersectionType.kt");
}
@TestMetadata("manyTypeArguments.kt")
public void testManyTypeArguments() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/manyTypeArguments.kt");
@@ -24896,6 +24896,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/reflection/typeOf/inlineClasses.kt");
}
@TestMetadata("intersectionType.kt")
public void testIntersectionType() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/intersectionType.kt");
}
@TestMetadata("manyTypeArguments.kt")
public void testManyTypeArguments() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/manyTypeArguments.kt");
@@ -24856,6 +24856,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/reflection/typeOf/inlineClasses.kt");
}
@TestMetadata("intersectionType.kt")
public void testIntersectionType() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/intersectionType.kt");
}
@TestMetadata("manyTypeArguments.kt")
public void testManyTypeArguments() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/manyTypeArguments.kt");