diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrImplicitCastInserter.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrImplicitCastInserter.kt index 4c68686a54a..f72e42869ea 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrImplicitCastInserter.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrImplicitCastInserter.kt @@ -24,6 +24,7 @@ import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.IrTypeOperatorCallImpl import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.types.makeNotNull import org.jetbrains.kotlin.ir.types.removeAnnotations import org.jetbrains.kotlin.ir.types.withHasQuestionMark import org.jetbrains.kotlin.ir.util.classId @@ -314,7 +315,8 @@ class Fir2IrImplicitCastInserter( } internal fun implicitCastOrExpression(original: IrExpression, castType: IrType): IrExpression { - return original.takeIf { it.type == castType } ?: implicitCast(original, castType) + if (original.type.makeNotNull() == castType.makeNotNull()) return original + return implicitCast(original, castType) } private fun implicitCast(original: IrExpression, castType: IrType): IrExpression { diff --git a/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.kt.txt b/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.kt.txt index bb38bedafe8..cda338ab4fd 100644 --- a/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.kt.txt +++ b/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.kt.txt @@ -22,8 +22,8 @@ fun test2() { } ( = 0) - val : Int = () /*as Int */ + val : Int = () ( = .inc()) /*~> Unit */ - ( = () /*as Int */.plus(other = 1)) + ( = ().plus(other = 1)) } diff --git a/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.txt b/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.txt index 31ba7b5da0f..4bead69ab4c 100644 --- a/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.txt +++ b/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.txt @@ -48,8 +48,7 @@ FILE fqName: fileName:/localDelegatedProperties.kt CALL 'local final fun (: kotlin.Int?): kotlin.Unit declared in .test2' type=kotlin.Unit origin=EQ : CONST Int type=kotlin.Int value=0 VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val] - TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int - CALL 'local final fun (): kotlin.Int? declared in .test2' type=kotlin.Int? origin=GET_LOCAL_PROPERTY + CALL 'local final fun (): kotlin.Int? declared in .test2' type=kotlin.Int? origin=GET_LOCAL_PROPERTY CALL 'local final fun (: kotlin.Int?): kotlin.Unit declared in .test2' type=kotlin.Unit origin=EQ : CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null $this: GET_VAR 'val tmp_0: kotlin.Int [val] declared in .test2' type=kotlin.Int origin=null @@ -57,6 +56,5 @@ FILE fqName: fileName:/localDelegatedProperties.kt GET_VAR 'val tmp_0: kotlin.Int [val] declared in .test2' type=kotlin.Int origin=null CALL 'local final fun (: kotlin.Int?): kotlin.Unit declared in .test2' type=kotlin.Unit origin=EQ : CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null - $this: TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int - CALL 'local final fun (): kotlin.Int? declared in .test2' type=kotlin.Int? origin=GET_LOCAL_PROPERTY + $this: CALL 'local final fun (): kotlin.Int? declared in .test2' type=kotlin.Int? origin=GET_LOCAL_PROPERTY other: CONST Int type=kotlin.Int value=1 diff --git a/compiler/testData/ir/irText/expressions/bangbang.fir.kt.txt b/compiler/testData/ir/irText/expressions/bangbang.fir.kt.txt index d217c5919f6..dd8140cc05f 100644 --- a/compiler/testData/ir/irText/expressions/bangbang.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/bangbang.fir.kt.txt @@ -7,7 +7,7 @@ fun test2(a: Any?): Int { val tmp0_safe_receiver: Any? = a when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - else -> tmp0_safe_receiver /*as Any */.hashCode() + else -> tmp0_safe_receiver.hashCode() } }) } diff --git a/compiler/testData/ir/irText/expressions/bangbang.fir.txt b/compiler/testData/ir/irText/expressions/bangbang.fir.txt index dc9d1daf00b..cca5d161680 100644 --- a/compiler/testData/ir/irText/expressions/bangbang.fir.txt +++ b/compiler/testData/ir/irText/expressions/bangbang.fir.txt @@ -24,8 +24,7 @@ FILE fqName: fileName:/bangbang.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null - $this: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any - GET_VAR 'val tmp_0: kotlin.Any? [val] declared in .test2' type=kotlin.Any? origin=null + $this: GET_VAR 'val tmp_0: kotlin.Any? [val] declared in .test2' type=kotlin.Any? origin=null FUN name:test3 visibility:public modality:FINAL (a:X of .test3) returnType:X of .test3 TYPE_PARAMETER name:X index:0 variance: superTypes:[kotlin.Any?] VALUE_PARAMETER name:a index:0 type:X of .test3 diff --git a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.kt.txt b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.kt.txt index 88576c0eed8..f9ed0b8f326 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.kt.txt @@ -4,7 +4,7 @@ fun test1(c: Boolean?) { val : Boolean? = c when { EQEQ(arg0 = , arg1 = null) -> break@L - else -> /*as Boolean */ + else -> } }) { // BLOCK } @@ -17,7 +17,7 @@ fun test2(c: Boolean?) { val : Boolean? = c when { EQEQ(arg0 = , arg1 = null) -> continue@L - else -> /*as Boolean */ + else -> } }) { // BLOCK } @@ -31,7 +31,7 @@ fun test3(ss: List?) { val : List? = ss when { EQEQ(arg0 = , arg1 = null) -> continue@L - else -> /*as List */ + else -> } }.iterator() L2@ while (.hasNext()) { // BLOCK @@ -48,7 +48,7 @@ fun test4(ss: List?) { val : List? = ss when { EQEQ(arg0 = , arg1 = null) -> break@L - else -> /*as List */ + else -> } }.iterator() L2@ while (.hasNext()) { // BLOCK diff --git a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt index 60b54f615b5..781d8f74a98 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt @@ -17,8 +17,7 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt then: BREAK label=L loop.label=L BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: TYPE_OP type=kotlin.Boolean origin=IMPLICIT_CAST typeOperand=kotlin.Boolean - GET_VAR 'val tmp_0: kotlin.Boolean? [val] declared in .test1' type=kotlin.Boolean? origin=null + then: GET_VAR 'val tmp_0: kotlin.Boolean? [val] declared in .test1' type=kotlin.Boolean? origin=null body: BLOCK type=kotlin.Unit origin=null FUN name:test2 visibility:public modality:FINAL <> (c:kotlin.Boolean?) returnType:kotlin.Unit VALUE_PARAMETER name:c index:0 type:kotlin.Boolean? @@ -38,8 +37,7 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt then: CONTINUE label=L loop.label=L BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: TYPE_OP type=kotlin.Boolean origin=IMPLICIT_CAST typeOperand=kotlin.Boolean - GET_VAR 'val tmp_1: kotlin.Boolean? [val] declared in .test2' type=kotlin.Boolean? origin=null + then: GET_VAR 'val tmp_1: kotlin.Boolean? [val] declared in .test2' type=kotlin.Boolean? origin=null body: BLOCK type=kotlin.Unit origin=null FUN name:test3 visibility:public modality:FINAL <> (ss:kotlin.collections.List?) returnType:kotlin.Unit VALUE_PARAMETER name:ss index:0 type:kotlin.collections.List? @@ -61,8 +59,7 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt then: CONTINUE label=L loop.label=L BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: TYPE_OP type=kotlin.collections.List origin=IMPLICIT_CAST typeOperand=kotlin.collections.List - GET_VAR 'val tmp_3: kotlin.collections.List? [val] declared in .test3' type=kotlin.collections.List? origin=null + then: GET_VAR 'val tmp_3: kotlin.collections.List? [val] declared in .test3' type=kotlin.collections.List? origin=null WHILE label=L2 origin=FOR_LOOP_INNER_WHILE condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT $this: GET_VAR 'val tmp_2: kotlin.collections.Iterator [val] declared in .test3' type=kotlin.collections.Iterator origin=null @@ -90,8 +87,7 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt then: BREAK label=L loop.label=L BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: TYPE_OP type=kotlin.collections.List origin=IMPLICIT_CAST typeOperand=kotlin.collections.List - GET_VAR 'val tmp_5: kotlin.collections.List? [val] declared in .test4' type=kotlin.collections.List? origin=null + then: GET_VAR 'val tmp_5: kotlin.collections.List? [val] declared in .test4' type=kotlin.collections.List? origin=null WHILE label=L2 origin=FOR_LOOP_INNER_WHILE condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT $this: GET_VAR 'val tmp_4: kotlin.collections.Iterator [val] declared in .test4' type=kotlin.collections.Iterator origin=null diff --git a/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt index 24b10edc3dd..3d536fba7ee 100644 --- a/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt +++ b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.kt.txt @@ -23,22 +23,22 @@ fun test(nc: C?): C? { val tmp0_safe_receiver: C? = nc when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - else -> tmp0_safe_receiver /*as C */.foo() + else -> tmp0_safe_receiver.foo() } } when { EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null - else -> tmp1_safe_receiver /*as C */.bar() + else -> tmp1_safe_receiver.bar() } } when { EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null - else -> tmp2_safe_receiver /*as C */.foo() + else -> tmp2_safe_receiver.foo() } } when { EQEQ(arg0 = tmp3_safe_receiver, arg1 = null) -> null - else -> tmp3_safe_receiver /*as C */.foo() + else -> tmp3_safe_receiver.foo() } } } diff --git a/compiler/testData/ir/irText/expressions/chainOfSafeCalls.txt b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.txt index 461a12bf19f..ed8e621b69d 100644 --- a/compiler/testData/ir/irText/expressions/chainOfSafeCalls.txt +++ b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.txt @@ -50,8 +50,7 @@ FILE fqName: fileName:/chainOfSafeCalls.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public final fun foo (): .C declared in .C' type=.C origin=null - $this: TYPE_OP type=.C origin=IMPLICIT_CAST typeOperand=.C - GET_VAR 'val tmp_3: .C? [val] declared in .test' type=.C? origin=null + $this: GET_VAR 'val tmp_3: .C? [val] declared in .test' type=.C? origin=null WHEN type=.C? 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 @@ -61,8 +60,7 @@ FILE fqName: fileName:/chainOfSafeCalls.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public final fun bar (): .C? declared in .C' type=.C? origin=null - $this: TYPE_OP type=.C origin=IMPLICIT_CAST typeOperand=.C - GET_VAR 'val tmp_2: .C? [val] declared in .test' type=.C? origin=null + $this: GET_VAR 'val tmp_2: .C? [val] declared in .test' type=.C? origin=null WHEN type=.C? 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 @@ -72,8 +70,7 @@ FILE fqName: fileName:/chainOfSafeCalls.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public final fun foo (): .C declared in .C' type=.C origin=null - $this: TYPE_OP type=.C origin=IMPLICIT_CAST typeOperand=.C - GET_VAR 'val tmp_1: .C? [val] declared in .test' type=.C? origin=null + $this: GET_VAR 'val tmp_1: .C? [val] declared in .test' type=.C? origin=null WHEN type=.C? 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 @@ -83,5 +80,4 @@ FILE fqName: fileName:/chainOfSafeCalls.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public final fun foo (): .C declared in .C' type=.C origin=null - $this: TYPE_OP type=.C origin=IMPLICIT_CAST typeOperand=.C - GET_VAR 'val tmp_0: .C? [val] declared in .test' type=.C? origin=null + $this: GET_VAR 'val tmp_0: .C? [val] declared in .test' type=.C? origin=null diff --git a/compiler/testData/ir/irText/expressions/coercionToUnit.fir.kt.txt b/compiler/testData/ir/irText/expressions/coercionToUnit.fir.kt.txt index 4f3d8236800..2d878235e87 100644 --- a/compiler/testData/ir/irText/expressions/coercionToUnit.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/coercionToUnit.fir.kt.txt @@ -14,14 +14,14 @@ fun test3() { val tmp0_safe_receiver: PrintStream? = #out when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - else -> tmp0_safe_receiver /*as @FlexibleNullability PrintStream */.println(p0 = "Hello,") + else -> tmp0_safe_receiver.println(p0 = "Hello,") } } /*~> Unit */ { // BLOCK val tmp1_safe_receiver: PrintStream? = #out when { EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null - else -> tmp1_safe_receiver /*as @FlexibleNullability PrintStream */.println(p0 = "world!") + else -> tmp1_safe_receiver.println(p0 = "world!") } } /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/coercionToUnit.fir.txt b/compiler/testData/ir/irText/expressions/coercionToUnit.fir.txt index f96009bc4cc..18e3854f53c 100644 --- a/compiler/testData/ir/irText/expressions/coercionToUnit.fir.txt +++ b/compiler/testData/ir/irText/expressions/coercionToUnit.fir.txt @@ -34,8 +34,7 @@ FILE fqName: fileName:/coercionToUnit.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public open fun println (p0: kotlin.String?): kotlin.Unit declared in java.io.PrintStream' type=kotlin.Unit origin=null - $this: TYPE_OP type=@[FlexibleNullability] java.io.PrintStream origin=IMPLICIT_CAST typeOperand=@[FlexibleNullability] java.io.PrintStream - GET_VAR 'val tmp_0: java.io.PrintStream? [val] declared in .test3' type=java.io.PrintStream? origin=null + $this: GET_VAR 'val tmp_0: java.io.PrintStream? [val] declared in .test3' type=java.io.PrintStream? origin=null p0: CONST String type=kotlin.String value="Hello," TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit BLOCK type=kotlin.Unit? origin=SAFE_CALL @@ -50,6 +49,5 @@ FILE fqName: fileName:/coercionToUnit.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public open fun println (p0: kotlin.String?): kotlin.Unit declared in java.io.PrintStream' type=kotlin.Unit origin=null - $this: TYPE_OP type=@[FlexibleNullability] java.io.PrintStream origin=IMPLICIT_CAST typeOperand=@[FlexibleNullability] java.io.PrintStream - GET_VAR 'val tmp_1: java.io.PrintStream? [val] declared in .test3' type=java.io.PrintStream? origin=null + $this: GET_VAR 'val tmp_1: java.io.PrintStream? [val] declared in .test3' type=java.io.PrintStream? origin=null p0: CONST String type=kotlin.String value="world!" diff --git a/compiler/testData/ir/irText/expressions/dotQualified.kt.txt b/compiler/testData/ir/irText/expressions/dotQualified.kt.txt index 550df1664ee..c51eec9e70b 100644 --- a/compiler/testData/ir/irText/expressions/dotQualified.kt.txt +++ b/compiler/testData/ir/irText/expressions/dotQualified.kt.txt @@ -7,7 +7,7 @@ fun lengthN(s: String?): Int? { val tmp0_safe_receiver: String? = s when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - else -> tmp0_safe_receiver /*as String */.() + else -> tmp0_safe_receiver.() } } } diff --git a/compiler/testData/ir/irText/expressions/dotQualified.txt b/compiler/testData/ir/irText/expressions/dotQualified.txt index f33bb88ffcd..7d730a47d3b 100644 --- a/compiler/testData/ir/irText/expressions/dotQualified.txt +++ b/compiler/testData/ir/irText/expressions/dotQualified.txt @@ -21,5 +21,4 @@ FILE fqName: fileName:/dotQualified.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public open fun (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY - $this: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String - GET_VAR 'val tmp_0: kotlin.String? [val] declared in .lengthN' type=kotlin.String? origin=null + $this: GET_VAR 'val tmp_0: kotlin.String? [val] declared in .lengthN' type=kotlin.String? origin=null diff --git a/compiler/testData/ir/irText/expressions/elvis.fir.kt.txt b/compiler/testData/ir/irText/expressions/elvis.fir.kt.txt index 0ec550b8a10..d0e3af4f105 100644 --- a/compiler/testData/ir/irText/expressions/elvis.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/elvis.fir.kt.txt @@ -11,7 +11,7 @@ fun test1(a: Any?, b: Any): Any { val : Any? = a when { EQEQ(arg0 = , arg1 = null) -> b - else -> /*as Any */ + else -> } } } @@ -21,7 +21,7 @@ fun test2(a: String?, b: Any): Any { val : String? = a when { EQEQ(arg0 = , arg1 = null) -> b - else -> /*as String */ + else -> } } } @@ -37,7 +37,7 @@ fun test3(a: Any?, b: Any?): String { val : String? = a /*as String? */ when { EQEQ(arg0 = , arg1 = null) -> b /*as String */ - else -> /*as String */ + else -> } } } @@ -47,7 +47,7 @@ fun test4(x: Any): Any { val : Any? = () when { EQEQ(arg0 = , arg1 = null) -> x - else -> /*as Any */ + else -> } } } @@ -57,7 +57,7 @@ fun test5(x: Any): Any { val : Any? = foo() when { EQEQ(arg0 = , arg1 = null) -> x - else -> /*as Any */ + else -> } } } diff --git a/compiler/testData/ir/irText/expressions/elvis.fir.txt b/compiler/testData/ir/irText/expressions/elvis.fir.txt index 459ce80ec76..2b4064a2fc2 100644 --- a/compiler/testData/ir/irText/expressions/elvis.fir.txt +++ b/compiler/testData/ir/irText/expressions/elvis.fir.txt @@ -28,8 +28,7 @@ FILE fqName: fileName:/elvis.kt then: GET_VAR 'b: kotlin.Any declared in .test1' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any - GET_VAR 'val tmp_0: kotlin.Any? [val] declared in .test1' type=kotlin.Any? origin=null + then: GET_VAR 'val tmp_0: kotlin.Any? [val] declared in .test1' type=kotlin.Any? origin=null FUN name:test2 visibility:public modality:FINAL <> (a:kotlin.String?, b:kotlin.Any) returnType:kotlin.Any VALUE_PARAMETER name:a index:0 type:kotlin.String? VALUE_PARAMETER name:b index:1 type:kotlin.Any @@ -46,8 +45,7 @@ FILE fqName: fileName:/elvis.kt then: GET_VAR 'b: kotlin.Any declared in .test2' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String - GET_VAR 'val tmp_1: kotlin.String? [val] declared in .test2' type=kotlin.String? origin=null + then: GET_VAR 'val tmp_1: kotlin.String? [val] declared in .test2' type=kotlin.String? origin=null FUN name:test3 visibility:public modality:FINAL <> (a:kotlin.Any?, b:kotlin.Any?) returnType:kotlin.String VALUE_PARAMETER name:a index:0 type:kotlin.Any? VALUE_PARAMETER name:b index:1 type:kotlin.Any? @@ -78,8 +76,7 @@ FILE fqName: fileName:/elvis.kt GET_VAR 'b: kotlin.Any? declared in .test3' type=kotlin.Any? origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String - GET_VAR 'val tmp_2: kotlin.String? [val] declared in .test3' type=kotlin.String? origin=null + then: GET_VAR 'val tmp_2: kotlin.String? [val] declared in .test3' type=kotlin.String? origin=null FUN name:test4 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.Any VALUE_PARAMETER name:x index:0 type:kotlin.Any BLOCK_BODY @@ -95,8 +92,7 @@ FILE fqName: fileName:/elvis.kt then: GET_VAR 'x: kotlin.Any declared in .test4' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any - GET_VAR 'val tmp_3: kotlin.Any? [val] declared in .test4' type=kotlin.Any? origin=null + then: GET_VAR 'val tmp_3: kotlin.Any? [val] declared in .test4' type=kotlin.Any? origin=null FUN name:test5 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.Any VALUE_PARAMETER name:x index:0 type:kotlin.Any BLOCK_BODY @@ -112,5 +108,4 @@ FILE fqName: fileName:/elvis.kt then: GET_VAR 'x: kotlin.Any declared in .test5' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any - GET_VAR 'val tmp_4: kotlin.Any? [val] declared in .test5' type=kotlin.Any? origin=null + then: GET_VAR 'val tmp_4: kotlin.Any? [val] declared in .test5' type=kotlin.Any? origin=null diff --git a/compiler/testData/ir/irText/expressions/implicitCastToNonNull.fir.kt.txt b/compiler/testData/ir/irText/expressions/implicitCastToNonNull.fir.kt.txt deleted file mode 100644 index f1ea7098be2..00000000000 --- a/compiler/testData/ir/irText/expressions/implicitCastToNonNull.fir.kt.txt +++ /dev/null @@ -1,33 +0,0 @@ -fun test1(x: String?): Int { - return when { - EQEQ(arg0 = x, arg1 = null) -> 0 - else -> x /*as String */.() - } -} - -fun test2(x: T): Int { - return when { - EQEQ(arg0 = x, arg1 = null) -> 0 - else -> x.() - } -} - -inline fun test3(x: Any): Int { - return when { - x !is T -> 0 - else -> x /*as T */.() - } -} - -inline fun test4(x: Any?): Int { - return when { - x !is T -> 0 - else -> x /*as T */.() - } -} - -fun test5(x: T, fn: Function1) { - when { - EQEQ(arg0 = x, arg1 = null).not() -> fn.invoke(p1 = x) - } -} diff --git a/compiler/testData/ir/irText/expressions/implicitCastToNonNull.fir.txt b/compiler/testData/ir/irText/expressions/implicitCastToNonNull.fir.txt deleted file mode 100644 index b4218fcc45c..00000000000 --- a/compiler/testData/ir/irText/expressions/implicitCastToNonNull.fir.txt +++ /dev/null @@ -1,76 +0,0 @@ -FILE fqName: fileName:/implicitCastToNonNull.kt - FUN name:test1 visibility:public modality:FINAL <> (x:kotlin.String?) returnType:kotlin.Int - VALUE_PARAMETER name:x index:0 type:kotlin.String? - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun test1 (x: kotlin.String?): kotlin.Int declared in ' - WHEN type=kotlin.Int 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 'x: kotlin.String? declared in .test1' type=kotlin.String? origin=null - arg1: CONST Null type=kotlin.Nothing? value=null - then: CONST Int type=kotlin.Int value=0 - BRANCH - if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'public open fun (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY - $this: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String - GET_VAR 'x: kotlin.String? declared in .test1' type=kotlin.String? origin=null - FUN name:test2 visibility:public modality:FINAL (x:T of .test2) returnType:kotlin.Int - TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.CharSequence?] - VALUE_PARAMETER name:x index:0 type:T of .test2 - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun test2 (x: T of .test2): kotlin.Int declared in ' - WHEN type=kotlin.Int 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 'x: T of .test2 declared in .test2' type=T of .test2 origin=null - arg1: CONST Null type=kotlin.Nothing? value=null - then: CONST Int type=kotlin.Int value=0 - BRANCH - if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'public abstract fun (): kotlin.Int declared in kotlin.CharSequence' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR 'x: T of .test2 declared in .test2' type=T of .test2 origin=null - FUN name:test3 visibility:public modality:FINAL (x:kotlin.Any) returnType:kotlin.Int [inline] - TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.CharSequence?] - VALUE_PARAMETER name:x index:0 type:kotlin.Any - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun test3 (x: kotlin.Any): kotlin.Int [inline] declared in ' - WHEN type=kotlin.Int origin=IF - 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=kotlin.Int value=0 - BRANCH - if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'public abstract fun (): kotlin.Int declared in kotlin.CharSequence' type=kotlin.Int origin=GET_PROPERTY - $this: TYPE_OP type=T of .test3 origin=IMPLICIT_CAST typeOperand=T of .test3 - GET_VAR 'x: kotlin.Any declared in .test3' type=kotlin.Any origin=null - FUN name:test4 visibility:public modality:FINAL (x:kotlin.Any?) returnType:kotlin.Int [inline] - TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.CharSequence] - VALUE_PARAMETER name:x index:0 type:kotlin.Any? - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun test4 (x: kotlin.Any?): kotlin.Int [inline] declared in ' - WHEN type=kotlin.Int origin=IF - 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=kotlin.Int value=0 - BRANCH - if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'public abstract fun (): kotlin.Int declared in kotlin.CharSequence' type=kotlin.Int origin=GET_PROPERTY - $this: TYPE_OP type=T of .test4 origin=IMPLICIT_CAST typeOperand=T of .test4 - GET_VAR 'x: kotlin.Any? declared in .test4' type=kotlin.Any? origin=null - FUN name:test5 visibility:public modality:FINAL (x:T of .test5, fn:kotlin.Function1.test5, kotlin.Unit>) returnType:kotlin.Unit - TYPE_PARAMETER name:T index:0 variance: superTypes:[S of .test5?] - TYPE_PARAMETER name:S index:1 variance: superTypes:[kotlin.Any?] - VALUE_PARAMETER name:x index:0 type:T of .test5 - VALUE_PARAMETER name:fn index:1 type:kotlin.Function1.test5, kotlin.Unit> - BLOCK_BODY - WHEN type=kotlin.Unit origin=IF - BRANCH - if: CALL 'public final fun not (): kotlin.Boolean [operator] 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: GET_VAR 'x: T of .test5 declared in .test5' type=T of .test5 origin=null - arg1: CONST Null type=kotlin.Nothing? value=null - then: CALL 'public abstract fun invoke (p1: P1 of kotlin.Function1): R of kotlin.Function1 [operator] declared in kotlin.Function1' type=kotlin.Unit origin=INVOKE - $this: GET_VAR 'fn: kotlin.Function1.test5, kotlin.Unit> declared in .test5' type=kotlin.Function1.test5, kotlin.Unit> origin=VARIABLE_AS_FUNCTION - p1: GET_VAR 'x: T of .test5 declared in .test5' type=T of .test5 origin=null diff --git a/compiler/testData/ir/irText/expressions/implicitCastToNonNull.kt b/compiler/testData/ir/irText/expressions/implicitCastToNonNull.kt index fa482951574..1e8ea10a291 100644 --- a/compiler/testData/ir/irText/expressions/implicitCastToNonNull.kt +++ b/compiler/testData/ir/irText/expressions/implicitCastToNonNull.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL fun test1(x: String?) = if (x == null) 0 else x.length diff --git a/compiler/testData/ir/irText/expressions/kt30020.fir.kt.txt b/compiler/testData/ir/irText/expressions/kt30020.fir.kt.txt index 5cfdce35f5a..fd3b77edb9d 100644 --- a/compiler/testData/ir/irText/expressions/kt30020.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt30020.fir.kt.txt @@ -15,14 +15,14 @@ fun test(x: X, nx: X?) { val tmp0_safe_receiver: X? = nx when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - else -> tmp0_safe_receiver /*as X */.() + else -> tmp0_safe_receiver.() } }).plusAssign(element = 5) CHECK_NOT_NULL>(arg0 = { // BLOCK val tmp1_safe_receiver: X? = nx when { EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null - else -> tmp1_safe_receiver /*as X */.f() + else -> tmp1_safe_receiver.f() } }).plusAssign(element = 6) } diff --git a/compiler/testData/ir/irText/expressions/kt30020.fir.txt b/compiler/testData/ir/irText/expressions/kt30020.fir.txt index e9197fa4366..1c57f6ea4a7 100644 --- a/compiler/testData/ir/irText/expressions/kt30020.fir.txt +++ b/compiler/testData/ir/irText/expressions/kt30020.fir.txt @@ -62,8 +62,7 @@ FILE fqName: fileName:/kt30020.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public abstract fun (): kotlin.collections.MutableList declared in .X' type=kotlin.collections.MutableList origin=GET_PROPERTY - $this: TYPE_OP type=.X origin=IMPLICIT_CAST typeOperand=.X - GET_VAR 'val tmp_0: .X? [val] declared in .test' type=.X? origin=null + $this: GET_VAR 'val tmp_0: .X? [val] declared in .test' type=.X? origin=null element: CONST Int type=kotlin.Int value=5 CALL 'public final fun plusAssign (element: T of kotlin.collections.CollectionsKt.plusAssign): kotlin.Unit [inline,operator] declared in kotlin.collections.CollectionsKt' type=kotlin.Unit origin=null : kotlin.Int @@ -81,8 +80,7 @@ FILE fqName: fileName:/kt30020.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public abstract fun f (): kotlin.collections.MutableList declared in .X' type=kotlin.collections.MutableList origin=null - $this: TYPE_OP type=.X origin=IMPLICIT_CAST typeOperand=.X - GET_VAR 'val tmp_1: .X? [val] declared in .test' type=.X? origin=null + $this: GET_VAR 'val tmp_1: .X? [val] declared in .test' type=.X? origin=null element: CONST Int type=kotlin.Int value=6 FUN name:testExtensionReceiver visibility:public modality:FINAL <> ($receiver:kotlin.collections.MutableList) returnType:kotlin.Unit $receiver: VALUE_PARAMETER name: type:kotlin.collections.MutableList diff --git a/compiler/testData/ir/irText/expressions/safeAssignment.fir.kt.txt b/compiler/testData/ir/irText/expressions/safeAssignment.fir.kt.txt index 58c85e4987b..a44b20dfee8 100644 --- a/compiler/testData/ir/irText/expressions/safeAssignment.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/safeAssignment.fir.kt.txt @@ -17,7 +17,7 @@ fun test(nc: C?) { val tmp0_safe_receiver: C? = nc when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - else -> tmp0_safe_receiver /*as C */.( = 42) + else -> tmp0_safe_receiver.( = 42) } } /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/safeAssignment.fir.txt b/compiler/testData/ir/irText/expressions/safeAssignment.fir.txt index 0a8cf9d7346..4491357a6c7 100644 --- a/compiler/testData/ir/irText/expressions/safeAssignment.fir.txt +++ b/compiler/testData/ir/irText/expressions/safeAssignment.fir.txt @@ -54,6 +54,5 @@ FILE fqName: fileName:/safeAssignment.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public final fun (: kotlin.Int): kotlin.Unit declared in .C' type=kotlin.Unit origin=EQ - $this: TYPE_OP type=.C origin=IMPLICIT_CAST typeOperand=.C - GET_VAR 'val tmp_0: .C? [val] declared in .test' type=.C? origin=null + $this: GET_VAR 'val tmp_0: .C? [val] declared in .test' type=.C? origin=null : CONST Int type=kotlin.Int value=42 diff --git a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.fir.kt.txt b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.fir.kt.txt index 23d15a98d7a..ea0d8518045 100644 --- a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.fir.kt.txt @@ -21,7 +21,7 @@ operator fun Int?.inc(): Int? { val tmp0_safe_receiver: Int? = when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - else -> tmp0_safe_receiver /*as Int */.inc() + else -> tmp0_safe_receiver.inc() } } } @@ -38,14 +38,14 @@ fun testProperty(nc: C?) { val tmp1_safe_receiver: C? = nc when { EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null - else -> tmp1_safe_receiver /*as C */.() + else -> tmp1_safe_receiver.() } } { // BLOCK val tmp2_safe_receiver: C? = nc when { EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null - else -> tmp2_safe_receiver /*as C */.(value = .inc()) + else -> tmp2_safe_receiver.(value = .inc()) } } /*~> Unit */ /*~> Unit */ @@ -56,7 +56,7 @@ fun testArrayAccess(nc: C?) { val tmp3_safe_receiver: C? = nc when { EQEQ(arg0 = tmp3_safe_receiver, arg1 = null) -> null - else -> tmp3_safe_receiver /*as C */.() + else -> tmp3_safe_receiver.() } } val : Int = 0 diff --git a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.fir.txt b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.fir.txt index 5f63dcb38aa..d7c526ea61c 100644 --- a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.fir.txt +++ b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.fir.txt @@ -46,8 +46,7 @@ FILE fqName:test fileName:/safeCallWithIncrementDecrement.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null - $this: TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int - GET_VAR 'val tmp_0: kotlin.Int? [val] declared in test.inc' type=kotlin.Int? origin=null + $this: GET_VAR 'val tmp_0: kotlin.Int? [val] declared in test.inc' type=kotlin.Int? origin=null FUN name:get visibility:public modality:FINAL <> ($receiver:kotlin.Int?, index:kotlin.Int) returnType:kotlin.Int [operator] $receiver: VALUE_PARAMETER name: type:kotlin.Int? VALUE_PARAMETER name:index index:0 type:kotlin.Int @@ -75,8 +74,7 @@ FILE fqName:test fileName:/safeCallWithIncrementDecrement.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public final fun (): kotlin.Int declared in test' type=kotlin.Int origin=GET_PROPERTY - $receiver: TYPE_OP type=test.C origin=IMPLICIT_CAST typeOperand=test.C - GET_VAR 'val tmp_2: test.C? [val] declared in test.testProperty' type=test.C? origin=null + $receiver: GET_VAR 'val tmp_2: test.C? [val] declared in test.testProperty' type=test.C? origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit BLOCK type=kotlin.Unit? origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:test.C? [val] @@ -90,8 +88,7 @@ FILE fqName:test fileName:/safeCallWithIncrementDecrement.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public final fun (value: kotlin.Int): kotlin.Unit declared in test' type=kotlin.Unit origin=EQ - $receiver: TYPE_OP type=test.C origin=IMPLICIT_CAST typeOperand=test.C - GET_VAR 'val tmp_3: test.C? [val] declared in test.testProperty' type=test.C? origin=null + $receiver: GET_VAR 'val tmp_3: test.C? [val] declared in test.testProperty' type=test.C? origin=null value: CALL 'public final fun inc (): kotlin.Int? [operator] declared in test' type=kotlin.Int? origin=null $receiver: GET_VAR 'val tmp_1: kotlin.Int? [val] declared in test.testProperty' type=kotlin.Int? origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit @@ -112,8 +109,7 @@ FILE fqName:test fileName:/safeCallWithIncrementDecrement.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public final fun (): kotlin.Int declared in test' type=kotlin.Int origin=GET_PROPERTY - $receiver: TYPE_OP type=test.C origin=IMPLICIT_CAST typeOperand=test.C - GET_VAR 'val tmp_5: test.C? [val] declared in test.testArrayAccess' type=test.C? origin=null + $receiver: GET_VAR 'val tmp_5: test.C? [val] declared in test.testArrayAccess' type=test.C? origin=null VAR IR_TEMPORARY_VARIABLE name:tmp_6 type:kotlin.Int [val] CONST Int type=kotlin.Int value=0 VAR IR_TEMPORARY_VARIABLE name:tmp_7 type:kotlin.Int [val] diff --git a/compiler/testData/ir/irText/expressions/safeCalls.fir.kt.txt b/compiler/testData/ir/irText/expressions/safeCalls.fir.kt.txt index 8cd5ff12e05..9805859fa15 100644 --- a/compiler/testData/ir/irText/expressions/safeCalls.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/safeCalls.fir.kt.txt @@ -24,7 +24,7 @@ fun test1(x: String?): Int? { val tmp0_safe_receiver: String? = x when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - else -> tmp0_safe_receiver /*as String */.() + else -> tmp0_safe_receiver.() } } } @@ -34,7 +34,7 @@ fun test2(x: String?): Int? { val tmp1_safe_receiver: String? = x when { EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null - else -> tmp1_safe_receiver /*as String */.hashCode() + else -> tmp1_safe_receiver.hashCode() } } } @@ -44,7 +44,7 @@ fun test3(x: String?, y: Any?): Boolean? { val tmp2_safe_receiver: String? = x when { EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null - else -> tmp2_safe_receiver /*as String */.equals(other = y) + else -> tmp2_safe_receiver.equals(other = y) } } } @@ -54,7 +54,7 @@ fun test4(x: Ref?) { val tmp3_safe_receiver: Ref? = x when { EQEQ(arg0 = tmp3_safe_receiver, arg1 = null) -> null - else -> tmp3_safe_receiver /*as Ref */.( = 0) + else -> tmp3_safe_receiver.( = 0) } } /*~> Unit */ } @@ -64,7 +64,7 @@ fun IHost.test5(s: String?): Int? { val tmp4_safe_receiver: String? = s when { EQEQ(arg0 = tmp4_safe_receiver, arg1 = null) -> null - else -> (, tmp4_safe_receiver /*as String */).extLength() + else -> (, tmp4_safe_receiver).extLength() } } } diff --git a/compiler/testData/ir/irText/expressions/safeCalls.fir.txt b/compiler/testData/ir/irText/expressions/safeCalls.fir.txt index 8bdfebd4780..89b6504723b 100644 --- a/compiler/testData/ir/irText/expressions/safeCalls.fir.txt +++ b/compiler/testData/ir/irText/expressions/safeCalls.fir.txt @@ -76,8 +76,7 @@ FILE fqName: fileName:/safeCalls.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public open fun (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY - $this: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String - GET_VAR 'val tmp_0: kotlin.String? [val] declared in .test1' type=kotlin.String? origin=null + $this: GET_VAR 'val tmp_0: kotlin.String? [val] declared in .test1' type=kotlin.String? origin=null FUN name:test2 visibility:public modality:FINAL <> (x:kotlin.String?) returnType:kotlin.Int? VALUE_PARAMETER name:x index:0 type:kotlin.String? BLOCK_BODY @@ -94,8 +93,7 @@ FILE fqName: fileName:/safeCalls.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.String' type=kotlin.Int origin=null - $this: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String - GET_VAR 'val tmp_1: kotlin.String? [val] declared in .test2' type=kotlin.String? origin=null + $this: GET_VAR 'val tmp_1: kotlin.String? [val] declared in .test2' type=kotlin.String? origin=null FUN name:test3 visibility:public modality:FINAL <> (x:kotlin.String?, y:kotlin.Any?) returnType:kotlin.Boolean? VALUE_PARAMETER name:x index:0 type:kotlin.String? VALUE_PARAMETER name:y index:1 type:kotlin.Any? @@ -113,8 +111,7 @@ FILE fqName: fileName:/safeCalls.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in kotlin.String' type=kotlin.Boolean origin=null - $this: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String - GET_VAR 'val tmp_2: kotlin.String? [val] declared in .test3' type=kotlin.String? origin=null + $this: GET_VAR 'val tmp_2: kotlin.String? [val] declared in .test3' type=kotlin.String? origin=null other: GET_VAR 'y: kotlin.Any? declared in .test3' type=kotlin.Any? origin=null FUN name:test4 visibility:public modality:FINAL <> (x:.Ref?) returnType:kotlin.Unit VALUE_PARAMETER name:x index:0 type:.Ref? @@ -132,8 +129,7 @@ FILE fqName: fileName:/safeCalls.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public final fun (: kotlin.Int): kotlin.Unit declared in .Ref' type=kotlin.Unit origin=EQ - $this: TYPE_OP type=.Ref origin=IMPLICIT_CAST typeOperand=.Ref - GET_VAR 'val tmp_3: .Ref? [val] declared in .test4' type=.Ref? origin=null + $this: GET_VAR 'val tmp_3: .Ref? [val] declared in .test4' type=.Ref? origin=null : 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 @@ -153,8 +149,7 @@ FILE fqName: fileName:/safeCalls.kt if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public open fun extLength (): kotlin.Int declared in .IHost' type=kotlin.Int origin=null $this: GET_VAR ': .IHost declared in .test5' type=.IHost origin=null - $receiver: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String - GET_VAR 'val tmp_4: kotlin.String? [val] declared in .test5' type=kotlin.String? origin=null + $receiver: GET_VAR 'val tmp_4: kotlin.String? [val] declared in .test5' type=kotlin.String? origin=null FUN name:foo visibility:public modality:FINAL <> ($receiver:kotlin.Int) returnType:kotlin.Int $receiver: VALUE_PARAMETER name: type:kotlin.Int BLOCK_BODY diff --git a/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.kt.txt b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.kt.txt index 32933809ff1..8019c9ab30b 100644 --- a/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.kt.txt @@ -17,7 +17,7 @@ open enum class En : Enum { val tmp0_safe_receiver: Any? = () when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - else -> tmp0_safe_receiver /*as Any */.toString() + else -> tmp0_safe_receiver.toString() } }) diff --git a/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.txt b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.txt index bc50c00adb8..033ae4b5121 100644 --- a/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.txt +++ b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.txt @@ -42,8 +42,7 @@ FILE fqName: fileName:/temporaryInEnumEntryInitializer.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null - $this: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any - GET_VAR 'val tmp_0: kotlin.Any? [val] declared in .En' type=kotlin.Any? origin=null + $this: GET_VAR 'val tmp_0: kotlin.Any? [val] declared in .En' type=kotlin.Any? origin=null FUN ENUM_CLASS_SPECIAL_MEMBER name:values visibility:public modality:FINAL <> () returnType:kotlin.Array<.En> SYNTHETIC_BODY kind=ENUM_VALUES FUN ENUM_CLASS_SPECIAL_MEMBER name:valueOf visibility:public modality:FINAL <> (value:kotlin.String) returnType:.En diff --git a/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt b/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt index 9d183ecd8b8..b5161ea7d1e 100644 --- a/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt +++ b/compiler/testData/ir/irText/expressions/temporaryInInitBlock.kt.txt @@ -13,7 +13,7 @@ class C { val tmp0_safe_receiver: Any? = x when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - else -> tmp0_safe_receiver /*as Any */.toString() + else -> tmp0_safe_receiver.toString() } } } diff --git a/compiler/testData/ir/irText/expressions/temporaryInInitBlock.txt b/compiler/testData/ir/irText/expressions/temporaryInInitBlock.txt index 10826774f71..842752aa6d2 100644 --- a/compiler/testData/ir/irText/expressions/temporaryInInitBlock.txt +++ b/compiler/testData/ir/irText/expressions/temporaryInInitBlock.txt @@ -31,8 +31,7 @@ FILE fqName: fileName:/temporaryInInitBlock.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null - $this: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any - GET_VAR 'val tmp_0: kotlin.Any? [val] declared in .C' type=kotlin.Any? origin=null + $this: GET_VAR 'val tmp_0: kotlin.Any? [val] declared in .C' type=kotlin.Any? origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any diff --git a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.fir.kt.txt b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.fir.kt.txt index 6986fd4fc10..d26d3800122 100644 --- a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.fir.kt.txt @@ -23,12 +23,12 @@ fun test4(ns: String?): String? { val tmp0_safe_receiver: String? = ns when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - else -> tmp0_safe_receiver /*as String */.k() + else -> tmp0_safe_receiver.k() } } when { EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null - else -> tmp1_safe_receiver /*as Function0 */.invoke() + else -> tmp1_safe_receiver.invoke() } } } diff --git a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.fir.txt b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.fir.txt index 2fda803593a..7ba641b6e3a 100644 --- a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.fir.txt +++ b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.fir.txt @@ -45,8 +45,7 @@ FILE fqName: fileName:/variableAsFunctionCall.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public final fun k (): kotlin.Function0 declared in ' type=kotlin.Function0 origin=null - $receiver: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String - GET_VAR 'val tmp_1: kotlin.String? [val] declared in .test4' type=kotlin.String? origin=null + $receiver: GET_VAR 'val tmp_1: kotlin.String? [val] declared in .test4' type=kotlin.String? origin=null WHEN type=kotlin.String? 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 @@ -56,5 +55,4 @@ FILE fqName: fileName:/variableAsFunctionCall.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public abstract fun invoke (): R of kotlin.Function0 [operator] declared in kotlin.Function0' type=kotlin.String origin=INVOKE - $this: TYPE_OP type=kotlin.Function0 origin=IMPLICIT_CAST typeOperand=kotlin.Function0 - GET_VAR 'val tmp_0: kotlin.Function0? [val] declared in .test4' type=kotlin.Function0? origin=null + $this: GET_VAR 'val tmp_0: kotlin.Function0? [val] declared in .test4' type=kotlin.Function0? origin=null diff --git a/compiler/testData/ir/irText/expressions/when.fir.kt.txt b/compiler/testData/ir/irText/expressions/when.fir.kt.txt index b29edd7691a..2df62c95bd2 100644 --- a/compiler/testData/ir/irText/expressions/when.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/when.fir.kt.txt @@ -24,9 +24,9 @@ fun testWithSubject(x: Any?): String { fun test(x: Any?): String { return when { EQEQ(arg0 = x, arg1 = null) -> "null" - EQEQ(arg0 = x /*as Any */, arg1 = A) -> "A" - x /*as Any */ is String -> "String" - x /*as Any */ !is Number -> "!Number" + EQEQ(arg0 = x, arg1 = A) -> "A" + x is String -> "String" + x !is Number -> "!Number" setOf().contains(element = x /*as Number */) -> "nothingness?" else -> "something" } diff --git a/compiler/testData/ir/irText/expressions/when.fir.txt b/compiler/testData/ir/irText/expressions/when.fir.txt index f57c1e163b2..8011d00f0d7 100644 --- a/compiler/testData/ir/irText/expressions/when.fir.txt +++ b/compiler/testData/ir/irText/expressions/when.fir.txt @@ -66,19 +66,16 @@ FILE fqName: fileName:/when.kt then: CONST String type=kotlin.String value="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: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any - GET_VAR 'x: kotlin.Any? declared in .test' type=kotlin.Any? origin=null + arg0: GET_VAR 'x: kotlin.Any? declared in .test' type=kotlin.Any? origin=null arg1: GET_OBJECT 'CLASS OBJECT name:A modality:FINAL visibility:public superTypes:[kotlin.Any]' type=.A then: CONST String type=kotlin.String value="A" BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.String - TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any - GET_VAR 'x: kotlin.Any? declared in .test' type=kotlin.Any? origin=null + GET_VAR 'x: kotlin.Any? declared in .test' type=kotlin.Any? origin=null then: CONST String type=kotlin.String value="String" BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Number - TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any - GET_VAR 'x: kotlin.Any? declared in .test' type=kotlin.Any? origin=null + GET_VAR 'x: kotlin.Any? declared in .test' type=kotlin.Any? origin=null then: CONST String type=kotlin.String value="!Number" BRANCH if: CALL 'public final fun contains (element: T of kotlin.collections.CollectionsKt.contains): kotlin.Boolean [operator] declared in kotlin.collections.CollectionsKt' type=kotlin.Boolean origin=null diff --git a/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.fir.kt.txt b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.fir.kt.txt index fa763a44d20..c23e32d63c5 100644 --- a/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.fir.kt.txt +++ b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.fir.kt.txt @@ -53,7 +53,7 @@ fun resolveClashesIfAny(container: ComponentContainer, clashResolvers: List: Collection? = ().get(p0 = resolver.()) as? Collection when { EQEQ(arg0 = , arg1 = null) -> continue - else -> /*as Collection */ + else -> } } val substituteDescriptor: ClashResolutionDescriptor>>>>> = ClashResolutionDescriptor>>>>>(container = container, resolver = resolver, clashedComponents = clashedComponents.toList()) diff --git a/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.fir.txt b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.fir.txt index e67870b6bbb..074f31191fa 100644 --- a/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.fir.txt +++ b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.fir.txt @@ -164,8 +164,7 @@ FILE fqName: fileName:/ClashResolutionDescriptor.kt then: CONTINUE label=null loop.label=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: TYPE_OP type=kotlin.collections.Collection<.ComponentDescriptor> origin=IMPLICIT_CAST typeOperand=kotlin.collections.Collection<.ComponentDescriptor> - GET_VAR 'val tmp_1: kotlin.collections.Collection<.ComponentDescriptor>? [val] declared in .resolveClashesIfAny' type=kotlin.collections.Collection<.ComponentDescriptor>? origin=null + then: GET_VAR 'val tmp_1: kotlin.collections.Collection<.ComponentDescriptor>? [val] declared in .resolveClashesIfAny' type=kotlin.collections.Collection<.ComponentDescriptor>? origin=null VAR name:substituteDescriptor type:.ClashResolutionDescriptor.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension>>>>> [val] CONSTRUCTOR_CALL 'public constructor (container: .ComponentContainer, resolver: .PlatformExtensionsClashResolver.ClashResolutionDescriptor>, clashedComponents: kotlin.collections.List<.ComponentDescriptor>) [primary] declared in .ClashResolutionDescriptor' type=.ClashResolutionDescriptor.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension>>>>> origin=null : .PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension>>>> diff --git a/compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.fir.kt.txt b/compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.fir.kt.txt index a6275eb4f88..31d5a81df78 100644 --- a/compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.fir.kt.txt +++ b/compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.fir.kt.txt @@ -79,7 +79,7 @@ fun box(): String { val tmp0_safe_receiver: ImplicitReceiverValue<*>? = stack.get(name = null) when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - else -> tmp0_safe_receiver /*as ImplicitReceiverValue<*> */.() + else -> tmp0_safe_receiver.() } }) } diff --git a/compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.fir.txt b/compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.fir.txt index 6dd76dc95a5..06ec0dfc0fe 100644 --- a/compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.fir.txt +++ b/compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.fir.txt @@ -249,5 +249,4 @@ FILE fqName: fileName:/ImplicitReceiverStack.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public final fun (): kotlin.String declared in .ImplicitReceiverValue' type=kotlin.String origin=GET_PROPERTY - $this: TYPE_OP type=.ImplicitReceiverValue<*> origin=IMPLICIT_CAST typeOperand=.ImplicitReceiverValue<*> - GET_VAR 'val tmp_0: .ImplicitReceiverValue<*>? [val] declared in .box' type=.ImplicitReceiverValue<*>? origin=null + $this: GET_VAR 'val tmp_0: .ImplicitReceiverValue<*>? [val] declared in .box' type=.ImplicitReceiverValue<*>? origin=null diff --git a/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.fir.kt.txt b/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.fir.kt.txt index c5165983793..9ee70479d91 100644 --- a/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.fir.kt.txt +++ b/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.fir.kt.txt @@ -10,7 +10,7 @@ private fun Reader.nextChar(): Char? { ) when { EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null - else -> tmp0_safe_receiver /*as Int */.toChar() + else -> tmp0_safe_receiver.toChar() } } } @@ -18,21 +18,21 @@ private fun Reader.nextChar(): Char? { fun Reader.consumeRestOfQuotedSequence(sb: StringBuilder, quote: Char) { var ch: Char? = .nextChar() while (when { - EQEQ(arg0 = ch, arg1 = null).not() -> EQEQ(arg0 = ch /*as Char */, arg1 = quote).not() + EQEQ(arg0 = ch, arg1 = null).not() -> EQEQ(arg0 = ch, arg1 = quote).not() else -> false }) { // BLOCK when { - EQEQ(arg0 = ch /*as Char */, arg1 = ()) -> { // BLOCK + EQEQ(arg0 = ch, arg1 = ()) -> { // BLOCK val tmp1_safe_receiver: Char? = .nextChar() when { EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null - else -> tmp1_safe_receiver /*as Char */.let(block = local fun (it: Char): StringBuilder? { + else -> tmp1_safe_receiver.let(block = local fun (it: Char): StringBuilder? { return sb.append(p0 = it) } ) } } - else -> sb.append(p0 = ch /*as Char */) + else -> sb.append(p0 = ch) } /*~> Unit */ ch = .nextChar() } diff --git a/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.fir.txt b/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.fir.txt index 197ac7adb75..6ac9386d126 100644 --- a/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.fir.txt +++ b/compiler/testData/ir/irText/firProblems/coercionToUnitForNestedWhen.fir.txt @@ -35,8 +35,7 @@ FILE fqName: fileName:/coercionToUnitForNestedWhen.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public open fun toChar (): kotlin.Char declared in kotlin.Int' type=kotlin.Char origin=null - $this: TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int - GET_VAR 'val tmp_0: kotlin.Int? [val] declared in .nextChar' type=kotlin.Int? origin=null + $this: GET_VAR 'val tmp_0: kotlin.Int? [val] declared in .nextChar' type=kotlin.Int? origin=null FUN name:consumeRestOfQuotedSequence visibility:public modality:FINAL <> ($receiver:java.io.Reader, sb:java.lang.StringBuilder, quote:kotlin.Char) returnType:kotlin.Unit $receiver: VALUE_PARAMETER name: type:java.io.Reader VALUE_PARAMETER name:sb index:0 type:java.lang.StringBuilder @@ -54,8 +53,7 @@ FILE fqName: fileName:/coercionToUnitForNestedWhen.kt arg1: CONST Null type=kotlin.Nothing? value=null then: CALL 'public final fun not (): kotlin.Boolean [operator] 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: TYPE_OP type=kotlin.Char origin=IMPLICIT_CAST typeOperand=kotlin.Char - GET_VAR 'var ch: kotlin.Char? [var] declared in .consumeRestOfQuotedSequence' type=kotlin.Char? origin=null + arg0: GET_VAR 'var ch: kotlin.Char? [var] declared in .consumeRestOfQuotedSequence' type=kotlin.Char? origin=null arg1: GET_VAR 'quote: kotlin.Char declared in .consumeRestOfQuotedSequence' type=kotlin.Char origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -65,8 +63,7 @@ FILE fqName: fileName:/coercionToUnitForNestedWhen.kt WHEN type=@[FlexibleNullability] java.lang.StringBuilder? 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: TYPE_OP type=kotlin.Char origin=IMPLICIT_CAST typeOperand=kotlin.Char - GET_VAR 'var ch: kotlin.Char? [var] declared in .consumeRestOfQuotedSequence' type=kotlin.Char? origin=null + arg0: GET_VAR 'var ch: kotlin.Char? [var] declared in .consumeRestOfQuotedSequence' type=kotlin.Char? origin=null arg1: CALL 'private final fun (): kotlin.Char declared in ' type=kotlin.Char origin=GET_PROPERTY then: BLOCK type=java.lang.StringBuilder? origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Char? [val] @@ -83,8 +80,7 @@ FILE fqName: fileName:/coercionToUnitForNestedWhen.kt then: CALL 'public final fun let (block: kotlin.Function1): R of kotlin.StandardKt.let [inline] declared in kotlin.StandardKt' type=java.lang.StringBuilder? origin=null : kotlin.Char : java.lang.StringBuilder? - $receiver: TYPE_OP type=kotlin.Char origin=IMPLICIT_CAST typeOperand=kotlin.Char - GET_VAR 'val tmp_1: kotlin.Char? [val] declared in .consumeRestOfQuotedSequence' type=kotlin.Char? origin=null + $receiver: GET_VAR 'val tmp_1: kotlin.Char? [val] declared in .consumeRestOfQuotedSequence' type=kotlin.Char? origin=null block: FUN_EXPR type=kotlin.Function1 origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:kotlin.Char) returnType:java.lang.StringBuilder? VALUE_PARAMETER name:it index:0 type:kotlin.Char @@ -97,8 +93,7 @@ FILE fqName: fileName:/coercionToUnitForNestedWhen.kt if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'public open fun append (p0: kotlin.Char): java.lang.StringBuilder? declared in java.lang.StringBuilder' type=java.lang.StringBuilder? origin=null $this: GET_VAR 'sb: java.lang.StringBuilder declared in .consumeRestOfQuotedSequence' type=java.lang.StringBuilder origin=null - p0: TYPE_OP type=kotlin.Char origin=IMPLICIT_CAST typeOperand=kotlin.Char - GET_VAR 'var ch: kotlin.Char? [var] declared in .consumeRestOfQuotedSequence' type=kotlin.Char? origin=null + p0: GET_VAR 'var ch: kotlin.Char? [var] declared in .consumeRestOfQuotedSequence' type=kotlin.Char? origin=null SET_VAR 'var ch: kotlin.Char? [var] declared in .consumeRestOfQuotedSequence' type=kotlin.Unit origin=EQ CALL 'private final fun nextChar (): kotlin.Char? declared in ' type=kotlin.Char? origin=null $receiver: GET_VAR ': java.io.Reader declared in .consumeRestOfQuotedSequence' type=java.io.Reader origin=null diff --git a/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.kt.txt b/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.kt.txt index 7537cea0936..d0e513e1ce4 100644 --- a/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.kt.txt +++ b/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.kt.txt @@ -23,10 +23,10 @@ class Flaf { result = Flaf(javaName = javaName) } } - .().set(key = javaName, value = result /*as Flaf */) + .().set(key = javaName, value = result) } } - return result /*as Flaf */ + return result } } diff --git a/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.txt b/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.txt index 40d4e6eb48f..d9583317f9e 100644 --- a/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.txt +++ b/compiler/testData/ir/irText/firProblems/inapplicableCollectionSet.fir.txt @@ -68,11 +68,9 @@ FILE fqName: fileName:/inapplicableCollectionSet.kt $receiver: CALL 'private final fun (): kotlin.collections.MutableMap.Flaf> declared in .Flaf' type=kotlin.collections.MutableMap.Flaf> origin=GET_PROPERTY $this: GET_VAR ': .Flaf declared in .Flaf.forJavaName' type=.Flaf origin=null key: GET_VAR 'javaName: kotlin.String declared in .Flaf.forJavaName' type=kotlin.String origin=null - value: TYPE_OP type=.Flaf origin=IMPLICIT_CAST typeOperand=.Flaf - GET_VAR 'var result: .Flaf? [var] declared in .Flaf.forJavaName' type=.Flaf? origin=null + value: GET_VAR 'var result: .Flaf? [var] declared in .Flaf.forJavaName' type=.Flaf? origin=null RETURN type=kotlin.Nothing from='public final fun forJavaName (javaName: kotlin.String): .Flaf declared in .Flaf' - TYPE_OP type=.Flaf origin=IMPLICIT_CAST typeOperand=.Flaf - GET_VAR 'var result: .Flaf? [var] declared in .Flaf.forJavaName' type=.Flaf? origin=null + GET_VAR 'var result: .Flaf? [var] declared in .Flaf.forJavaName' type=.Flaf? origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any diff --git a/compiler/testData/ir/irText/firProblems/readWriteProperty.fir.kt.txt b/compiler/testData/ir/irText/firProblems/readWriteProperty.fir.kt.txt index 72f6380c202..2dbbd701b66 100644 --- a/compiler/testData/ir/irText/firProblems/readWriteProperty.fir.kt.txt +++ b/compiler/testData/ir/irText/firProblems/readWriteProperty.fir.kt.txt @@ -59,8 +59,8 @@ class IdeWizard { when { EQEQ(arg0 = value, arg1 = null) -> return Unit } - reference.( = SettingType(type = value /*as V */::class) as T) - reference.( = value /*as V */) + reference.( = SettingType(type = value::class) as T) + reference.( = value) } override operator fun getValue(thisRef: Any?, property: KProperty<*>): V? { diff --git a/compiler/testData/ir/irText/firProblems/readWriteProperty.fir.txt b/compiler/testData/ir/irText/firProblems/readWriteProperty.fir.txt index c7de57617e9..01d05d7d1cb 100644 --- a/compiler/testData/ir/irText/firProblems/readWriteProperty.fir.txt +++ b/compiler/testData/ir/irText/firProblems/readWriteProperty.fir.txt @@ -169,12 +169,10 @@ FILE fqName: fileName:/readWriteProperty.kt CONSTRUCTOR_CALL 'public constructor (type: kotlin.reflect.KClass.SettingType>) [primary] declared in .SettingType' type=.SettingType.IdeWizard.setting> origin=null : V of .IdeWizard.setting type: GET_CLASS type=kotlin.reflect.KClass.IdeWizard.setting> - TYPE_OP type=V of .IdeWizard.setting origin=IMPLICIT_CAST typeOperand=V of .IdeWizard.setting - GET_VAR 'value: V of .IdeWizard.setting? declared in .IdeWizard.setting..setValue' type=V of .IdeWizard.setting? origin=null + GET_VAR 'value: V of .IdeWizard.setting? declared in .IdeWizard.setting..setValue' type=V of .IdeWizard.setting? origin=null CALL 'public final fun (: V of .SettingReference): kotlin.Unit declared in .SettingReference' type=kotlin.Unit origin=EQ $this: GET_VAR 'reference: .SettingReference.IdeWizard.setting, T of .IdeWizard.setting> declared in .IdeWizard.setting' type=.SettingReference.IdeWizard.setting, T of .IdeWizard.setting> origin=null - : TYPE_OP type=V of .IdeWizard.setting origin=IMPLICIT_CAST typeOperand=V of .IdeWizard.setting - GET_VAR 'value: V of .IdeWizard.setting? declared in .IdeWizard.setting..setValue' type=V of .IdeWizard.setting? origin=null + : GET_VAR 'value: V of .IdeWizard.setting? declared in .IdeWizard.setting..setValue' type=V of .IdeWizard.setting? origin=null FUN name:getValue visibility:public modality:FINAL <> ($this:.IdeWizard.setting..IdeWizard.setting, T of .IdeWizard.setting>, thisRef:kotlin.Any?, property:kotlin.reflect.KProperty<*>) returnType:V of .IdeWizard.setting? [operator] overridden: public abstract fun getValue (thisRef: T of kotlin.properties.ReadWriteProperty, property: kotlin.reflect.KProperty<*>): V of kotlin.properties.ReadWriteProperty [operator] declared in kotlin.properties.ReadWriteProperty diff --git a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.kt.txt b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.kt.txt index de21f64cb90..20df7d23208 100644 --- a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.kt.txt +++ b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.kt.txt @@ -42,7 +42,7 @@ private fun CoroutineScope.asFairChannel(flow: Flow<*>): ReceiveChannel { val : Any? = value when { EQEQ(arg0 = , arg1 = null) -> Any() - else -> /*as Any */ + else -> } }) } @@ -58,7 +58,7 @@ private fun CoroutineScope.asChannel(flow: Flow<*>): ReceiveChannel { val : Any? = value when { EQEQ(arg0 = , arg1 = null) -> Any() - else -> /*as Any */ + else -> } }) } @@ -141,4 +141,3 @@ interface SendChannel { abstract suspend fun send(e: E) } - diff --git a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.txt b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.txt index b74e4cd4ea0..3000008ef91 100644 --- a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.txt +++ b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.txt @@ -114,8 +114,7 @@ FILE fqName: fileName:/castsInsideCoroutineInference.kt then: CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any - GET_VAR 'val tmp_0: kotlin.Any? [val] declared in .asFairChannel..' type=kotlin.Any? origin=null + then: GET_VAR 'val tmp_0: kotlin.Any? [val] declared in .asFairChannel..' type=kotlin.Any? origin=null FUN name:asChannel visibility:private modality:FINAL <> ($receiver:.CoroutineScope, flow:.Flow<*>) returnType:.ReceiveChannel $receiver: VALUE_PARAMETER name: type:.CoroutineScope VALUE_PARAMETER name:flow index:0 type:.Flow<*> @@ -150,8 +149,7 @@ FILE fqName: fileName:/castsInsideCoroutineInference.kt then: CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any - GET_VAR 'val tmp_1: kotlin.Any? [val] declared in .asChannel..' type=kotlin.Any? origin=null + then: GET_VAR 'val tmp_1: kotlin.Any? [val] declared in .asChannel..' type=kotlin.Any? origin=null CLASS CLASS name:SafeCollector modality:FINAL visibility:public superTypes:[.FlowCollector.SafeCollector>] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.SafeCollector.SafeCollector> TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]