[IR] Make IrTypeOperatorCall copyable

^KT-45655 fixed
This commit is contained in:
Ilya Goncharov
2021-03-23 19:11:52 +03:00
committed by TeamCityServer
parent 2a5153f0fd
commit 47f1a8a0bb
11 changed files with 71 additions and 2 deletions
@@ -8790,6 +8790,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt");
}
@Test
@TestMetadata("castWithSuspend.kt")
public void testCastWithSuspend() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/castWithSuspend.kt");
}
@Test
@TestMetadata("catchWithInlineInsideSuspend.kt")
public void testCatchWithInlineInsideSuspend() throws Exception {
@@ -81,7 +81,7 @@ class MultipleCatchesLowering(private val context: JsIrBackendContext) : BodyLow
}
val catchBody = catch.result.transform(object : IrElementTransformer<IrValueSymbol> {
override fun visitGetValue(expression: IrGetValue, data: IrValueSymbol) =
override fun visitGetValue(expression: IrGetValue, data: IrValueSymbol): IrExpression =
if (expression.symbol == data)
castedPendingException()
else
@@ -66,7 +66,7 @@ enum class IrTypeOperator {
REINTERPRET_CAST;
}
abstract class IrTypeOperatorCall : IrExpression() {
abstract class IrTypeOperatorCall : IrExpression(), IrExpressionWithCopy {
abstract val operator: IrTypeOperator
abstract var argument: IrExpression
abstract var typeOperand: IrType
@@ -46,4 +46,14 @@ class IrTypeOperatorCallImpl(
override fun <D> transformChildren(transformer: IrElementTransformer<D>, data: D) {
argument = argument.transform(transformer, data)
}
override fun copy(): IrExpression =
IrTypeOperatorCallImpl(
startOffset,
endOffset,
type,
operator,
typeOperand,
argument
)
}
@@ -0,0 +1,21 @@
// KJS_WITH_FULL_RUNTIME
// WITH_RUNTIME
// WITH_COROUTINES
import kotlin.coroutines.intrinsics.*
suspend fun foo() {
DeferredCoroutine<Unit>().await()
}
class DeferredCoroutine<T> {
suspend fun await(): T = awaitInternal() as T
}
internal suspend fun awaitInternal(): Any? = suspendCoroutineUninterceptedOrReturn { uCont ->
}
fun box(): String {
return "OK"
}
@@ -8790,6 +8790,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt");
}
@Test
@TestMetadata("castWithSuspend.kt")
public void testCastWithSuspend() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/castWithSuspend.kt");
}
@Test
@TestMetadata("catchWithInlineInsideSuspend.kt")
public void testCatchWithInlineInsideSuspend() throws Exception {
@@ -8790,6 +8790,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt");
}
@Test
@TestMetadata("castWithSuspend.kt")
public void testCastWithSuspend() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/castWithSuspend.kt");
}
@Test
@TestMetadata("catchWithInlineInsideSuspend.kt")
public void testCatchWithInlineInsideSuspend() throws Exception {
@@ -6854,6 +6854,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt");
}
@TestMetadata("castWithSuspend.kt")
public void testCastWithSuspend() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/castWithSuspend.kt");
}
@TestMetadata("catchWithInlineInsideSuspend.kt")
public void testCatchWithInlineInsideSuspend() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt");
@@ -6118,6 +6118,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
runTest("compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt");
}
@TestMetadata("castWithSuspend.kt")
public void testCastWithSuspend() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/castWithSuspend.kt");
}
@TestMetadata("catchWithInlineInsideSuspend.kt")
public void testCatchWithInlineInsideSuspend() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt");
@@ -5539,6 +5539,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt");
}
@TestMetadata("castWithSuspend.kt")
public void testCastWithSuspend() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/castWithSuspend.kt");
}
@TestMetadata("catchWithInlineInsideSuspend.kt")
public void testCatchWithInlineInsideSuspend() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt");
@@ -5539,6 +5539,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/coroutines/capturedVarInSuspendLambda.kt");
}
@TestMetadata("castWithSuspend.kt")
public void testCastWithSuspend() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/castWithSuspend.kt");
}
@TestMetadata("catchWithInlineInsideSuspend.kt")
public void testCatchWithInlineInsideSuspend() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/catchWithInlineInsideSuspend.kt");