FIR2IR: Fix complex cases of smart cast expressions used as dispatch receiver

It might be not only <ExpressionWithSmartCast>(a).foo(), but also
id(<ExpressionWithSmartCast>(a)).foo() and many other cases
This commit is contained in:
Denis.Zharkov
2021-01-27 19:51:14 +03:00
parent b3b1eb57ae
commit 5c62ee4ba8
45 changed files with 193 additions and 91 deletions
@@ -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.hashCode()
else -> tmp0_safe_receiver /*as Any */.hashCode()
}
})
}
+2 -1
View File
@@ -24,7 +24,8 @@ FILE fqName:<root> 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: GET_VAR 'val tmp_0: kotlin.Any? [val] declared in <root>.test2' type=kotlin.Any? origin=null
$this: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
GET_VAR 'val tmp_0: kotlin.Any? [val] declared in <root>.test2' type=kotlin.Any? origin=null
FUN name:test3 visibility:public modality:FINAL <X> (a:X of <root>.test3) returnType:X of <root>.test3
TYPE_PARAMETER name:X index:0 variance: superTypes:[kotlin.Any?]
VALUE_PARAMETER name:a index:0 type:X of <root>.test3
@@ -23,23 +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.foo()
else -> tmp0_safe_receiver /*as C */.foo()
}
}
when {
EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null
else -> tmp1_safe_receiver.bar()
else -> tmp1_safe_receiver /*as C */.bar()
}
}
when {
EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null
else -> tmp2_safe_receiver.foo()
else -> tmp2_safe_receiver /*as C */.foo()
}
}
when {
EQEQ(arg0 = tmp3_safe_receiver, arg1 = null) -> null
else -> tmp3_safe_receiver.foo()
else -> tmp3_safe_receiver /*as C */.foo()
}
}
}
@@ -50,7 +50,8 @@ FILE fqName:<root> fileName:/chainOfSafeCalls.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun foo (): <root>.C declared in <root>.C' type=<root>.C origin=null
$this: GET_VAR 'val tmp_3: <root>.C? [val] declared in <root>.test' type=<root>.C? origin=null
$this: TYPE_OP type=<root>.C origin=IMPLICIT_CAST typeOperand=<root>.C
GET_VAR 'val tmp_3: <root>.C? [val] declared in <root>.test' type=<root>.C? origin=null
WHEN type=<root>.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
@@ -60,7 +61,8 @@ FILE fqName:<root> fileName:/chainOfSafeCalls.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun bar (): <root>.C? declared in <root>.C' type=<root>.C? origin=null
$this: GET_VAR 'val tmp_2: <root>.C? [val] declared in <root>.test' type=<root>.C? origin=null
$this: TYPE_OP type=<root>.C origin=IMPLICIT_CAST typeOperand=<root>.C
GET_VAR 'val tmp_2: <root>.C? [val] declared in <root>.test' type=<root>.C? origin=null
WHEN type=<root>.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
@@ -70,7 +72,8 @@ FILE fqName:<root> fileName:/chainOfSafeCalls.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun foo (): <root>.C declared in <root>.C' type=<root>.C origin=null
$this: GET_VAR 'val tmp_1: <root>.C? [val] declared in <root>.test' type=<root>.C? origin=null
$this: TYPE_OP type=<root>.C origin=IMPLICIT_CAST typeOperand=<root>.C
GET_VAR 'val tmp_1: <root>.C? [val] declared in <root>.test' type=<root>.C? origin=null
WHEN type=<root>.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
@@ -80,4 +83,5 @@ FILE fqName:<root> fileName:/chainOfSafeCalls.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun foo (): <root>.C declared in <root>.C' type=<root>.C origin=null
$this: GET_VAR 'val tmp_0: <root>.C? [val] declared in <root>.test' type=<root>.C? origin=null
$this: TYPE_OP type=<root>.C origin=IMPLICIT_CAST typeOperand=<root>.C
GET_VAR 'val tmp_0: <root>.C? [val] declared in <root>.test' type=<root>.C? origin=null
@@ -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.println(p0 = "Hello,")
else -> tmp0_safe_receiver /*as @FlexibleNullability PrintStream */.println(p0 = "Hello,")
}
} /*~> Unit */
{ // BLOCK
val tmp1_safe_receiver: PrintStream? = #out
when {
EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null
else -> tmp1_safe_receiver.println(p0 = "world!")
else -> tmp1_safe_receiver /*as @FlexibleNullability PrintStream */.println(p0 = "world!")
}
} /*~> Unit */
}
@@ -34,7 +34,8 @@ FILE fqName:<root> 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: GET_VAR 'val tmp_0: java.io.PrintStream? [val] declared in <root>.test3' type=java.io.PrintStream? 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 <root>.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
@@ -49,5 +50,6 @@ FILE fqName:<root> 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: GET_VAR 'val tmp_1: java.io.PrintStream? [val] declared in <root>.test3' type=java.io.PrintStream? 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 <root>.test3' type=java.io.PrintStream? origin=null
p0: CONST String type=kotlin.String value="world!"
@@ -7,8 +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.<get-length>()
else -> tmp0_safe_receiver /*as String */.<get-length>()
}
}
}
+2 -1
View File
@@ -21,4 +21,5 @@ FILE fqName:<root> fileName:/dotQualified.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun <get-length> (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'val tmp_0: kotlin.String? [val] declared in <root>.lengthN' type=kotlin.String? origin=null
$this: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR 'val tmp_0: kotlin.String? [val] declared in <root>.lengthN' type=kotlin.String? origin=null
+2 -2
View File
@@ -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.<get-xs>()
else -> tmp0_safe_receiver /*as X */.<get-xs>()
}
}).plusAssign<Int>(element = 5)
CHECK_NOT_NULL<MutableList<Any>>(arg0 = { // BLOCK
val tmp1_safe_receiver: X? = nx
when {
EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null
else -> tmp1_safe_receiver.f()
else -> tmp1_safe_receiver /*as X */.f()
}
}).plusAssign<Int>(element = 6)
}
+4 -2
View File
@@ -62,7 +62,8 @@ FILE fqName:<root> fileName:/kt30020.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public abstract fun <get-xs> (): kotlin.collections.MutableList<kotlin.Any> declared in <root>.X' type=kotlin.collections.MutableList<kotlin.Any> origin=GET_PROPERTY
$this: GET_VAR 'val tmp_0: <root>.X? [val] declared in <root>.test' type=<root>.X? origin=null
$this: TYPE_OP type=<root>.X origin=IMPLICIT_CAST typeOperand=<root>.X
GET_VAR 'val tmp_0: <root>.X? [val] declared in <root>.test' type=<root>.X? origin=null
element: CONST Int type=kotlin.Int value=5
CALL 'public final fun plusAssign <T> (element: T of kotlin.collections.CollectionsKt.plusAssign): kotlin.Unit [inline,operator] declared in kotlin.collections.CollectionsKt' type=kotlin.Unit origin=null
<T>: kotlin.Int
@@ -80,7 +81,8 @@ FILE fqName:<root> fileName:/kt30020.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public abstract fun f (): kotlin.collections.MutableList<kotlin.Any> declared in <root>.X' type=kotlin.collections.MutableList<kotlin.Any> origin=null
$this: GET_VAR 'val tmp_1: <root>.X? [val] declared in <root>.test' type=<root>.X? origin=null
$this: TYPE_OP type=<root>.X origin=IMPLICIT_CAST typeOperand=<root>.X
GET_VAR 'val tmp_1: <root>.X? [val] declared in <root>.test' type=<root>.X? origin=null
element: CONST Int type=kotlin.Int value=6
FUN name:testExtensionReceiver visibility:public modality:FINAL <> ($receiver:kotlin.collections.MutableList<kotlin.Any>) returnType:kotlin.Unit
$receiver: VALUE_PARAMETER name:<this> type:kotlin.collections.MutableList<kotlin.Any>
@@ -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.<set-x>(<set-?> = 42)
else -> tmp0_safe_receiver /*as C */.<set-x>(<set-?> = 42)
}
} /*~> Unit */
}
@@ -54,5 +54,6 @@ FILE fqName:<root> fileName:/safeAssignment.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun <set-x> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.C' type=kotlin.Unit origin=EQ
$this: GET_VAR 'val tmp_0: <root>.C? [val] declared in <root>.test' type=<root>.C? origin=null
$this: TYPE_OP type=<root>.C origin=IMPLICIT_CAST typeOperand=<root>.C
GET_VAR 'val tmp_0: <root>.C? [val] declared in <root>.test' type=<root>.C? origin=null
<set-?>: CONST Int type=kotlin.Int value=42
@@ -21,7 +21,7 @@ operator fun Int?.inc(): Int? {
val tmp0_safe_receiver: Int? = <this>
when {
EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null
else -> tmp0_safe_receiver.inc()
else -> tmp0_safe_receiver /*as Int */.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.<get-p>()
else -> tmp1_safe_receiver /*as C */.<get-p>()
}
}
{ // BLOCK
val tmp2_safe_receiver: C? = nc
when {
EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null
else -> tmp2_safe_receiver.<set-p>(value = <unary>.inc())
else -> tmp2_safe_receiver /*as C */.<set-p>(value = <unary>.inc())
}
} /*~> Unit */
<unary> /*~> 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.<get-p>()
else -> tmp3_safe_receiver /*as C */.<get-p>()
}
}
val <index0>: Int = 0
@@ -46,7 +46,8 @@ 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: GET_VAR 'val tmp_0: kotlin.Int? [val] declared in test.inc' 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
FUN name:get visibility:public modality:FINAL <> ($receiver:kotlin.Int?, index:kotlin.Int) returnType:kotlin.Int [operator]
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Int?
VALUE_PARAMETER name:index index:0 type:kotlin.Int
@@ -74,7 +75,8 @@ FILE fqName:test fileName:/safeCallWithIncrementDecrement.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun <get-p> (): kotlin.Int declared in test' type=kotlin.Int origin=GET_PROPERTY
$receiver: GET_VAR 'val tmp_2: test.C? [val] declared in test.testProperty' type=test.C? origin=null
$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
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]
@@ -88,7 +90,8 @@ FILE fqName:test fileName:/safeCallWithIncrementDecrement.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun <set-p> (value: kotlin.Int): kotlin.Unit declared in test' type=kotlin.Unit origin=EQ
$receiver: GET_VAR 'val tmp_3: test.C? [val] declared in test.testProperty' type=test.C? origin=null
$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
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
@@ -109,7 +112,8 @@ FILE fqName:test fileName:/safeCallWithIncrementDecrement.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun <get-p> (): kotlin.Int declared in test' type=kotlin.Int origin=GET_PROPERTY
$receiver: GET_VAR 'val tmp_5: test.C? [val] declared in test.testArrayAccess' type=test.C? origin=null
$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
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]
@@ -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.<get-length>()
else -> tmp0_safe_receiver /*as String */.<get-length>()
}
}
}
@@ -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.hashCode()
else -> tmp1_safe_receiver /*as String */.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.equals(other = y)
else -> tmp2_safe_receiver /*as String */.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.<set-value>(<set-?> = 0)
else -> tmp3_safe_receiver /*as Ref */.<set-value>(<set-?> = 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 -> (<this>, tmp4_safe_receiver).extLength()
else -> (<this>, tmp4_safe_receiver /*as String */).extLength()
}
}
}
+10 -5
View File
@@ -76,7 +76,8 @@ FILE fqName:<root> fileName:/safeCalls.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun <get-length> (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'val tmp_0: kotlin.String? [val] declared in <root>.test1' type=kotlin.String? origin=null
$this: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR 'val tmp_0: kotlin.String? [val] declared in <root>.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
@@ -93,7 +94,8 @@ FILE fqName:<root> 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: GET_VAR 'val tmp_1: kotlin.String? [val] declared in <root>.test2' type=kotlin.String? origin=null
$this: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR 'val tmp_1: kotlin.String? [val] declared in <root>.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?
@@ -111,7 +113,8 @@ FILE fqName:<root> 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: GET_VAR 'val tmp_2: kotlin.String? [val] declared in <root>.test3' type=kotlin.String? origin=null
$this: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR 'val tmp_2: kotlin.String? [val] declared in <root>.test3' type=kotlin.String? origin=null
other: GET_VAR 'y: kotlin.Any? declared in <root>.test3' type=kotlin.Any? origin=null
FUN name:test4 visibility:public modality:FINAL <> (x:<root>.Ref?) returnType:kotlin.Unit
VALUE_PARAMETER name:x index:0 type:<root>.Ref?
@@ -129,7 +132,8 @@ FILE fqName:<root> fileName:/safeCalls.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun <set-value> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.Ref' type=kotlin.Unit origin=EQ
$this: GET_VAR 'val tmp_3: <root>.Ref? [val] declared in <root>.test4' type=<root>.Ref? origin=null
$this: TYPE_OP type=<root>.Ref origin=IMPLICIT_CAST typeOperand=<root>.Ref
GET_VAR 'val tmp_3: <root>.Ref? [val] declared in <root>.test4' type=<root>.Ref? origin=null
<set-?>: CONST Int type=kotlin.Int value=0
FUN name:test5 visibility:public modality:FINAL <> ($receiver:<root>.IHost, s:kotlin.String?) returnType:kotlin.Int?
$receiver: VALUE_PARAMETER name:<this> type:<root>.IHost
@@ -149,7 +153,8 @@ FILE fqName:<root> fileName:/safeCalls.kt
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun extLength (): kotlin.Int declared in <root>.IHost' type=kotlin.Int origin=null
$this: GET_VAR '<this>: <root>.IHost declared in <root>.test5' type=<root>.IHost origin=null
$receiver: GET_VAR 'val tmp_4: kotlin.String? [val] declared in <root>.test5' type=kotlin.String? origin=null
$receiver: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR 'val tmp_4: kotlin.String? [val] declared in <root>.test5' type=kotlin.String? origin=null
FUN name:foo visibility:public modality:FINAL <> ($receiver:kotlin.Int) returnType:kotlin.Int
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Int
BLOCK_BODY
@@ -17,7 +17,7 @@ open enum class En : Enum<En> {
val tmp0_safe_receiver: Any? = <get-n>()
when {
EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null
else -> tmp0_safe_receiver.toString()
else -> tmp0_safe_receiver /*as Any */.toString()
}
})
@@ -42,7 +42,8 @@ FILE fqName:<root> 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: GET_VAR 'val tmp_0: kotlin.Any? [val] declared in <root>.En' type=kotlin.Any? origin=null
$this: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
GET_VAR 'val tmp_0: kotlin.Any? [val] declared in <root>.En' type=kotlin.Any? origin=null
FUN ENUM_CLASS_SPECIAL_MEMBER name:values visibility:public modality:FINAL <> () returnType:kotlin.Array<<root>.En>
SYNTHETIC_BODY kind=ENUM_VALUES
FUN ENUM_CLASS_SPECIAL_MEMBER name:valueOf visibility:public modality:FINAL <> (value:kotlin.String) returnType:<root>.En
@@ -13,10 +13,9 @@ class C {
val tmp0_safe_receiver: Any? = x
when {
EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null
else -> tmp0_safe_receiver.toString()
else -> tmp0_safe_receiver /*as Any */.toString()
}
}
}
}
@@ -31,7 +31,8 @@ FILE fqName:<root> 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: GET_VAR 'val tmp_0: kotlin.Any? [val] declared in <root>.C' type=kotlin.Any? origin=null
$this: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
GET_VAR 'val tmp_0: kotlin.Any? [val] declared in <root>.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
@@ -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.k()
else -> tmp0_safe_receiver /*as String */.k()
}
}
when {
EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null
else -> tmp1_safe_receiver.invoke()
else -> tmp1_safe_receiver /*as Function0<String> */.invoke()
}
}
}
@@ -45,7 +45,8 @@ FILE fqName:<root> fileName:/variableAsFunctionCall.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun k (): kotlin.Function0<kotlin.String> declared in <root>' type=kotlin.Function0<kotlin.String> origin=null
$receiver: GET_VAR 'val tmp_1: kotlin.String? [val] declared in <root>.test4' type=kotlin.String? origin=null
$receiver: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR 'val tmp_1: kotlin.String? [val] declared in <root>.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
@@ -55,4 +56,5 @@ FILE fqName:<root> 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: GET_VAR 'val tmp_0: kotlin.Function0<kotlin.String>? [val] declared in <root>.test4' type=kotlin.Function0<kotlin.String>? origin=null
$this: TYPE_OP type=kotlin.Function0<kotlin.String> origin=IMPLICIT_CAST typeOperand=kotlin.Function0<kotlin.String>
GET_VAR 'val tmp_0: kotlin.Function0<kotlin.String>? [val] declared in <root>.test4' type=kotlin.Function0<kotlin.String>? origin=null