[K/JS] Add ability to use is checks on external objects
This commit is contained in:
@@ -3824,6 +3824,12 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
public void testSimpleIsInterface() throws Exception {
|
||||
runTest("js/js.translator/testData/box/expression/typeCheck/simpleIsInterface.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simpleIsObject.kt")
|
||||
public void testSimpleIsObject() throws Exception {
|
||||
runTest("js/js.translator/testData/box/expression/typeCheck/simpleIsObject.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -4440,6 +4440,12 @@ public class FirJsBoxTestGenerated extends AbstractFirJsBoxTest {
|
||||
public void testSimpleIsInterface() throws Exception {
|
||||
runTest("js/js.translator/testData/box/expression/typeCheck/simpleIsInterface.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simpleIsObject.kt")
|
||||
public void testSimpleIsObject() throws Exception {
|
||||
runTest("js/js.translator/testData/box/expression/typeCheck/simpleIsObject.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -4546,6 +4546,12 @@ public class IrBoxJsES6TestGenerated extends AbstractIrBoxJsES6Test {
|
||||
public void testSimpleIsInterface() throws Exception {
|
||||
runTest("js/js.translator/testData/box/expression/typeCheck/simpleIsInterface.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simpleIsObject.kt")
|
||||
public void testSimpleIsObject() throws Exception {
|
||||
runTest("js/js.translator/testData/box/expression/typeCheck/simpleIsObject.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -4440,6 +4440,12 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
||||
public void testSimpleIsInterface() throws Exception {
|
||||
runTest("js/js.translator/testData/box/expression/typeCheck/simpleIsInterface.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simpleIsObject.kt")
|
||||
public void testSimpleIsObject() throws Exception {
|
||||
runTest("js/js.translator/testData/box/expression/typeCheck/simpleIsObject.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1403
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
package foo
|
||||
|
||||
object RegularKotlinObject
|
||||
|
||||
@JsName("Array")
|
||||
external object JsArray
|
||||
|
||||
@JsName("Math")
|
||||
external object JsMath
|
||||
|
||||
fun box(): String {
|
||||
if (js("[]") !is JsArray) return "fail1"
|
||||
if (js("[]") is JsMath) return "fail2"
|
||||
if (js("[]") is RegularKotlinObject) return "fail3"
|
||||
if (JsMath !is JsMath) return "fail4"
|
||||
if (RegularKotlinObject !is RegularKotlinObject) return "fail5"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user