diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirBodyResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirBodyResolveTransformer.kt index bd213c36683..c9fe351c1b0 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirBodyResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirBodyResolveTransformer.kt @@ -526,7 +526,7 @@ open class FirBodyResolveTransformer( whenExpression.transformSubject(this, noExpectedType) if (whenExpression.isOneBranch()) { whenExpression.transformBranches(this, noExpectedType) - whenExpression.resultType = builtinTypes.unitType + whenExpression.resultType = whenExpression.branches.first().result.resultType dataFlowAnalyzer.exitWhenExpression(whenExpression) return@with whenExpression.compose() } diff --git a/compiler/fir/resolve/testData/resolve/arguments/lambda.txt b/compiler/fir/resolve/testData/resolve/arguments/lambda.txt index 05024d95752..d94db3b7dbe 100644 --- a/compiler/fir/resolve/testData/resolve/arguments/lambda.txt +++ b/compiler/fir/resolve/testData/resolve/arguments/lambda.txt @@ -22,7 +22,7 @@ FILE: lambda.kt Unit } ) - #(f = foo@fun .(): { + #(f = foo@fun .(): { Unit } , = foo@fun .(): { @@ -41,7 +41,7 @@ FILE: lambda.kt Unit } ) - R|/bar|(x = Int(1), f = bar@fun (): R|kotlin/Unit| { + R|/bar|(x = Int(1), f = bar@fun (): R|kotlin/Unit| { Unit } ) @@ -53,7 +53,7 @@ FILE: lambda.kt Unit } ) - R|/baz|(other = Boolean(false), f = baz@fun (): R|kotlin/Unit| { + R|/baz|(other = Boolean(false), f = baz@fun (): R|kotlin/Unit| { Unit } ) diff --git a/compiler/testData/ir/irText/expressions/bangbang.fir.txt b/compiler/testData/ir/irText/expressions/bangbang.fir.txt index 0ba9f82bc71..54934b51c6f 100644 --- a/compiler/testData/ir/irText/expressions/bangbang.fir.txt +++ b/compiler/testData/ir/irText/expressions/bangbang.fir.txt @@ -59,7 +59,7 @@ FILE fqName: fileName:/bangbang.kt TYPE_PARAMETER name:X index:0 variance: superTypes:[] VALUE_PARAMETER name:a index:0 type:X of .test4 BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.String origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.String? GET_VAR 'a: X of .test4 declared in .test4' type=X of .test4 origin=null diff --git a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt index 8f60da1416a..3f6c055a01d 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt @@ -103,7 +103,7 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt CONST Int type=kotlin.Int value=0 WHILE label=Outer origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true - body: BLOCK type=kotlin.Unit origin=null + body: BLOCK type=kotlin.Nothing origin=null VAR name: type:kotlin.Int [val] GET_VAR 'var i: kotlin.Int [var] declared in .test5' type=kotlin.Int origin=null SET_VAR 'var i: kotlin.Int [var] declared in .test5' type=kotlin.Int origin=null @@ -129,7 +129,7 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: BREAK label=null loop.label=Outer - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.Nothing origin=IF 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 diff --git a/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.txt b/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.txt index 6f9d9a0c93f..db13e2f6682 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.txt @@ -19,11 +19,11 @@ FILE fqName: fileName:/breakContinueInWhen.kt WHILE label=null origin=FOR_LOOP_INNER_WHILE condition: CALL 'public abstract fun hasNext (): kotlin.Boolean declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=null $this: GET_VAR 'val : kotlin.collections.IntIterator [val] declared in .testBreakFor' type=kotlin.collections.IntIterator origin=null - body: BLOCK type=kotlin.Unit origin=null + body: BLOCK type=kotlin.Nothing origin=null VAR name:x type:kotlin.Int [val] CALL 'public final fun next (): kotlin.Int declared in kotlin.collections.IntIterator' type=kotlin.Int origin=null $this: GET_VAR 'val : kotlin.collections.IntIterator [val] declared in .testBreakFor' type=kotlin.collections.IntIterator origin=null - WHEN type=kotlin.Unit origin=WHEN + WHEN type=kotlin.Nothing origin=WHEN BRANCH 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 k: kotlin.Int [var] declared in .testBreakFor' type=kotlin.Int origin=null @@ -37,7 +37,7 @@ FILE fqName: fileName:/breakContinueInWhen.kt condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT arg0: GET_VAR 'var k: kotlin.Int [var] declared in .testBreakWhile' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=10 - body: WHEN type=kotlin.Unit origin=WHEN + body: WHEN type=kotlin.Nothing origin=WHEN BRANCH 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 k: kotlin.Int [var] declared in .testBreakWhile' type=kotlin.Int origin=null @@ -48,7 +48,7 @@ FILE fqName: fileName:/breakContinueInWhen.kt VAR name:k type:kotlin.Int [var] CONST Int type=kotlin.Int value=0 DO_WHILE label=null origin=DO_WHILE_LOOP - body: WHEN type=kotlin.Unit origin=WHEN + body: WHEN type=kotlin.Nothing origin=WHEN BRANCH 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 k: kotlin.Int [var] declared in .testBreakDoWhile' type=kotlin.Int origin=null @@ -77,11 +77,11 @@ FILE fqName: fileName:/breakContinueInWhen.kt WHILE label=null origin=FOR_LOOP_INNER_WHILE condition: CALL 'public abstract fun hasNext (): kotlin.Boolean declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=null $this: GET_VAR 'val : kotlin.collections.IntIterator [val] declared in .testContinueFor' type=kotlin.collections.IntIterator origin=null - body: BLOCK type=kotlin.Unit origin=null + body: BLOCK type=kotlin.Nothing origin=null VAR name:x type:kotlin.Int [val] CALL 'public final fun next (): kotlin.Int declared in kotlin.collections.IntIterator' type=kotlin.Int origin=null $this: GET_VAR 'val : kotlin.collections.IntIterator [val] declared in .testContinueFor' type=kotlin.collections.IntIterator origin=null - WHEN type=kotlin.Unit origin=WHEN + WHEN type=kotlin.Nothing origin=WHEN BRANCH 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 k: kotlin.Int [var] declared in .testContinueFor' type=kotlin.Int origin=null @@ -95,7 +95,7 @@ FILE fqName: fileName:/breakContinueInWhen.kt condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT arg0: GET_VAR 'var k: kotlin.Int [var] declared in .testContinueWhile' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=10 - body: WHEN type=kotlin.Unit origin=WHEN + body: WHEN type=kotlin.Nothing origin=WHEN BRANCH 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 k: kotlin.Int [var] declared in .testContinueWhile' type=kotlin.Int origin=null @@ -115,7 +115,7 @@ FILE fqName: fileName:/breakContinueInWhen.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 .testContinueDoWhile' type=kotlin.Int origin=null GET_VAR 'var k: kotlin.Int [var] declared in .testContinueDoWhile' type=kotlin.Int origin=null - WHEN type=kotlin.Unit origin=WHEN + WHEN type=kotlin.Nothing origin=WHEN BRANCH 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 k: kotlin.Int [var] declared in .testContinueDoWhile' type=kotlin.Int origin=null @@ -128,7 +128,7 @@ FILE fqName: fileName:/breakContinueInWhen.kt condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT arg0: GET_VAR 'var k: kotlin.Int [var] declared in .testContinueDoWhile' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=10 - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.Nothing 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/castToTypeParameter.fir.txt b/compiler/testData/ir/irText/expressions/castToTypeParameter.fir.txt index ddd987d97ee..a112679f726 100644 --- a/compiler/testData/ir/irText/expressions/castToTypeParameter.fir.txt +++ b/compiler/testData/ir/irText/expressions/castToTypeParameter.fir.txt @@ -72,7 +72,7 @@ FILE fqName: fileName:/castToTypeParameter.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun (): TV of declared in .Host' TYPE_OP type=TV of origin=CAST typeOperand=TV of - GET_VAR ': .Host declared in .Host' type=.Host.Host> origin=null + GET_VAR ': .Host declared in .Host' type=T of .Host origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any diff --git a/compiler/testData/ir/irText/expressions/elvis.fir.txt b/compiler/testData/ir/irText/expressions/elvis.fir.txt index e916d3367da..6c9020c2024 100644 --- a/compiler/testData/ir/irText/expressions/elvis.fir.txt +++ b/compiler/testData/ir/irText/expressions/elvis.fir.txt @@ -50,13 +50,13 @@ 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.Unit origin=IF + WHEN type=kotlin.String 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.Unit origin=IF + WHEN type=kotlin.String 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 diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.txt index 1b8f933ec20..d3b032450c9 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.txt @@ -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.Unit origin=IF + WHEN type=kotlin.Int 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 @@ -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.Unit origin=IF + WHEN type=kotlin.Int 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 @@ -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.Unit origin=IF + WHEN type=kotlin.Int 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.Unit origin=IF + WHEN type=kotlin.Int 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/genericPropertyRef.fir.txt b/compiler/testData/ir/irText/expressions/genericPropertyRef.fir.txt index 5cd8547ed63..3de18c915d3 100644 --- a/compiler/testData/ir/irText/expressions/genericPropertyRef.fir.txt +++ b/compiler/testData/ir/irText/expressions/genericPropertyRef.fir.txt @@ -131,7 +131,7 @@ FILE fqName: fileName:/genericPropertyRef.kt PROPERTY name:recivier visibility:public modality:FINAL [var] FIELD PROPERTY_BACKING_FIELD name:recivier type:kotlin.Any? visibility:private [static] EXPRESSION_BODY - CONST String type=kotlin.Any? value="fail" + CONST String type=kotlin.Any value="fail" FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Any? correspondingProperty: PROPERTY name:recivier visibility:public modality:FINAL [var] BLOCK_BODY @@ -146,7 +146,7 @@ FILE fqName: fileName:/genericPropertyRef.kt PROPERTY name:value2 visibility:public modality:FINAL [var] FIELD PROPERTY_BACKING_FIELD name:value2 type:kotlin.Any? visibility:private [static] EXPRESSION_BODY - CONST String type=kotlin.Any? value="fail2" + CONST String type=kotlin.Any value="fail2" FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Any? correspondingProperty: PROPERTY name:value2 visibility:public modality:FINAL [var] BLOCK_BODY @@ -181,4 +181,3 @@ FILE fqName: fileName:/genericPropertyRef.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun (): kotlin.String.Companion declared in ' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:barRef type:kotlin.String.Companion visibility:private [final,static]' type=kotlin.String.Companion origin=null - diff --git a/compiler/testData/ir/irText/expressions/ifElseIf.fir.txt b/compiler/testData/ir/irText/expressions/ifElseIf.fir.txt index 6556643aa7d..8b60164ef6a 100644 --- a/compiler/testData/ir/irText/expressions/ifElseIf.fir.txt +++ b/compiler/testData/ir/irText/expressions/ifElseIf.fir.txt @@ -31,7 +31,7 @@ FILE fqName: fileName:/ifElseIf.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Boolean type=kotlin.Boolean value=true - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.Boolean origin=IF BRANCH if: GET_VAR 'flag: kotlin.Boolean declared in .testEmptyBranches1' type=kotlin.Boolean origin=null then: CONST Boolean type=kotlin.Boolean value=true diff --git a/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.fir.txt b/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.fir.txt index ade8f6d8b70..c2d0273e558 100644 --- a/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.fir.txt +++ b/compiler/testData/ir/irText/expressions/implicitCastToTypeParameter.fir.txt @@ -4,11 +4,11 @@ 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=kotlin.Any? origin=IF + WHEN type=T of .test1? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=T of .test1 GET_VAR ': kotlin.Any declared in .test1' type=kotlin.Any origin=null - then: GET_VAR ': kotlin.Any declared in .test1' type=kotlin.Any origin=null + then: GET_VAR ': kotlin.Any declared in .test1' type=T of .test1 origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Null type=kotlin.Nothing? value=null diff --git a/compiler/testData/ir/irText/expressions/kt24804.fir.txt b/compiler/testData/ir/irText/expressions/kt24804.fir.txt index 27b548313f4..d6e4e53dc37 100644 --- a/compiler/testData/ir/irText/expressions/kt24804.fir.txt +++ b/compiler/testData/ir/irText/expressions/kt24804.fir.txt @@ -10,21 +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.Unit origin=null + body: BLOCK type=kotlin.Nothing 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.Unit origin=IF + WHEN type=kotlin.String origin=IF BRANCH 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.Unit origin=IF + WHEN type=kotlin.Nothing 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.Unit origin=IF + WHEN type=kotlin.Nothing 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/primitivesImplicitConversions.fir.txt b/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.fir.txt index 6057f7bbaba..6c9f4238d8d 100644 --- a/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.fir.txt +++ b/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.fir.txt @@ -59,11 +59,11 @@ FILE fqName: fileName:/primitivesImplicitConversions.kt FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY VAR name:test1 type:kotlin.Int? [val] - CONST Int type=kotlin.Int? value=42 + CONST Int type=kotlin.Int value=42 VAR name:test2 type:kotlin.Long [val] CONST Int type=kotlin.Long value=42 VAR name:test3 type:kotlin.Long? [val] - CONST Int type=kotlin.Long? value=42 + CONST Int type=kotlin.Long value=42 VAR name:test4 type:kotlin.Long? [val] CALL 'public final fun unaryMinus (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null $this: CONST Int type=kotlin.Int value=1 diff --git a/compiler/testData/ir/irText/expressions/safeAssignment.fir.txt b/compiler/testData/ir/irText/expressions/safeAssignment.fir.txt index b86679a24a8..5d4dd9522c0 100644 --- a/compiler/testData/ir/irText/expressions/safeAssignment.fir.txt +++ b/compiler/testData/ir/irText/expressions/safeAssignment.fir.txt @@ -43,4 +43,4 @@ FILE fqName: fileName:/safeAssignment.kt BLOCK_BODY SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private' type=kotlin.Unit origin=null receiver: GET_VAR 'nc: .C? declared in .test' type=.C? origin=null - value: CONST Int type=kotlin.Int? value=42 + value: CONST Int type=kotlin.Int value=42 diff --git a/compiler/testData/ir/irText/expressions/safeCalls.fir.txt b/compiler/testData/ir/irText/expressions/safeCalls.fir.txt index 0071e2a9e8a..d0d4ab22ab7 100644 --- a/compiler/testData/ir/irText/expressions/safeCalls.fir.txt +++ b/compiler/testData/ir/irText/expressions/safeCalls.fir.txt @@ -85,7 +85,7 @@ FILE fqName: fileName:/safeCalls.kt BLOCK_BODY SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.Int visibility:private' type=kotlin.Unit origin=null receiver: GET_VAR 'x: .Ref? declared in .test4' type=.Ref? origin=null - value: CONST Int type=kotlin.Int? value=0 + value: CONST Int type=kotlin.Int value=0 FUN name:test5 visibility:public modality:FINAL <> ($receiver:.IHost, s:kotlin.String?) returnType:kotlin.Int? $receiver: VALUE_PARAMETER name: type:.IHost VALUE_PARAMETER name:s index:0 type:kotlin.String? diff --git a/compiler/testData/ir/irText/expressions/smartCasts.fir.txt b/compiler/testData/ir/irText/expressions/smartCasts.fir.txt index d6166c8c12a..2816e253721 100644 --- a/compiler/testData/ir/irText/expressions/smartCasts.fir.txt +++ b/compiler/testData/ir/irText/expressions/smartCasts.fir.txt @@ -38,7 +38,7 @@ FILE fqName: fileName:/smartCasts.kt FUN name:test2 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.String VALUE_PARAMETER name:x index:0 type:kotlin.Any BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.String origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.String GET_VAR 'x: kotlin.Any declared in .test2' type=kotlin.Any origin=null @@ -50,7 +50,7 @@ FILE fqName: fileName:/smartCasts.kt FUN name:test3 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.String VALUE_PARAMETER name:x index:0 type:kotlin.Any BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.String origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.String GET_VAR 'x: kotlin.Any declared in .test3' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/throw.fir.txt b/compiler/testData/ir/irText/expressions/throw.fir.txt index ff79ded8a7a..b484f564470 100644 --- a/compiler/testData/ir/irText/expressions/throw.fir.txt +++ b/compiler/testData/ir/irText/expressions/throw.fir.txt @@ -6,7 +6,7 @@ FILE fqName: fileName:/throw.kt FUN name:testImplicitCast 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=kotlin.Nothing origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Throwable GET_VAR 'a: kotlin.Any declared in .testImplicitCast' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.fir.txt b/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.fir.txt index 2ceb0231314..9c2c32bbaed 100644 --- a/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.fir.txt +++ b/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.fir.txt @@ -10,7 +10,7 @@ FILE fqName: fileName:/tryCatchWithImplicitCast.kt GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit VAR name:t type:kotlin.String [val] TRY type=kotlin.String - try: GET_VAR 'a: kotlin.Any declared in .testImplicitCast' type=kotlin.Any origin=null + try: GET_VAR 'a: kotlin.Any declared in .testImplicitCast' type=kotlin.String origin=null CATCH parameter=val e: kotlin.Throwable [val] declared in .testImplicitCast VAR name:e type:kotlin.Throwable [val] CONST String type=kotlin.String value="" diff --git a/compiler/testData/ir/irText/expressions/useImportedMember.fir.txt b/compiler/testData/ir/irText/expressions/useImportedMember.fir.txt index 40d196c57f4..89644a5da70 100644 --- a/compiler/testData/ir/irText/expressions/useImportedMember.fir.txt +++ b/compiler/testData/ir/irText/expressions/useImportedMember.fir.txt @@ -149,7 +149,7 @@ 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.Unit origin=IF + WHEN type=kotlin.String 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 @@ -159,7 +159,7 @@ FILE fqName: fileName:/useImportedMember.kt 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.Unit origin=IF + WHEN type=kotlin.String 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 @@ -169,7 +169,7 @@ FILE fqName: fileName:/useImportedMember.kt 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.Unit origin=IF + WHEN type=kotlin.String 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 @@ -178,7 +178,7 @@ FILE fqName: fileName:/useImportedMember.kt 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.Unit origin=IF + WHEN type=kotlin.String 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 @@ -190,7 +190,7 @@ FILE fqName: fileName:/useImportedMember.kt SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private' type=kotlin.Unit origin=null receiver: GET_VAR ': .C declared in .C' type=.C origin=null value: CONST Int type=kotlin.Int value=5 - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.String 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 @@ -199,7 +199,7 @@ FILE fqName: fileName:/useImportedMember.kt 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.Unit origin=IF + WHEN type=kotlin.String 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 @@ -208,7 +208,7 @@ FILE fqName: fileName:/useImportedMember.kt 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.Unit origin=IF + WHEN type=kotlin.String 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 @@ -219,7 +219,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.Unit origin=IF + WHEN type=kotlin.String 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 @@ -228,7 +228,7 @@ 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.Unit origin=IF + WHEN type=kotlin.String 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 @@ -238,7 +238,7 @@ FILE fqName: fileName:/useImportedMember.kt 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.Unit origin=IF + WHEN type=kotlin.String 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 @@ -247,7 +247,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.Unit origin=IF + WHEN type=kotlin.String 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/varargWithImplicitCast.fir.txt b/compiler/testData/ir/irText/expressions/varargWithImplicitCast.fir.txt index 3b93d65dfcb..62d4d450106 100644 --- a/compiler/testData/ir/irText/expressions/varargWithImplicitCast.fir.txt +++ b/compiler/testData/ir/irText/expressions/varargWithImplicitCast.fir.txt @@ -2,7 +2,7 @@ FILE fqName: fileName:/varargWithImplicitCast.kt FUN name:testScalar visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.IntArray VALUE_PARAMETER name:a index:0 type:kotlin.Any BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.IntArray origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Int GET_VAR 'a: kotlin.Any declared in .testScalar' type=kotlin.Any origin=null @@ -14,7 +14,7 @@ FILE fqName: fileName:/varargWithImplicitCast.kt FUN name:testSpread visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.IntArray VALUE_PARAMETER name:a index:0 type:kotlin.Any BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.IntArray origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.IntArray GET_VAR 'a: kotlin.Any declared in .testSpread' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/whenCoercedToUnit.fir.txt b/compiler/testData/ir/irText/expressions/whenCoercedToUnit.fir.txt index da87de4dc9e..a1cba47a581 100644 --- a/compiler/testData/ir/irText/expressions/whenCoercedToUnit.fir.txt +++ b/compiler/testData/ir/irText/expressions/whenCoercedToUnit.fir.txt @@ -2,9 +2,9 @@ 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 diff --git a/compiler/testData/ir/irText/expressions/whileDoWhile.fir.txt b/compiler/testData/ir/irText/expressions/whileDoWhile.fir.txt index decc70635ed..1940a72c661 100644 --- a/compiler/testData/ir/irText/expressions/whileDoWhile.fir.txt +++ b/compiler/testData/ir/irText/expressions/whileDoWhile.fir.txt @@ -71,4 +71,4 @@ FILE fqName: fileName:/whileDoWhile.kt body: BLOCK type=kotlin.Unit origin=null DO_WHILE label=null origin=DO_WHILE_LOOP body: BLOCK type=kotlin.Unit origin=null - condition: GET_VAR 'val a: kotlin.Any? [val] declared in .testSmartcastInCondition' type=kotlin.Any? origin=null + condition: GET_VAR 'val a: kotlin.Any? [val] declared in .testSmartcastInCondition' type=kotlin.Boolean origin=null diff --git a/compiler/testData/ir/irText/regressions/coercionInLoop.fir.txt b/compiler/testData/ir/irText/regressions/coercionInLoop.fir.txt index f3d0683d9a6..65d1bbec938 100644 --- a/compiler/testData/ir/irText/regressions/coercionInLoop.fir.txt +++ b/compiler/testData/ir/irText/regressions/coercionInLoop.fir.txt @@ -13,7 +13,7 @@ FILE fqName: fileName:/coercionInLoop.kt condition: CALL 'public abstract fun hasNext (): kotlin.Boolean declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=null $this: GET_VAR 'val x: kotlin.collections.DoubleIterator [val] declared in .box' type=kotlin.collections.DoubleIterator origin=null body: BLOCK type=kotlin.Int origin=null - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.String 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/regressions/kt24114.fir.txt b/compiler/testData/ir/irText/regressions/kt24114.fir.txt index dc4e9d4ef00..56df4d12b33 100644 --- a/compiler/testData/ir/irText/regressions/kt24114.fir.txt +++ b/compiler/testData/ir/irText/regressions/kt24114.fir.txt @@ -11,16 +11,16 @@ FILE fqName: fileName:/kt24114.kt BLOCK_BODY WHILE label=null origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true - body: BLOCK type=kotlin.Unit origin=WHEN + body: 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 .test1' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=1 - then: BLOCK type=kotlin.Unit origin=WHEN + then: BLOCK type=kotlin.Int origin=WHEN VAR IR_TEMPORARY_VARIABLE name:tmp1_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 tmp1_subject: kotlin.Int [val] declared in .test1' type=kotlin.Int origin=null @@ -35,16 +35,16 @@ FILE fqName: fileName:/kt24114.kt BLOCK_BODY WHILE label=null origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true - body: BLOCK type=kotlin.Unit origin=WHEN + body: BLOCK type=kotlin.Int origin=WHEN VAR IR_TEMPORARY_VARIABLE name:tmp2_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 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.Unit origin=WHEN + then: BLOCK type=kotlin.Int origin=WHEN VAR IR_TEMPORARY_VARIABLE name:tmp3_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 tmp3_subject: kotlin.Int [val] declared in .test2' type=kotlin.Int origin=null