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