From 57a2665b0056793d07b855c66671e81ccb03bcb6 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Fri, 2 Aug 2019 14:40:25 +0300 Subject: [PATCH] [FIR] Update tests for previous commit --- .../recursiveCallOnWhenWithSealedClass.txt | 2 +- .../resolve/testData/resolve/tryInference.kt | 17 +++++++ .../resolve/testData/resolve/tryInference.txt | 20 ++++++++ .../resolve/testData/resolve/whenInference.kt | 9 ++++ .../testData/resolve/whenInference.txt | 19 ++++++++ .../fir/FirResolveTestCaseGenerated.java | 10 ++++ .../breakContinueInLoopHeader.fir.txt | 16 ++++--- .../ir/irText/expressions/elvis.fir.txt | 8 ++-- .../floatingPointCompareTo.fir.txt | 16 +++---- .../whenByFloatingPoint.fir.txt | 14 +++--- .../expressions/implicitCastToNonNull.fir.txt | 4 +- .../implicitCastToTypeParameter.fir.txt | 4 +- .../ir/irText/expressions/kt24804.fir.txt | 12 +++-- .../ir/irText/expressions/kt30796.fir.txt | 48 +++++++++---------- .../sam/samConversionsWithSmartCasts.fir.txt | 12 ++--- .../expressions/useImportedMember.fir.txt | 36 +++++++------- .../ir/irText/expressions/when.fir.txt | 18 +++---- .../expressions/whenCoercedToUnit.fir.txt | 8 ++-- .../expressions/whenUnusedExpression.fir.txt | 10 ++-- .../ir/irText/lambdas/nonLocalReturn.fir.txt | 4 +- .../ir/irText/regressions/kt24114.fir.txt | 8 ++-- 21 files changed, 187 insertions(+), 108 deletions(-) create mode 100644 compiler/fir/resolve/testData/resolve/tryInference.kt create mode 100644 compiler/fir/resolve/testData/resolve/tryInference.txt create mode 100644 compiler/fir/resolve/testData/resolve/whenInference.kt create mode 100644 compiler/fir/resolve/testData/resolve/whenInference.txt diff --git a/compiler/fir/resolve/testData/resolve/recursiveCallOnWhenWithSealedClass.txt b/compiler/fir/resolve/testData/resolve/recursiveCallOnWhenWithSealedClass.txt index cf6d21937da..534ebc2c1c7 100644 --- a/compiler/fir/resolve/testData/resolve/recursiveCallOnWhenWithSealedClass.txt +++ b/compiler/fir/resolve/testData/resolve/recursiveCallOnWhenWithSealedClass.txt @@ -27,7 +27,7 @@ FILE: recursiveCallOnWhenWithSealedClass.kt } - public final fun unwrap(): R|class error: Unresolved name: meat| { + public final fun unwrap(): { ^unwrap when (this#) { ($subj$ is R|Maybe.Nope|) -> { throw R|java/lang/Exception.Exception|(String()) diff --git a/compiler/fir/resolve/testData/resolve/tryInference.kt b/compiler/fir/resolve/testData/resolve/tryInference.kt new file mode 100644 index 00000000000..e6d14b02757 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/tryInference.kt @@ -0,0 +1,17 @@ +fun materialize(): T = throw Exception() + +interface A + +fun takeA(a: A) {} + +fun test() { + takeA( + try { + materialize() + } catch (e: Exception) { + materialize() + } finally { + materialize() // Should be an errror + } + ) +} \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/tryInference.txt b/compiler/fir/resolve/testData/resolve/tryInference.txt new file mode 100644 index 00000000000..f4c75ea4d63 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/tryInference.txt @@ -0,0 +1,20 @@ +FILE: tryInference.kt + public final fun materialize(): R|T| { + ^materialize throw R|java/lang/Exception.Exception|() + } + public abstract interface A : R|kotlin/Any| { + } + public final fun takeA(a: R|A|): R|kotlin/Unit| { + } + public final fun test(): R|kotlin/Unit| { + R|/takeA|(try { + R|/materialize|() + } + catch (e: R|java/lang/Exception|) { + R|/materialize|() + } + finally { + R|/materialize|() + } + ) + } diff --git a/compiler/fir/resolve/testData/resolve/whenInference.kt b/compiler/fir/resolve/testData/resolve/whenInference.kt new file mode 100644 index 00000000000..5cf6db722d0 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/whenInference.kt @@ -0,0 +1,9 @@ +fun materialize(): T = throw Exception() + +interface A + +fun takeA(a: A) {} + +fun test() { + takeA(if(true) materialize() else materialize()) +} \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/whenInference.txt b/compiler/fir/resolve/testData/resolve/whenInference.txt new file mode 100644 index 00000000000..db614ef3714 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/whenInference.txt @@ -0,0 +1,19 @@ +FILE: whenInference.kt + public final fun materialize(): R|T| { + ^materialize throw R|java/lang/Exception.Exception|() + } + public abstract interface A : R|kotlin/Any| { + } + public final fun takeA(a: R|A|): R|kotlin/Unit| { + } + public final fun test(): R|kotlin/Unit| { + R|/takeA|(when () { + Boolean(true) -> { + R|/materialize|() + } + else -> { + R|/materialize|() + } + } + ) + } diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseGenerated.java b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseGenerated.java index 67c3f787af6..4b0a61ddbff 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseGenerated.java @@ -139,6 +139,11 @@ public class FirResolveTestCaseGenerated extends AbstractFirResolveTestCase { runTest("compiler/fir/resolve/testData/resolve/treeSet.kt"); } + @TestMetadata("tryInference.kt") + public void testTryInference() throws Exception { + runTest("compiler/fir/resolve/testData/resolve/tryInference.kt"); + } + @TestMetadata("TwoDeclarationsInSameFile.kt") public void testTwoDeclarationsInSameFile() throws Exception { runTest("compiler/fir/resolve/testData/resolve/TwoDeclarationsInSameFile.kt"); @@ -169,6 +174,11 @@ public class FirResolveTestCaseGenerated extends AbstractFirResolveTestCase { runTest("compiler/fir/resolve/testData/resolve/typeParameterVsNested.kt"); } + @TestMetadata("whenInference.kt") + public void testWhenInference() throws Exception { + runTest("compiler/fir/resolve/testData/resolve/whenInference.kt"); + } + @TestMetadata("compiler/fir/resolve/testData/resolve/arguments") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt index 58daef209f7..128af64c846 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt @@ -6,10 +6,10 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt condition: CONST Boolean type=kotlin.Boolean value=true body: BLOCK type=kotlin.Unit origin=null WHILE label=L2 origin=WHILE_LOOP - condition: BLOCK type=kotlin.Unit origin=ELVIS + condition: BLOCK type=kotlin.Boolean origin=ELVIS VAR name: type:kotlin.Boolean? [val] GET_VAR 'c: kotlin.Boolean? declared in .test1' type=kotlin.Boolean? origin=null - WHEN type=kotlin.Unit origin=ELVIS + WHEN type=kotlin.Boolean origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val : kotlin.Boolean? [val] declared in .test1' type=kotlin.Boolean? origin=null @@ -26,10 +26,10 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt condition: CONST Boolean type=kotlin.Boolean value=true body: BLOCK type=kotlin.Unit origin=null WHILE label=L2 origin=WHILE_LOOP - condition: BLOCK type=kotlin.Unit origin=ELVIS + condition: BLOCK type=kotlin.Boolean origin=ELVIS VAR name: type:kotlin.Boolean? [val] GET_VAR 'c: kotlin.Boolean? declared in .test2' type=kotlin.Boolean? origin=null - WHEN type=kotlin.Unit origin=ELVIS + WHEN type=kotlin.Boolean origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val : kotlin.Boolean? [val] declared in .test2' type=kotlin.Boolean? origin=null @@ -120,9 +120,11 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null $this: GET_VAR 'val : kotlin.Int [val] declared in .test5' type=kotlin.Int origin=null GET_VAR 'var j: kotlin.Int [var] declared in .test5' type=kotlin.Int origin=null - condition: WHEN type=kotlin.Unit origin=IF + condition: WHEN type=kotlin.Boolean origin=IF BRANCH - if: ERROR_CALL 'Comparison of arguments with different types: kotlin/Int, kotlin/Unit' type=kotlin.Boolean + if: CALL 'public final fun greaterOrEqual (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GTEQ + arg0: GET_VAR 'var j: kotlin.Int [var] declared in .test5' type=kotlin.Int origin=null + arg1: CONST Int type=kotlin.Int value=3 then: CONST Boolean type=kotlin.Boolean value=false BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -131,5 +133,5 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'var i: kotlin.Int [var] declared in .test5' type=kotlin.Int origin=null - arg1: CONST Int type=kotlin.Unit value=3 + arg1: CONST Int type=kotlin.Int value=3 then: BREAK label=null loop.label=Outer diff --git a/compiler/testData/ir/irText/expressions/elvis.fir.txt b/compiler/testData/ir/irText/expressions/elvis.fir.txt index bf2da553f24..b30d60b14f1 100644 --- a/compiler/testData/ir/irText/expressions/elvis.fir.txt +++ b/compiler/testData/ir/irText/expressions/elvis.fir.txt @@ -50,23 +50,23 @@ FILE fqName: fileName:/elvis.kt VALUE_PARAMETER name:a index:0 type:kotlin.Any? VALUE_PARAMETER name:b index:1 type:kotlin.Any? BLOCK_BODY - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Unit origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.String GET_VAR 'b: kotlin.Any? declared in .test3' type=kotlin.Any? origin=null then: RETURN type=kotlin.Nothing from='public final fun test3 (a: kotlin.Any?, b: kotlin.Any?): kotlin.String declared in ' CONST String type=kotlin.String value="" - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Unit origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.String? GET_VAR 'a: kotlin.Any? declared in .test3' type=kotlin.Any? origin=null then: RETURN type=kotlin.Nothing from='public final fun test3 (a: kotlin.Any?, b: kotlin.Any?): kotlin.String declared in ' CONST String type=kotlin.String value="" RETURN type=kotlin.Nothing from='public final fun test3 (a: kotlin.Any?, b: kotlin.Any?): kotlin.String declared in ' - BLOCK type=kotlin.String origin=ELVIS + BLOCK type=kotlin.Any? origin=ELVIS VAR name: type:kotlin.Any? [val] GET_VAR 'a: kotlin.Any? declared in .test3' type=kotlin.Any? origin=null - WHEN type=kotlin.String origin=ELVIS + WHEN type=kotlin.Any? origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val : kotlin.Any? [val] declared in .test3' type=kotlin.Any? origin=null diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointCompareTo.fir.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointCompareTo.fir.txt index 0d00616998d..481d9ee311d 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointCompareTo.fir.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointCompareTo.fir.txt @@ -19,7 +19,7 @@ FILE fqName: fileName:/floatingPointCompareTo.kt then: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: ERROR_CALL 'Unresolved reference: #' type=IrErrorType GET_VAR 'y: kotlin.Any declared in .test2d' type=kotlin.Any origin=null - arg1: CONST Int type=kotlin.Boolean value=0 + arg1: CONST Int type=kotlin.Int value=0 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Boolean type=kotlin.Boolean value=false @@ -42,7 +42,7 @@ FILE fqName: fileName:/floatingPointCompareTo.kt then: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: ERROR_CALL 'Unresolved reference: #' type=IrErrorType GET_VAR 'y: kotlin.Any declared in .test3d' type=kotlin.Any origin=null - arg1: CONST Int type=kotlin.Boolean value=0 + arg1: CONST Int type=kotlin.Int value=0 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Boolean type=kotlin.Boolean value=false @@ -66,7 +66,7 @@ FILE fqName: fileName:/floatingPointCompareTo.kt then: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: ERROR_CALL 'Unresolved reference: #' type=IrErrorType GET_VAR 'y: kotlin.Any declared in .test2f' type=kotlin.Any origin=null - arg1: CONST Int type=kotlin.Boolean value=0 + arg1: CONST Int type=kotlin.Int value=0 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Boolean type=kotlin.Boolean value=false @@ -89,7 +89,7 @@ FILE fqName: fileName:/floatingPointCompareTo.kt then: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: ERROR_CALL 'Unresolved reference: #' type=IrErrorType GET_VAR 'y: kotlin.Any declared in .test3f' type=kotlin.Any origin=null - arg1: CONST Int type=kotlin.Boolean value=0 + arg1: CONST Int type=kotlin.Int value=0 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Boolean type=kotlin.Boolean value=false @@ -112,7 +112,7 @@ FILE fqName: fileName:/floatingPointCompareTo.kt then: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: ERROR_CALL 'Unresolved reference: #' type=IrErrorType GET_VAR 'y: kotlin.Any declared in .testFD' type=kotlin.Any origin=null - arg1: CONST Int type=kotlin.Boolean value=0 + arg1: CONST Int type=kotlin.Int value=0 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Boolean type=kotlin.Boolean value=false @@ -135,7 +135,7 @@ FILE fqName: fileName:/floatingPointCompareTo.kt then: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: ERROR_CALL 'Unresolved reference: #' type=IrErrorType GET_VAR 'y: kotlin.Any declared in .testDF' type=kotlin.Any origin=null - arg1: CONST Int type=kotlin.Boolean value=0 + arg1: CONST Int type=kotlin.Int value=0 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Boolean type=kotlin.Boolean value=false @@ -158,7 +158,7 @@ FILE fqName: fileName:/floatingPointCompareTo.kt then: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: ERROR_CALL 'Unresolved reference: #' type=IrErrorType GET_VAR 'x: kotlin.Any declared in .test2fr' type=kotlin.Any origin=null - arg1: CONST Int type=kotlin.Boolean value=0 + arg1: CONST Int type=kotlin.Int value=0 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Boolean type=kotlin.Boolean value=false @@ -174,7 +174,7 @@ FILE fqName: fileName:/floatingPointCompareTo.kt then: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: ERROR_CALL 'Unresolved reference: #' type=IrErrorType GET_VAR 'x: kotlin.Any declared in .test3fr' type=kotlin.Any origin=null - arg1: CONST Int type=kotlin.Boolean value=0 + arg1: CONST Int type=kotlin.Int value=0 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Boolean type=kotlin.Boolean value=false diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.txt index a214ae1b0f9..bcdac9ce9bc 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.txt @@ -9,7 +9,7 @@ FILE fqName: fileName:/whenByFloatingPoint.kt BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp0_subject: kotlin.Double [val] declared in .testSimple' type=kotlin.Double origin=null - arg1: CONST Double type=kotlin.Int value=0.0 + arg1: CONST Double type=kotlin.Double value=0.0 then: CONST Int type=kotlin.Int value=0 BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -17,7 +17,7 @@ FILE fqName: fileName:/whenByFloatingPoint.kt FUN name:testSmartCastInWhenSubject visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.Int VALUE_PARAMETER name:x index:0 type:kotlin.Any BLOCK_BODY - WHEN type=kotlin.Int origin=IF + WHEN type=kotlin.Unit origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Double GET_VAR 'x: kotlin.Any declared in .testSmartCastInWhenSubject' type=kotlin.Any origin=null @@ -31,7 +31,7 @@ FILE fqName: fileName:/whenByFloatingPoint.kt BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp1_subject: kotlin.Any [val] declared in .testSmartCastInWhenSubject' type=kotlin.Any origin=null - arg1: CONST Double type=kotlin.Int value=0.0 + arg1: CONST Double type=kotlin.Double value=0.0 then: CONST Int type=kotlin.Int value=0 BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -40,7 +40,7 @@ FILE fqName: fileName:/whenByFloatingPoint.kt VALUE_PARAMETER name:x index:0 type:kotlin.Double VALUE_PARAMETER name:y index:1 type:kotlin.Any BLOCK_BODY - WHEN type=kotlin.Int origin=IF + WHEN type=kotlin.Unit origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Double GET_VAR 'y: kotlin.Any declared in .testSmartCastInWhenCondition' type=kotlin.Any origin=null @@ -74,7 +74,7 @@ FILE fqName: fileName:/whenByFloatingPoint.kt BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp3_subject: kotlin.Any [val] declared in .testSmartCastInWhenConditionInBranch' type=kotlin.Any origin=null - arg1: CONST Double type=kotlin.Int value=0.0 + arg1: CONST Double type=kotlin.Double value=0.0 then: CONST Int type=kotlin.Int value=0 BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -83,14 +83,14 @@ FILE fqName: fileName:/whenByFloatingPoint.kt VALUE_PARAMETER name:x index:0 type:kotlin.Any VALUE_PARAMETER name:y index:1 type:kotlin.Any BLOCK_BODY - WHEN type=kotlin.Int origin=IF + WHEN type=kotlin.Unit origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Double GET_VAR 'x: kotlin.Any declared in .testSmartCastToDifferentTypes' type=kotlin.Any origin=null then: RETURN type=kotlin.Nothing from='public final fun testSmartCastToDifferentTypes (x: kotlin.Any, y: kotlin.Any): kotlin.Int declared in ' CALL 'public final fun unaryMinus (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null $this: CONST Int type=kotlin.Int value=1 - WHEN type=kotlin.Int origin=IF + WHEN type=kotlin.Unit origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Float GET_VAR 'y: kotlin.Any declared in .testSmartCastToDifferentTypes' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/implicitCastToNonNull.fir.txt b/compiler/testData/ir/irText/expressions/implicitCastToNonNull.fir.txt index 325743097e8..6c255cd75f7 100644 --- a/compiler/testData/ir/irText/expressions/implicitCastToNonNull.fir.txt +++ b/compiler/testData/ir/irText/expressions/implicitCastToNonNull.fir.txt @@ -35,7 +35,7 @@ FILE fqName: fileName:/implicitCastToNonNull.kt BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=T of .test3 GET_VAR 'x: kotlin.Any declared in .test3' type=kotlin.Any origin=null - then: CONST Int type=IrErrorType value=0 + then: CONST Int type=kotlin.Int value=0 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: ERROR_CALL 'Unresolved reference: #' type=IrErrorType @@ -48,7 +48,7 @@ FILE fqName: fileName:/implicitCastToNonNull.kt BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=T of .test4 GET_VAR 'x: kotlin.Any? declared in .test4' type=kotlin.Any? origin=null - then: CONST Int type=IrErrorType value=0 + then: CONST Int type=kotlin.Int value=0 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: ERROR_CALL 'Unresolved reference: #' type=IrErrorType diff --git a/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.fir.txt b/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.fir.txt index 1278d79cced..85189d22e39 100644 --- a/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.fir.txt +++ b/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.fir.txt @@ -4,7 +4,7 @@ FILE fqName: fileName:/implicitCastToTypeParameter.kt $receiver: VALUE_PARAMETER name: type:kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun test1 (): T of .test1? [inline] declared in ' - WHEN type=T of .test1? origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=T of .test1 ERROR_CALL 'Unresolved reference: this#' type=kotlin.Any @@ -33,7 +33,7 @@ FILE fqName: fileName:/implicitCastToTypeParameter.kt correspondingProperty: PROPERTY name:asT visibility:public modality:FINAL [val] BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun (): T of ? declared in ' - WHEN type=T of ? origin=IF + WHEN type=IrErrorType origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=T of ERROR_CALL 'Unresolved reference: this#' type=IrErrorType diff --git a/compiler/testData/ir/irText/expressions/kt24804.fir.txt b/compiler/testData/ir/irText/expressions/kt24804.fir.txt index f9e8bc6d3e2..27b548313f4 100644 --- a/compiler/testData/ir/irText/expressions/kt24804.fir.txt +++ b/compiler/testData/ir/irText/expressions/kt24804.fir.txt @@ -10,19 +10,21 @@ FILE fqName: fileName:/kt24804.kt VAR name:z type:kotlin.Int [var] CONST Int type=kotlin.Int value=10 DO_WHILE label=l2 origin=DO_WHILE_LOOP - body: BLOCK type=kotlin.String origin=null + body: BLOCK type=kotlin.Unit origin=null SET_VAR 'var z: kotlin.Int [var] declared in .run' type=kotlin.Int origin=null CONST Int type=kotlin.Int value=1 - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Unit origin=IF BRANCH - if: ERROR_CALL 'Comparison of arguments with different types: kotlin/Int, kotlin/String' type=kotlin.Boolean + if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT + arg0: GET_VAR 'var z: kotlin.Int [var] declared in .run' type=kotlin.Int origin=null + arg1: CONST Int type=kotlin.Int value=100 then: RETURN type=kotlin.Nothing from='public final fun run (x: kotlin.Boolean, y: kotlin.Boolean): kotlin.String declared in ' CONST String type=kotlin.String value="NOT_OK" - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Unit origin=IF BRANCH if: GET_VAR 'x: kotlin.Boolean declared in .run' type=kotlin.Boolean origin=null then: ERROR_EXPR 'Unbound loop: continue@@@[ERROR_EXPR(Cannot bind label l1 to a loop)] ' type=kotlin.Nothing - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Unit origin=IF BRANCH if: GET_VAR 'y: kotlin.Boolean declared in .run' type=kotlin.Boolean origin=null then: CONTINUE label=l2 loop.label=l2 diff --git a/compiler/testData/ir/irText/expressions/kt30796.fir.txt b/compiler/testData/ir/irText/expressions/kt30796.fir.txt index f5132924a43..6e432a8ac8c 100644 --- a/compiler/testData/ir/irText/expressions/kt30796.fir.txt +++ b/compiler/testData/ir/irText/expressions/kt30796.fir.txt @@ -11,36 +11,36 @@ FILE fqName: fileName:/kt30796.kt VALUE_PARAMETER name:value2 index:1 type:T of .test BLOCK_BODY VAR name:x1 type:kotlin.Any [val] - BLOCK type=kotlin.Any origin=ELVIS + BLOCK type=kotlin.Any? origin=ELVIS VAR name: type:T of .test [val] GET_VAR 'value: T of .test declared in .test' type=T of .test origin=null - WHEN type=kotlin.Any origin=ELVIS + WHEN type=kotlin.Any? origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val : T of .test [val] declared in .test' type=T of .test origin=null arg1: CONST Null type=kotlin.Nothing? value=null - then: CONST Int type=kotlin.Any value=42 + then: CONST Int type=kotlin.Int value=42 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: GET_VAR 'val : T of .test [val] declared in .test' type=T of .test origin=null VAR name:x2 type:kotlin.Any [val] - BLOCK type=kotlin.Any origin=ELVIS + BLOCK type=kotlin.Any? origin=ELVIS VAR name: type:T of .test [val] GET_VAR 'value: T of .test declared in .test' type=T of .test origin=null - WHEN type=kotlin.Any origin=ELVIS + WHEN type=kotlin.Any? origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val : T of .test [val] declared in .test' type=T of .test origin=null arg1: CONST Null type=kotlin.Nothing? value=null - then: BLOCK type=kotlin.Any origin=ELVIS + then: BLOCK type=kotlin.Any? origin=ELVIS VAR name: type:T of .test [val] GET_VAR 'value2: T of .test declared in .test' type=T of .test origin=null - WHEN type=kotlin.Any origin=ELVIS + WHEN type=kotlin.Any? origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val : T of .test [val] declared in .test' type=T of .test origin=null arg1: CONST Null type=kotlin.Nothing? value=null - then: CONST Int type=kotlin.Any value=42 + then: CONST Int type=kotlin.Int value=42 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: GET_VAR 'val : T of .test [val] declared in .test' type=T of .test origin=null @@ -48,7 +48,7 @@ FILE fqName: fileName:/kt30796.kt if: CONST Boolean type=kotlin.Boolean value=true then: GET_VAR 'val : T of .test [val] declared in .test' type=T of .test origin=null VAR name:x3 type:kotlin.Any [val] - BLOCK type=kotlin.Any origin=ELVIS + BLOCK type=kotlin.Any? origin=ELVIS VAR name: type:T of .test [val] BLOCK type=T of .test origin=ELVIS VAR name: type:T of .test [val] @@ -62,17 +62,17 @@ FILE fqName: fileName:/kt30796.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: GET_VAR 'val : T of .test [val] declared in .test' type=T of .test origin=null - WHEN type=kotlin.Any origin=ELVIS + WHEN type=kotlin.Any? origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val : T of .test [val] declared in .test' type=T of .test origin=null arg1: CONST Null type=kotlin.Nothing? value=null - then: CONST Int type=kotlin.Any value=42 + then: CONST Int type=kotlin.Int value=42 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: GET_VAR 'val : T of .test [val] declared in .test' type=T of .test origin=null VAR name:x4 type:kotlin.Any [val] - BLOCK type=kotlin.Any origin=ELVIS + BLOCK type=kotlin.Any? origin=ELVIS VAR name: type:T of .test [val] BLOCK type=T of .test origin=ELVIS VAR name: type:T of .test [val] @@ -86,31 +86,31 @@ FILE fqName: fileName:/kt30796.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: GET_VAR 'val : T of .test [val] declared in .test' type=T of .test origin=null - WHEN type=kotlin.Any origin=ELVIS + WHEN type=kotlin.Any? origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val : T of .test [val] declared in .test' type=T of .test origin=null arg1: CONST Null type=kotlin.Nothing? value=null - then: CONST Int type=kotlin.Any value=42 + then: CONST Int type=kotlin.Int value=42 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: GET_VAR 'val : T of .test [val] declared in .test' type=T of .test origin=null VAR name:x5 type:kotlin.Any [val] - BLOCK type=kotlin.Any origin=ELVIS + BLOCK type=kotlin.Int origin=ELVIS VAR name: type:kotlin.Nothing [val] CALL 'public final fun magic (): T of .magic declared in ' type=kotlin.Nothing origin=null : - WHEN type=kotlin.Any origin=ELVIS + WHEN type=kotlin.Int origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val : kotlin.Nothing [val] declared in .test' type=kotlin.Nothing origin=null arg1: CONST Null type=kotlin.Nothing? value=null - then: CONST Int type=kotlin.Any value=42 + then: CONST Int type=kotlin.Int value=42 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: GET_VAR 'val : kotlin.Nothing [val] declared in .test' type=kotlin.Nothing origin=null VAR name:x6 type:kotlin.Any [val] - BLOCK type=kotlin.Any origin=ELVIS + BLOCK type=kotlin.Any? origin=ELVIS VAR name: type:T of .test [val] BLOCK type=T of .test origin=ELVIS VAR name: type:T of .test [val] @@ -120,22 +120,22 @@ FILE fqName: fileName:/kt30796.kt if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val : T of .test [val] declared in .test' type=T of .test origin=null arg1: CONST Null type=kotlin.Nothing? value=null - then: CALL 'public final fun magic (): T of .magic declared in ' type=kotlin.Nothing origin=null + then: CALL 'public final fun magic (): T of .magic declared in ' type=T of .test origin=null : BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: GET_VAR 'val : T of .test [val] declared in .test' type=T of .test origin=null - WHEN type=kotlin.Any origin=ELVIS + WHEN type=kotlin.Any? origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val : T of .test [val] declared in .test' type=T of .test origin=null arg1: CONST Null type=kotlin.Nothing? value=null - then: CONST Int type=kotlin.Any value=42 + then: CONST Int type=kotlin.Int value=42 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: GET_VAR 'val : T of .test [val] declared in .test' type=T of .test origin=null VAR name:x7 type:kotlin.Any [val] - BLOCK type=kotlin.Any origin=ELVIS + BLOCK type=kotlin.Any? origin=ELVIS VAR name: type:T of .test [val] BLOCK type=T of .test origin=ELVIS VAR name: type:kotlin.Nothing [val] @@ -150,12 +150,12 @@ FILE fqName: fileName:/kt30796.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: GET_VAR 'val : kotlin.Nothing [val] declared in .test' type=kotlin.Nothing origin=null - WHEN type=kotlin.Any origin=ELVIS + WHEN type=kotlin.Any? origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val : T of .test [val] declared in .test' type=T of .test origin=null arg1: CONST Null type=kotlin.Nothing? value=null - then: CONST Int type=kotlin.Any value=42 + then: CONST Int type=kotlin.Int value=42 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: GET_VAR 'val : T of .test [val] declared in .test' type=T of .test origin=null diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.txt b/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.txt index 2db8f5ee603..68dc52a8da9 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.txt @@ -2,7 +2,7 @@ FILE fqName: fileName:/samConversionsWithSmartCasts.kt FUN name:test1 visibility:public modality:FINAL <> (a:kotlin.Function0) returnType:kotlin.Unit VALUE_PARAMETER name:a index:0 type:kotlin.Function0 BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=IrErrorType origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=java.lang.Runnable GET_VAR 'a: kotlin.Function0 declared in .test1' type=kotlin.Function0 origin=null @@ -11,7 +11,7 @@ FILE fqName: fileName:/samConversionsWithSmartCasts.kt FUN name:test2 visibility:public modality:FINAL <> (a:kotlin.Function0) returnType:kotlin.Unit VALUE_PARAMETER name:a index:0 type:kotlin.Function0 BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=IrErrorType origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=java.lang.Runnable GET_VAR 'a: kotlin.Function0 declared in .test2' type=kotlin.Function0 origin=null @@ -20,7 +20,7 @@ FILE fqName: fileName:/samConversionsWithSmartCasts.kt FUN name:test3 visibility:public modality:FINAL <> (a:kotlin.Function0) returnType:kotlin.Unit VALUE_PARAMETER name:a index:0 type:kotlin.Function0 BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=IrErrorType origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=java.lang.Runnable GET_VAR 'a: kotlin.Function0 declared in .test3' type=kotlin.Function0 origin=null @@ -31,7 +31,7 @@ FILE fqName: fileName:/samConversionsWithSmartCasts.kt VALUE_PARAMETER name:a index:0 type:kotlin.Function0 VALUE_PARAMETER name:b index:1 type:kotlin.Function0 BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=IrErrorType origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=java.lang.Runnable GET_VAR 'a: kotlin.Function0 declared in .test4' type=kotlin.Function0 origin=null @@ -41,7 +41,7 @@ FILE fqName: fileName:/samConversionsWithSmartCasts.kt FUN name:test5 visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit VALUE_PARAMETER name:a index:0 type:kotlin.Any BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=IrErrorType origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=java.lang.Runnable GET_VAR 'a: kotlin.Any declared in .test5' type=kotlin.Any origin=null @@ -50,7 +50,7 @@ FILE fqName: fileName:/samConversionsWithSmartCasts.kt FUN name:test5x visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit VALUE_PARAMETER name:a index:0 type:kotlin.Any BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=IrErrorType origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=java.lang.Runnable GET_VAR 'a: kotlin.Any declared in .test5x' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/useImportedMember.fir.txt b/compiler/testData/ir/irText/expressions/useImportedMember.fir.txt index b2b4b73dc5f..0823d7ad84c 100644 --- a/compiler/testData/ir/irText/expressions/useImportedMember.fir.txt +++ b/compiler/testData/ir/irText/expressions/useImportedMember.fir.txt @@ -143,61 +143,61 @@ FILE fqName: fileName:/useImportedMember.kt VALUE_PARAMETER name:g index:0 type:kotlin.String FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String BLOCK_BODY - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Unit origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ arg0: CALL 'public final fun f (s: kotlin.Int): kotlin.Int declared in .C' type=kotlin.Int origin=null s: CONST Int type=kotlin.Int value=1 - arg1: CONST Int type=kotlin.String value=1 + arg1: CONST Int type=kotlin.Int value=1 then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' CONST String type=kotlin.String value="1" - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Unit origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ arg0: CALL 'public final fun f (s: kotlin.String): kotlin.Int declared in .C' type=kotlin.Int origin=null s: CONST String type=kotlin.String value="s" - arg1: CONST Int type=kotlin.String value=2 + arg1: CONST Int type=kotlin.Int value=2 then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' CONST String type=kotlin.String value="2" - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Unit origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ arg0: CALL 'public final fun f (): kotlin.Int declared in .C' type=kotlin.Int origin=null $this: CONST Boolean type=kotlin.Boolean value=true - arg1: CONST Int type=kotlin.String value=3 + arg1: CONST Int type=kotlin.Int value=3 then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' CONST String type=kotlin.String value="3" - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Unit origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ arg0: CALL 'public final fun (): kotlin.Int declared in .C' type=kotlin.Int origin=null - arg1: CONST Int type=kotlin.String value=4 + arg1: CONST Int type=kotlin.Int value=4 then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' CONST String type=kotlin.String value="4" SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:public' type=kotlin.Int origin=null value: CONST Int type=kotlin.Int value=5 - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Unit origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ arg0: CALL 'public final fun (): kotlin.Int declared in .C' type=kotlin.Int origin=null - arg1: CONST Int type=kotlin.String value=5 + arg1: CONST Int type=kotlin.Int value=5 then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' CONST String type=kotlin.String value="5" - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Unit origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ arg0: CALL 'public final fun (): kotlin.Int declared in .C' type=kotlin.Int origin=null $this: CONST Int type=kotlin.Int value=5 - arg1: CONST Int type=kotlin.String value=6 + arg1: CONST Int type=kotlin.Int value=6 then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' CONST String type=kotlin.String value="6" - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Unit origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ @@ -207,7 +207,7 @@ FILE fqName: fileName:/useImportedMember.kt arg1: CONST String type=kotlin.String value="7" then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' CONST String type=kotlin.String value="7" - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Unit origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ @@ -216,15 +216,15 @@ FILE fqName: fileName:/useImportedMember.kt arg1: CONST String type=kotlin.String value="8" then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' CONST String type=kotlin.String value="8" - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Unit origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ arg0: ERROR_CALL 'Unresolved reference: #' type=IrErrorType - arg1: CONST Int type=kotlin.String value=9 + arg1: CONST Int type=kotlin.Int value=9 then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' CONST String type=kotlin.String value="9" - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Unit origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ @@ -233,7 +233,7 @@ FILE fqName: fileName:/useImportedMember.kt arg1: CONST String type=kotlin.String value="10" then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' CONST String type=kotlin.String value="10" - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Unit origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ diff --git a/compiler/testData/ir/irText/expressions/when.fir.txt b/compiler/testData/ir/irText/expressions/when.fir.txt index 4fc61b13e55..d6690f84194 100644 --- a/compiler/testData/ir/irText/expressions/when.fir.txt +++ b/compiler/testData/ir/irText/expressions/when.fir.txt @@ -98,25 +98,25 @@ FILE fqName: fileName:/when.kt BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp1_subject: kotlin.Int [val] declared in .testComma' type=kotlin.Int origin=null - arg1: CONST Int type=kotlin.String value=1 + arg1: CONST Int type=kotlin.Int value=1 then: CONST Boolean type=kotlin.Boolean value=true BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp1_subject: kotlin.Int [val] declared in .testComma' type=kotlin.Int origin=null - arg1: CONST Int type=kotlin.String value=2 + arg1: CONST Int type=kotlin.Int value=2 then: CONST Boolean type=kotlin.Boolean value=true BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp1_subject: kotlin.Int [val] declared in .testComma' type=kotlin.Int origin=null - arg1: CONST Int type=kotlin.String value=3 + arg1: CONST Int type=kotlin.Int value=3 then: CONST Boolean type=kotlin.Boolean value=true BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp1_subject: kotlin.Int [val] declared in .testComma' type=kotlin.Int origin=null - arg1: CONST Int type=kotlin.String value=4 + arg1: CONST Int type=kotlin.Int value=4 then: CONST String type=kotlin.String value="1234" BRANCH if: WHEN type=kotlin.Boolean origin=null @@ -125,32 +125,32 @@ FILE fqName: fileName:/when.kt BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp1_subject: kotlin.Int [val] declared in .testComma' type=kotlin.Int origin=null - arg1: CONST Int type=kotlin.String value=5 + arg1: CONST Int type=kotlin.Int value=5 then: CONST Boolean type=kotlin.Boolean value=true BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp1_subject: kotlin.Int [val] declared in .testComma' type=kotlin.Int origin=null - arg1: CONST Int type=kotlin.String value=6 + arg1: CONST Int type=kotlin.Int value=6 then: CONST Boolean type=kotlin.Boolean value=true BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp1_subject: kotlin.Int [val] declared in .testComma' type=kotlin.Int origin=null - arg1: CONST Int type=kotlin.String value=7 + arg1: CONST Int type=kotlin.Int value=7 then: CONST String type=kotlin.String value="567" BRANCH if: WHEN type=kotlin.Boolean origin=null BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp1_subject: kotlin.Int [val] declared in .testComma' type=kotlin.Int origin=null - arg1: CONST Int type=kotlin.String value=8 + arg1: CONST Int type=kotlin.Int value=8 then: CONST Boolean type=kotlin.Boolean value=true BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp1_subject: kotlin.Int [val] declared in .testComma' type=kotlin.Int origin=null - arg1: CONST Int type=kotlin.String value=9 + arg1: CONST Int type=kotlin.Int value=9 then: CONST String type=kotlin.String value="89" BRANCH if: CONST Boolean type=kotlin.Boolean value=true diff --git a/compiler/testData/ir/irText/expressions/whenCoercedToUnit.fir.txt b/compiler/testData/ir/irText/expressions/whenCoercedToUnit.fir.txt index 51fa78a739b..a1cba47a581 100644 --- a/compiler/testData/ir/irText/expressions/whenCoercedToUnit.fir.txt +++ b/compiler/testData/ir/irText/expressions/whenCoercedToUnit.fir.txt @@ -2,11 +2,11 @@ FILE fqName: fileName:/whenCoercedToUnit.kt FUN name:foo visibility:public modality:FINAL <> (x:kotlin.Int) returnType:kotlin.Unit VALUE_PARAMETER name:x index:0 type:kotlin.Int BLOCK_BODY - BLOCK type=kotlin.Unit origin=WHEN + BLOCK type=kotlin.Int origin=WHEN VAR IR_TEMPORARY_VARIABLE name:tmp0_subject type:kotlin.Int [val] - WHEN type=kotlin.Unit origin=WHEN + WHEN type=kotlin.Int origin=WHEN BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp0_subject: kotlin.Int [val] declared in .foo' type=kotlin.Int origin=null - arg1: CONST Int type=kotlin.Unit value=0 - then: CONST Int type=kotlin.Unit value=0 + arg1: CONST Int type=kotlin.Int value=0 + then: CONST Int type=kotlin.Int value=0 diff --git a/compiler/testData/ir/irText/expressions/whenUnusedExpression.fir.txt b/compiler/testData/ir/irText/expressions/whenUnusedExpression.fir.txt index 351885d7bc0..fbcf40223b8 100644 --- a/compiler/testData/ir/irText/expressions/whenUnusedExpression.fir.txt +++ b/compiler/testData/ir/irText/expressions/whenUnusedExpression.fir.txt @@ -3,17 +3,17 @@ FILE fqName: fileName:/whenUnusedExpression.kt VALUE_PARAMETER name:b index:0 type:kotlin.Boolean VALUE_PARAMETER name:i index:1 type:kotlin.Int BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.Int? origin=IF BRANCH if: GET_VAR 'b: kotlin.Boolean declared in .test' type=kotlin.Boolean origin=null - then: BLOCK type=kotlin.Unit origin=WHEN + then: BLOCK type=kotlin.Int? origin=WHEN VAR IR_TEMPORARY_VARIABLE name:tmp0_subject type:kotlin.Int [val] - WHEN type=kotlin.Unit origin=WHEN + WHEN type=kotlin.Int? origin=WHEN BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp0_subject: kotlin.Int [val] declared in .test' type=kotlin.Int origin=null - arg1: CONST Int type=kotlin.Unit value=0 - then: CONST Int type=kotlin.Unit value=1 + arg1: CONST Int type=kotlin.Int value=0 + then: CONST Int type=kotlin.Int value=1 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Null type=kotlin.Nothing? value=null diff --git a/compiler/testData/ir/irText/lambdas/nonLocalReturn.fir.txt b/compiler/testData/ir/irText/lambdas/nonLocalReturn.fir.txt index 9e15ca449e2..40cf61d9c90 100644 --- a/compiler/testData/ir/irText/lambdas/nonLocalReturn.fir.txt +++ b/compiler/testData/ir/irText/lambdas/nonLocalReturn.fir.txt @@ -48,7 +48,7 @@ FILE fqName: fileName:/nonLocalReturn.kt BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'it: kotlin.Int declared in .testLrmFoo1.' type=kotlin.Int origin=null - arg1: CONST Int type=kotlin.Unit value=0 + arg1: CONST Int type=kotlin.Int value=0 then: RETURN type=kotlin.Nothing from='local final fun (it: kotlin.Int): kotlin.Unit declared in .testLrmFoo1' GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit CALL 'public final fun print (message: kotlin.Int): kotlin.Unit [inline] declared in kotlin.io' type=kotlin.Unit origin=null @@ -66,7 +66,7 @@ FILE fqName: fileName:/nonLocalReturn.kt BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'it: kotlin.Int declared in .testLrmFoo2.' type=kotlin.Int origin=null - arg1: CONST Int type=kotlin.Unit value=0 + arg1: CONST Int type=kotlin.Int value=0 then: RETURN type=kotlin.Nothing from='local final fun (it: kotlin.Int): kotlin.Unit declared in .testLrmFoo2' GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit CALL 'public final fun print (message: kotlin.Int): kotlin.Unit [inline] declared in kotlin.io' type=kotlin.Unit origin=null diff --git a/compiler/testData/ir/irText/regressions/kt24114.fir.txt b/compiler/testData/ir/irText/regressions/kt24114.fir.txt index 56df4d12b33..34939b41d38 100644 --- a/compiler/testData/ir/irText/regressions/kt24114.fir.txt +++ b/compiler/testData/ir/irText/regressions/kt24114.fir.txt @@ -18,9 +18,9 @@ FILE fqName: fileName:/kt24114.kt if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp0_subject: kotlin.Int [val] declared in .test1' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=1 - then: BLOCK type=kotlin.Int origin=WHEN + then: BLOCK type=kotlin.Nothing origin=WHEN VAR IR_TEMPORARY_VARIABLE name:tmp1_subject type:kotlin.Int [val] - WHEN type=kotlin.Int origin=WHEN + WHEN type=kotlin.Nothing origin=WHEN BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp1_subject: kotlin.Int [val] declared in .test1' type=kotlin.Int origin=null @@ -42,9 +42,9 @@ FILE fqName: fileName:/kt24114.kt if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp2_subject: kotlin.Int [val] declared in .test2' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=1 - then: BLOCK type=kotlin.Int origin=WHEN + then: BLOCK type=kotlin.Nothing origin=WHEN VAR IR_TEMPORARY_VARIABLE name:tmp3_subject type:kotlin.Int [val] - WHEN type=kotlin.Int origin=WHEN + WHEN type=kotlin.Nothing origin=WHEN BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp3_subject: kotlin.Int [val] declared in .test2' type=kotlin.Int origin=null