Minor, add test on typeOf with intersection type
This commit is contained in:
+6
@@ -37485,6 +37485,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/reflection/typeOf/inlineClasses.kt");
|
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
|
@Test
|
||||||
@TestMetadata("manyTypeArguments.kt")
|
@TestMetadata("manyTypeArguments.kt")
|
||||||
public void testManyTypeArguments() throws Exception {
|
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"
|
||||||
|
}
|
||||||
+6
@@ -37443,6 +37443,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/reflection/typeOf/inlineClasses.kt");
|
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
|
@Test
|
||||||
@TestMetadata("manyTypeArguments.kt")
|
@TestMetadata("manyTypeArguments.kt")
|
||||||
public void testManyTypeArguments() throws Exception {
|
public void testManyTypeArguments() throws Exception {
|
||||||
|
|||||||
+6
@@ -37485,6 +37485,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/reflection/typeOf/inlineClasses.kt");
|
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
|
@Test
|
||||||
@TestMetadata("manyTypeArguments.kt")
|
@TestMetadata("manyTypeArguments.kt")
|
||||||
public void testManyTypeArguments() throws Exception {
|
public void testManyTypeArguments() throws Exception {
|
||||||
|
|||||||
+5
@@ -29810,6 +29810,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/reflection/typeOf/inlineClasses.kt");
|
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")
|
@TestMetadata("manyTypeArguments.kt")
|
||||||
public void testManyTypeArguments() throws Exception {
|
public void testManyTypeArguments() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/reflection/typeOf/manyTypeArguments.kt");
|
runTest("compiler/testData/codegen/box/reflection/typeOf/manyTypeArguments.kt");
|
||||||
|
|||||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -25490,6 +25490,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
|||||||
runTest("compiler/testData/codegen/box/reflection/typeOf/inlineClasses.kt");
|
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")
|
@TestMetadata("manyTypeArguments.kt")
|
||||||
public void testManyTypeArguments() throws Exception {
|
public void testManyTypeArguments() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/reflection/typeOf/manyTypeArguments.kt");
|
runTest("compiler/testData/codegen/box/reflection/typeOf/manyTypeArguments.kt");
|
||||||
|
|||||||
Generated
+5
@@ -24896,6 +24896,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/reflection/typeOf/inlineClasses.kt");
|
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")
|
@TestMetadata("manyTypeArguments.kt")
|
||||||
public void testManyTypeArguments() throws Exception {
|
public void testManyTypeArguments() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/reflection/typeOf/manyTypeArguments.kt");
|
runTest("compiler/testData/codegen/box/reflection/typeOf/manyTypeArguments.kt");
|
||||||
|
|||||||
Generated
+5
@@ -24856,6 +24856,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/reflection/typeOf/inlineClasses.kt");
|
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")
|
@TestMetadata("manyTypeArguments.kt")
|
||||||
public void testManyTypeArguments() throws Exception {
|
public void testManyTypeArguments() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/reflection/typeOf/manyTypeArguments.kt");
|
runTest("compiler/testData/codegen/box/reflection/typeOf/manyTypeArguments.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user