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
@@ -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