Make coercion to Unit explicit in IR.

This commit is contained in:
Dmitry Petrov
2016-09-19 15:59:49 +03:00
committed by Dmitry Petrov
parent 233a979932
commit 1c2a676cd6
22 changed files with 347 additions and 182 deletions
@@ -25,7 +25,7 @@ FILE /argumentReorderingInDelegatingConstructorCall.kt
CLASS CLASS Test1
CONSTRUCTOR public constructor Test1(xx: kotlin.Int, yy: kotlin.Int)
BLOCK_BODY
BLOCK type=Base origin=ARGUMENTS_REORDERING_FOR_CALL
BLOCK type=kotlin.Unit origin=ARGUMENTS_REORDERING_FOR_CALL
VAR IR_TEMPORARY_VARIABLE val tmp0_y: kotlin.Int
GET_VAR 'value-parameter yy: Int' type=kotlin.Int origin=null
VAR IR_TEMPORARY_VARIABLE val tmp1_x: kotlin.Int
@@ -37,7 +37,7 @@ FILE /argumentReorderingInDelegatingConstructorCall.kt
CLASS CLASS Test2
CONSTRUCTOR public constructor Test2(xx: kotlin.Int, yy: kotlin.Int)
BLOCK_BODY
BLOCK type=Base origin=ARGUMENTS_REORDERING_FOR_CALL
BLOCK type=kotlin.Unit origin=ARGUMENTS_REORDERING_FOR_CALL
VAR IR_TEMPORARY_VARIABLE val tmp0_y: kotlin.Int
GET_VAR 'value-parameter yy: Int' type=kotlin.Int origin=null
VAR IR_TEMPORARY_VARIABLE val tmp1_x: kotlin.Int
@@ -48,7 +48,7 @@ FILE /argumentReorderingInDelegatingConstructorCall.kt
INSTANCE_INITIALIZER_CALL classDescriptor='Test2'
CONSTRUCTOR public constructor Test2(xxx: kotlin.Int, yyy: kotlin.Int, a: kotlin.Any)
BLOCK_BODY
BLOCK type=Test2 origin=ARGUMENTS_REORDERING_FOR_CALL
BLOCK type=kotlin.Unit origin=ARGUMENTS_REORDERING_FOR_CALL
VAR IR_TEMPORARY_VARIABLE val tmp0_yy: kotlin.Int
GET_VAR 'value-parameter yyy: Int' type=kotlin.Int origin=null
VAR IR_TEMPORARY_VARIABLE val tmp1_xx: kotlin.Int
@@ -46,16 +46,20 @@ FILE /localDelegatedProperties.kt
thisRef: CONST Null type=kotlin.Nothing? value='null'
property: CALLABLE_REFERENCE 'x: Int' type=kotlin.reflect.KMutableProperty0<kotlin.Int> origin=PROPERTY_REFERENCE_FOR_DELEGATE
value: GET_VAR 'value-parameter value: Int' type=kotlin.Int origin=null
CALL '<set-x>(Int): Int' type=kotlin.Int origin=EQ
value: CONST Int type=kotlin.Int value='0'
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp0: kotlin.Int
CALL '<get-x>(): Int' type=kotlin.Int origin=POSTFIX_INCR
CALL '<set-x>(Int): Int' type=kotlin.Int origin=POSTFIX_INCR
value: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
CALL '<set-x>(Int): Int' type=kotlin.Int origin=PLUSEQ
value: CALL 'plus(Int): Int' type=kotlin.Int origin=PLUSEQ
$this: CALL '<get-x>(): Int' type=kotlin.Int origin=PLUSEQ
other: CONST Int type=kotlin.Int value='1'
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL '<set-x>(Int): Int' type=kotlin.Int origin=EQ
value: CONST Int type=kotlin.Int value='0'
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp0: kotlin.Int
CALL '<get-x>(): Int' type=kotlin.Int origin=POSTFIX_INCR
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL '<set-x>(Int): Int' type=kotlin.Int origin=POSTFIX_INCR
value: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL '<set-x>(Int): Int' type=kotlin.Int origin=PLUSEQ
value: CALL 'plus(Int): Int' type=kotlin.Int origin=PLUSEQ
$this: CALL '<get-x>(): Int' type=kotlin.Int origin=PLUSEQ
other: CONST Int type=kotlin.Int value='1'
@@ -59,19 +59,20 @@ FILE /arrayAugmentedAssignment1.kt
other: CONST Int type=kotlin.Int value='2'
FUN public fun testMember(c: C): kotlin.Unit
BLOCK_BODY
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp0_array: kotlin.IntArray
CALL '<get-x>(): IntArray' type=kotlin.IntArray origin=GET_PROPERTY
$this: GET_VAR 'value-parameter c: C' type=C origin=null
VAR IR_TEMPORARY_VARIABLE val tmp1_index0: kotlin.Int
CONST Int type=kotlin.Int value='0'
VAR IR_TEMPORARY_VARIABLE val tmp2: kotlin.Int
CALL 'get(Int): Int' type=kotlin.Int origin=POSTFIX_INCR
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp0_array: kotlin.IntArray
CALL '<get-x>(): IntArray' type=kotlin.IntArray origin=GET_PROPERTY
$this: GET_VAR 'value-parameter c: C' type=C origin=null
VAR IR_TEMPORARY_VARIABLE val tmp1_index0: kotlin.Int
CONST Int type=kotlin.Int value='0'
VAR IR_TEMPORARY_VARIABLE val tmp2: kotlin.Int
CALL 'get(Int): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp0_array: IntArray' type=kotlin.IntArray origin=null
index: GET_VAR 'tmp1_index0: Int' type=kotlin.Int origin=null
CALL 'set(Int, Int): Unit' type=kotlin.Unit origin=POSTFIX_INCR
$this: GET_VAR 'tmp0_array: IntArray' type=kotlin.IntArray origin=null
index: GET_VAR 'tmp1_index0: Int' type=kotlin.Int origin=null
CALL 'set(Int, Int): Unit' type=kotlin.Unit origin=POSTFIX_INCR
$this: GET_VAR 'tmp0_array: IntArray' type=kotlin.IntArray origin=null
index: GET_VAR 'tmp1_index0: Int' type=kotlin.Int origin=null
value: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp2: Int' type=kotlin.Int origin=null
GET_VAR 'tmp2: Int' type=kotlin.Int origin=null
value: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp2: Int' type=kotlin.Int origin=null
GET_VAR 'tmp2: Int' type=kotlin.Int origin=null
@@ -0,0 +1,12 @@
// +JDK
val test1: () -> Unit = { 42 }
fun test2(mc: MutableCollection<String>) {
mc.add("")
}
fun test3() {
System.out?.println("Hello,")
System.out?.println("world!")
}
@@ -0,0 +1,49 @@
FILE /coercionToUnit.kt
PROPERTY public val test1: () -> kotlin.Unit
FIELD PROPERTY_BACKING_FIELD public val test1: () -> kotlin.Unit
EXPRESSION_BODY
BLOCK type=() -> kotlin.Unit origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun <anonymous>(): kotlin.Unit
BLOCK_BODY
RETURN type=kotlin.Nothing from='<anonymous>(): Unit'
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CONST Int type=kotlin.Int value='42'
CALLABLE_REFERENCE '<anonymous>(): Unit' type=() -> kotlin.Unit origin=LAMBDA
FUN DEFAULT_PROPERTY_ACCESSOR public fun <get-test1>(): () -> kotlin.Unit
BLOCK_BODY
RETURN type=kotlin.Nothing from='<get-test1>(): () -> Unit'
GET_FIELD 'test1: () -> Unit' type=() -> kotlin.Unit origin=null
FUN public fun test2(mc: kotlin.collections.MutableCollection<kotlin.String>): kotlin.Unit
BLOCK_BODY
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'add(String): Boolean' type=kotlin.Boolean origin=null
$this: GET_VAR 'value-parameter mc: MutableCollection<String>' type=kotlin.collections.MutableCollection<kotlin.String> origin=null
element: CONST String type=kotlin.String value=''
FUN public fun test3(): kotlin.Unit
BLOCK_BODY
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Unit? origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: java.io.PrintStream!
GET_FIELD 'out: PrintStream!' type=java.io.PrintStream! origin=GET_PROPERTY
WHEN type=kotlin.Unit? origin=SAFE_CALL
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: PrintStream!' type=java.io.PrintStream! origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
else: CALL 'println(String!): Unit' type=kotlin.Unit origin=null
$this: TYPE_OP origin=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream
GET_VAR 'tmp0_safe_receiver: PrintStream!' type=java.io.PrintStream! origin=null
p0: CONST String type=kotlin.String value='Hello,'
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Unit? origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE val tmp1_safe_receiver: java.io.PrintStream!
GET_FIELD 'out: PrintStream!' type=java.io.PrintStream! origin=GET_PROPERTY
WHEN type=kotlin.Unit? origin=SAFE_CALL
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp1_safe_receiver: PrintStream!' type=java.io.PrintStream! origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
else: CALL 'println(String!): Unit' type=kotlin.Unit origin=null
$this: TYPE_OP origin=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream
GET_VAR 'tmp1_safe_receiver: PrintStream!' type=java.io.PrintStream! origin=null
p0: CONST String type=kotlin.String value='world!'
@@ -60,65 +60,69 @@ FILE /complexAugmentedAssignment.kt
BLOCK_BODY
VAR var i: kotlin.Int
CONST Int type=kotlin.Int value='0'
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp1_array: kotlin.IntArray
GET_VAR 'value-parameter a: IntArray' type=kotlin.IntArray origin=null
VAR IR_TEMPORARY_VARIABLE val tmp2_index0: kotlin.Int
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp0: kotlin.Int
GET_VAR 'i: Int' type=kotlin.Int origin=POSTFIX_INCR
SET_VAR 'i: Int' type=kotlin.Unit origin=POSTFIX_INCR
CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
VAR IR_TEMPORARY_VARIABLE val tmp3: kotlin.Int
CALL 'get(Int): Int' type=kotlin.Int origin=POSTFIX_INCR
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp1_array: kotlin.IntArray
GET_VAR 'value-parameter a: IntArray' type=kotlin.IntArray origin=null
VAR IR_TEMPORARY_VARIABLE val tmp2_index0: kotlin.Int
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp0: kotlin.Int
GET_VAR 'i: Int' type=kotlin.Int origin=POSTFIX_INCR
SET_VAR 'i: Int' type=kotlin.Unit origin=POSTFIX_INCR
CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
VAR IR_TEMPORARY_VARIABLE val tmp3: kotlin.Int
CALL 'get(Int): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp1_array: IntArray' type=kotlin.IntArray origin=null
index: GET_VAR 'tmp2_index0: Int' type=kotlin.Int origin=null
CALL 'set(Int, Int): Unit' type=kotlin.Unit origin=POSTFIX_INCR
$this: GET_VAR 'tmp1_array: IntArray' type=kotlin.IntArray origin=null
index: GET_VAR 'tmp2_index0: Int' type=kotlin.Int origin=null
CALL 'set(Int, Int): Unit' type=kotlin.Unit origin=POSTFIX_INCR
$this: GET_VAR 'tmp1_array: IntArray' type=kotlin.IntArray origin=null
index: GET_VAR 'tmp2_index0: Int' type=kotlin.Int origin=null
value: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp3: Int' type=kotlin.Int origin=null
GET_VAR 'tmp3: Int' type=kotlin.Int origin=null
FUN public fun test2(): kotlin.Unit
BLOCK_BODY
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp0_this: X1
GET_OBJECT 'X1' type=X1
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp1: kotlin.Int
CALL '<get-x1>(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp0_this: X1' type=X1 origin=null
CALL '<set-x1>(Int): Unit' type=kotlin.Unit origin=POSTFIX_INCR
$this: GET_VAR 'tmp0_this: X1' type=X1 origin=null
<set-?>: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp1: Int' type=kotlin.Int origin=null
GET_VAR 'tmp1: Int' type=kotlin.Int origin=null
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp2_this: X1.X2
GET_OBJECT 'X2' type=X1.X2
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp3: kotlin.Int
CALL '<get-x2>(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp2_this: X1.X2' type=X1.X2 origin=null
CALL '<set-x2>(Int): Unit' type=kotlin.Unit origin=POSTFIX_INCR
$this: GET_VAR 'tmp2_this: X1.X2' type=X1.X2 origin=null
<set-?>: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
value: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp3: Int' type=kotlin.Int origin=null
GET_VAR 'tmp3: Int' type=kotlin.Int origin=null
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp4_this: X1.X2.X3
GET_OBJECT 'X3' type=X1.X2.X3
FUN public fun test2(): kotlin.Unit
BLOCK_BODY
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp5: kotlin.Int
CALL '<get-x3>(): Int' type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp0_this: X1
GET_OBJECT 'X1' type=X1
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp1: kotlin.Int
CALL '<get-x1>(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp0_this: X1' type=X1 origin=null
CALL '<set-x1>(Int): Unit' type=kotlin.Unit origin=POSTFIX_INCR
$this: GET_VAR 'tmp0_this: X1' type=X1 origin=null
<set-?>: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp1: Int' type=kotlin.Int origin=null
GET_VAR 'tmp1: Int' type=kotlin.Int origin=null
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp2_this: X1.X2
GET_OBJECT 'X2' type=X1.X2
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp3: kotlin.Int
CALL '<get-x2>(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp2_this: X1.X2' type=X1.X2 origin=null
CALL '<set-x2>(Int): Unit' type=kotlin.Unit origin=POSTFIX_INCR
$this: GET_VAR 'tmp2_this: X1.X2' type=X1.X2 origin=null
<set-?>: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp3: Int' type=kotlin.Int origin=null
GET_VAR 'tmp3: Int' type=kotlin.Int origin=null
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp4_this: X1.X2.X3
GET_OBJECT 'X3' type=X1.X2.X3
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp5: kotlin.Int
CALL '<get-x3>(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp4_this: X1.X2.X3' type=X1.X2.X3 origin=null
CALL '<set-x3>(Int): Unit' type=kotlin.Unit origin=POSTFIX_INCR
$this: GET_VAR 'tmp4_this: X1.X2.X3' type=X1.X2.X3 origin=null
CALL '<set-x3>(Int): Unit' type=kotlin.Unit origin=POSTFIX_INCR
$this: GET_VAR 'tmp4_this: X1.X2.X3' type=X1.X2.X3 origin=null
<set-?>: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp5: Int' type=kotlin.Int origin=null
GET_VAR 'tmp5: Int' type=kotlin.Int origin=null
<set-?>: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp5: Int' type=kotlin.Int origin=null
GET_VAR 'tmp5: Int' type=kotlin.Int origin=null
CLASS CLASS B
CONSTRUCTOR public constructor B(s: kotlin.Int = ...)
s: EXPRESSION_BODY
@@ -0,0 +1,5 @@
class C(var x: Int)
fun test(nc: C?) {
nc?.x = 42
}
@@ -0,0 +1,34 @@
FILE /safeAssignment.kt
CLASS CLASS C
CONSTRUCTOR public constructor C(x: kotlin.Int)
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'constructor Any()'
INSTANCE_INITIALIZER_CALL classDescriptor='C'
PROPERTY public final var x: kotlin.Int
FIELD PROPERTY_BACKING_FIELD public final var x: kotlin.Int
EXPRESSION_BODY
GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR public final fun <get-x>(): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='<get-x>(): Int'
GET_FIELD 'x: Int' type=kotlin.Int origin=null
receiver: THIS of 'C' type=C
FUN DEFAULT_PROPERTY_ACCESSOR public final fun <set-x>(<set-?>: kotlin.Int): kotlin.Unit
BLOCK_BODY
SET_FIELD 'x: Int' type=kotlin.Unit origin=null
receiver: THIS of 'C' type=C
value: GET_VAR 'value-parameter <set-?>: Int' type=kotlin.Int origin=null
FUN public fun test(nc: C?): kotlin.Unit
BLOCK_BODY
BLOCK type=kotlin.Unit origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: C?
GET_VAR 'value-parameter nc: C?' type=C? origin=null
WHEN type=kotlin.Unit origin=SAFE_CALL
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: C?' type=C? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CONST Null type=kotlin.Nothing? value='null'
else: CALL '<set-x>(Int): Unit' type=kotlin.Unit origin=EQ
$this: GET_VAR 'tmp0_safe_receiver: C?' type=C? origin=null
<set-?>: CONST Int type=kotlin.Int value='42'
@@ -32,49 +32,52 @@ FILE /safeCallWithIncrementDecrement.kt
BLOCK_BODY
FUN public fun testProperty(nc: test.C?): kotlin.Unit
BLOCK_BODY
BLOCK type=kotlin.Int? origin=SAFE_CALL
BLOCK type=kotlin.Unit origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: test.C?
GET_VAR 'value-parameter nc: C?' type=test.C? origin=null
WHEN type=kotlin.Int? origin=SAFE_CALL
WHEN type=kotlin.Unit origin=SAFE_CALL
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
else: BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp1_this: test.C?
GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null
then: TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CONST Null type=kotlin.Nothing? value='null'
else: TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp2: kotlin.Int
CALL '<get-p>() on C?: Int' type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp1_this: test.C?
GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp2: kotlin.Int
CALL '<get-p>() on C?: Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp1_this: C?' type=test.C? origin=null
CALL '<set-p>(Int) on C?: Unit' type=kotlin.Unit origin=POSTFIX_INCR
$this: GET_VAR 'tmp1_this: C?' type=test.C? origin=null
CALL '<set-p>(Int) on C?: Unit' type=kotlin.Unit origin=POSTFIX_INCR
$this: GET_VAR 'tmp1_this: C?' type=test.C? origin=null
value: CALL 'inc() on Int?: Int?' type=kotlin.Int? origin=POSTFIX_INCR
$receiver: GET_VAR 'tmp2: Int' type=kotlin.Int origin=null
GET_VAR 'tmp2: Int' type=kotlin.Int origin=null
value: CALL 'inc() on Int?: Int?' type=kotlin.Int? origin=POSTFIX_INCR
$receiver: GET_VAR 'tmp2: Int' type=kotlin.Int origin=null
GET_VAR 'tmp2: Int' type=kotlin.Int origin=null
FUN public fun testArrayAccess(nc: test.C?): kotlin.Unit
BLOCK_BODY
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp3_array: kotlin.Int?
BLOCK type=kotlin.Int? origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: test.C?
GET_VAR 'value-parameter nc: C?' type=test.C? origin=null
WHEN type=kotlin.Int? origin=SAFE_CALL
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
else: CALL '<get-p>() on C?: Int' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null
VAR IR_TEMPORARY_VARIABLE val tmp4_index0: kotlin.Int
CONST Int type=kotlin.Int value='0'
VAR IR_TEMPORARY_VARIABLE val tmp5: kotlin.Int
CALL 'get(Int) on Int?: Int' type=kotlin.Int origin=POSTFIX_INCR
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp3_array: kotlin.Int?
BLOCK type=kotlin.Int? origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: test.C?
GET_VAR 'value-parameter nc: C?' type=test.C? origin=null
WHEN type=kotlin.Int? origin=SAFE_CALL
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
else: CALL '<get-p>() on C?: Int' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null
VAR IR_TEMPORARY_VARIABLE val tmp4_index0: kotlin.Int
CONST Int type=kotlin.Int value='0'
VAR IR_TEMPORARY_VARIABLE val tmp5: kotlin.Int
CALL 'get(Int) on Int?: Int' type=kotlin.Int origin=POSTFIX_INCR
$receiver: GET_VAR 'tmp3_array: Int?' type=kotlin.Int? origin=null
index: GET_VAR 'tmp4_index0: Int' type=kotlin.Int origin=null
CALL 'set(Int, Int) on Int?: Unit' type=kotlin.Unit origin=POSTFIX_INCR
$receiver: GET_VAR 'tmp3_array: Int?' type=kotlin.Int? origin=null
index: GET_VAR 'tmp4_index0: Int' type=kotlin.Int origin=null
CALL 'set(Int, Int) on Int?: Unit' type=kotlin.Unit origin=POSTFIX_INCR
$receiver: GET_VAR 'tmp3_array: Int?' type=kotlin.Int? origin=null
index: GET_VAR 'tmp4_index0: Int' type=kotlin.Int origin=null
value: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp5: Int' type=kotlin.Int origin=null
GET_VAR 'tmp5: Int' type=kotlin.Int origin=null
value: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp5: Int' type=kotlin.Int origin=null
GET_VAR 'tmp5: Int' type=kotlin.Int origin=null
+4 -3
View File
@@ -66,14 +66,15 @@ FILE /safeCalls.kt
other: GET_VAR 'value-parameter y: Any?' type=kotlin.Any? origin=null
FUN public fun test4(x: Ref?): kotlin.Unit
BLOCK_BODY
BLOCK type=kotlin.Unit? origin=SAFE_CALL
BLOCK type=kotlin.Unit origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: Ref?
GET_VAR 'value-parameter x: Ref?' type=Ref? origin=null
WHEN type=kotlin.Unit? origin=SAFE_CALL
WHEN type=kotlin.Unit origin=SAFE_CALL
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: Ref?' type=Ref? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
then: TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CONST Null type=kotlin.Nothing? value='null'
else: CALL '<set-value>(Int): Unit' type=kotlin.Unit origin=EQ
$this: GET_VAR 'tmp0_safe_receiver: Ref?' type=Ref? origin=null
<set-?>: CONST Int type=kotlin.Int value='0'
+8 -7
View File
@@ -52,13 +52,14 @@ FILE /whileDoWhile.kt
other: CONST Int type=kotlin.Int value='15'
DO_WHILE label=null origin=DO_WHILE_LOOP
body: BLOCK type=kotlin.Unit origin=null
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp3: kotlin.Int
GET_VAR 'x: Int' type=kotlin.Int origin=POSTFIX_INCR
SET_VAR 'x: Int' type=kotlin.Unit origin=POSTFIX_INCR
CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp3: Int' type=kotlin.Int origin=null
GET_VAR 'tmp3: Int' type=kotlin.Int origin=null
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp3: kotlin.Int
GET_VAR 'x: Int' type=kotlin.Int origin=POSTFIX_INCR
SET_VAR 'x: Int' type=kotlin.Unit origin=POSTFIX_INCR
CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp3: Int' type=kotlin.Int origin=null
GET_VAR 'tmp3: Int' type=kotlin.Int origin=null
condition: CALL 'LT0(Int): Boolean' type=kotlin.Boolean origin=LT
arg0: CALL 'compareTo(Int): Int' type=kotlin.Int origin=LT
$this: GET_VAR 'x: Int' type=kotlin.Int origin=null
+8 -7
View File
@@ -5,11 +5,12 @@ FILE /localFunction.kt
CONST Int type=kotlin.Int value='0'
FUN local final fun local(): kotlin.Unit
BLOCK_BODY
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp0: kotlin.Int
GET_VAR 'x: Int' type=kotlin.Int origin=POSTFIX_INCR
SET_VAR 'x: Int' type=kotlin.Unit origin=POSTFIX_INCR
CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp0: kotlin.Int
GET_VAR 'x: Int' type=kotlin.Int origin=POSTFIX_INCR
SET_VAR 'x: Int' type=kotlin.Unit origin=POSTFIX_INCR
CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
CALL 'local(): Unit' type=kotlin.Unit origin=null
@@ -22,35 +22,36 @@ FILE /multipleImplicitReceivers.kt
CONST Int type=kotlin.Int value='42'
FUN public fun test(fooImpl: IFoo, invokeImpl: IInvoke): kotlin.Unit
BLOCK_BODY
CALL 'with(A, A.() -> Int): Int' type=kotlin.Int origin=null
<T>: A
<R>: Int
receiver: GET_OBJECT 'A' type=A
block: BLOCK type=A.() -> kotlin.Int origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun A.<anonymous>(): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='<anonymous>() on A: Int'
CALL 'with(IFoo, IFoo.() -> Int): Int' type=kotlin.Int origin=null
<T>: IFoo
<R>: Int
receiver: GET_VAR 'value-parameter fooImpl: IFoo' type=IFoo origin=null
block: BLOCK type=IFoo.() -> kotlin.Int origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun IFoo.<anonymous>(): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='<anonymous>() on IFoo: Int'
CALL 'with(IInvoke, IInvoke.() -> Int): Int' type=kotlin.Int origin=null
<T>: IInvoke
<R>: Int
receiver: GET_VAR 'value-parameter invokeImpl: IInvoke' type=IInvoke origin=null
block: BLOCK type=IInvoke.() -> kotlin.Int origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun IInvoke.<anonymous>(): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='<anonymous>() on IInvoke: Int'
CALL 'invoke() on B: Int' type=kotlin.Int origin=INVOKE
$this: $RECEIVER of '<anonymous>() on IInvoke: Int' type=IInvoke
$receiver: CALL '<get-foo>() on A: B' type=B origin=GET_PROPERTY
$this: $RECEIVER of '<anonymous>() on IFoo: Int' type=IFoo
$receiver: $RECEIVER of '<anonymous>() on A: Int' type=A
CALLABLE_REFERENCE '<anonymous>() on IInvoke: Int' type=IInvoke.() -> kotlin.Int origin=LAMBDA
CALLABLE_REFERENCE '<anonymous>() on IFoo: Int' type=IFoo.() -> kotlin.Int origin=LAMBDA
CALLABLE_REFERENCE '<anonymous>() on A: Int' type=A.() -> kotlin.Int origin=LAMBDA
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'with(A, A.() -> Int): Int' type=kotlin.Int origin=null
<T>: A
<R>: Int
receiver: GET_OBJECT 'A' type=A
block: BLOCK type=A.() -> kotlin.Int origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun A.<anonymous>(): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='<anonymous>() on A: Int'
CALL 'with(IFoo, IFoo.() -> Int): Int' type=kotlin.Int origin=null
<T>: IFoo
<R>: Int
receiver: GET_VAR 'value-parameter fooImpl: IFoo' type=IFoo origin=null
block: BLOCK type=IFoo.() -> kotlin.Int origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun IFoo.<anonymous>(): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='<anonymous>() on IFoo: Int'
CALL 'with(IInvoke, IInvoke.() -> Int): Int' type=kotlin.Int origin=null
<T>: IInvoke
<R>: Int
receiver: GET_VAR 'value-parameter invokeImpl: IInvoke' type=IInvoke origin=null
block: BLOCK type=IInvoke.() -> kotlin.Int origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun IInvoke.<anonymous>(): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='<anonymous>() on IInvoke: Int'
CALL 'invoke() on B: Int' type=kotlin.Int origin=INVOKE
$this: $RECEIVER of '<anonymous>() on IInvoke: Int' type=IInvoke
$receiver: CALL '<get-foo>() on A: B' type=B origin=GET_PROPERTY
$this: $RECEIVER of '<anonymous>() on IFoo: Int' type=IFoo
$receiver: $RECEIVER of '<anonymous>() on A: Int' type=A
CALLABLE_REFERENCE '<anonymous>() on IInvoke: Int' type=IInvoke.() -> kotlin.Int origin=LAMBDA
CALLABLE_REFERENCE '<anonymous>() on IFoo: Int' type=IFoo.() -> kotlin.Int origin=LAMBDA
CALLABLE_REFERENCE '<anonymous>() on A: Int' type=A.() -> kotlin.Int origin=LAMBDA