JS IR: fix type checks for suspend function descendants (^KT-54382 fixed)

Consider `class A : suspend () -> Unit {}`. Type checks such as `is A`
are now performed via a regular `instanceof` check instead of the special
checks for suspend lambdas.
This commit is contained in:
Anton Bannykh
2022-10-12 11:52:34 +02:00
committed by Space Team
parent bc13173ea9
commit 9342356c38
7 changed files with 204 additions and 1 deletions
@@ -796,6 +796,12 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
runTest("js/js.translator/testData/box/coroutines/debugStatement.kt");
}
@Test
@TestMetadata("kt54382.kt")
public void testKt54382() throws Exception {
runTest("js/js.translator/testData/box/coroutines/kt54382.kt");
}
@Test
@TestMetadata("lambdaWithValueClass.kt")
public void testLambdaWithValueClass() throws Exception {
@@ -819,6 +825,18 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
public void testOnlyInlineSuspendFunction() throws Exception {
runTest("js/js.translator/testData/box/coroutines/onlyInlineSuspendFunction.kt");
}
@Test
@TestMetadata("suspendFunctionAsSupertypeIsCheck.kt")
public void testSuspendFunctionAsSupertypeIsCheck() throws Exception {
runTest("js/js.translator/testData/box/coroutines/suspendFunctionAsSupertypeIsCheck.kt");
}
@Test
@TestMetadata("suspendFunctionIsAs.kt")
public void testSuspendFunctionIsAs() throws Exception {
runTest("js/js.translator/testData/box/coroutines/suspendFunctionIsAs.kt");
}
}
@Nested
@@ -860,6 +860,12 @@ public class FirJsTestGenerated extends AbstractFirJsTest {
runTest("js/js.translator/testData/box/coroutines/debugStatement.kt");
}
@Test
@TestMetadata("kt54382.kt")
public void testKt54382() throws Exception {
runTest("js/js.translator/testData/box/coroutines/kt54382.kt");
}
@Test
@TestMetadata("lambdaWithValueClass.kt")
public void testLambdaWithValueClass() throws Exception {
@@ -883,6 +889,18 @@ public class FirJsTestGenerated extends AbstractFirJsTest {
public void testOnlyInlineSuspendFunction() throws Exception {
runTest("js/js.translator/testData/box/coroutines/onlyInlineSuspendFunction.kt");
}
@Test
@TestMetadata("suspendFunctionAsSupertypeIsCheck.kt")
public void testSuspendFunctionAsSupertypeIsCheck() throws Exception {
runTest("js/js.translator/testData/box/coroutines/suspendFunctionAsSupertypeIsCheck.kt");
}
@Test
@TestMetadata("suspendFunctionIsAs.kt")
public void testSuspendFunctionIsAs() throws Exception {
runTest("js/js.translator/testData/box/coroutines/suspendFunctionIsAs.kt");
}
}
@Nested
@@ -860,6 +860,12 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
runTest("js/js.translator/testData/box/coroutines/debugStatement.kt");
}
@Test
@TestMetadata("kt54382.kt")
public void testKt54382() throws Exception {
runTest("js/js.translator/testData/box/coroutines/kt54382.kt");
}
@Test
@TestMetadata("lambdaWithValueClass.kt")
public void testLambdaWithValueClass() throws Exception {
@@ -883,6 +889,18 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
public void testOnlyInlineSuspendFunction() throws Exception {
runTest("js/js.translator/testData/box/coroutines/onlyInlineSuspendFunction.kt");
}
@Test
@TestMetadata("suspendFunctionAsSupertypeIsCheck.kt")
public void testSuspendFunctionAsSupertypeIsCheck() throws Exception {
runTest("js/js.translator/testData/box/coroutines/suspendFunctionAsSupertypeIsCheck.kt");
}
@Test
@TestMetadata("suspendFunctionIsAs.kt")
public void testSuspendFunctionIsAs() throws Exception {
runTest("js/js.translator/testData/box/coroutines/suspendFunctionIsAs.kt");
}
}
@Nested