Files
kotlin-fork/compiler/testData/ir/irText/expressions/whenCoercedToUnit.txt
T
Dmitry Petrov d0134f2c64 KT-16437 Incorrect type inference for some when coerced to Unit
If the result of 'when' is not used in an expression,
this 'when' expression has type 'Unit' despite of whatever FE has inferred.
2017-03-01 09:25:38 +03:00

14 lines
671 B
Plaintext
Vendored

FILE /whenCoercedToUnit.kt
FUN public fun foo(x: kotlin.Int): kotlin.Unit
BLOCK_BODY
BLOCK type=kotlin.Unit origin=WHEN
VAR IR_TEMPORARY_VARIABLE val tmp0_subject: kotlin.Int
GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=null
WHEN type=kotlin.Unit origin=WHEN
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_subject: Int' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value='0'
then: TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CONST Int type=kotlin.Int value='0'