psi2ir: Consistently use type unit for statements

These changes allow us to accurately distinguish between statements and
expressions in the IR.

This also fixes the types of non-exhaustive conditional statements.
This commit is contained in:
Steven Schäfer
2019-10-23 15:41:47 +02:00
committed by Dmitry Petrov
parent 0da4b06074
commit af74fd047a
23 changed files with 142 additions and 131 deletions
@@ -23,15 +23,15 @@ FILE fqName:<root> fileName:/useNextParamInLambda.kt
BLOCK_BODY
VAR name:result type:kotlin.String [var]
CONST String type=kotlin.String value="fail"
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
TRY type=kotlin.Any
try: BLOCK type=kotlin.String origin=null
TRY type=kotlin.Unit
try: BLOCK type=kotlin.Unit origin=null
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public final fun f (f1: kotlin.Function0<kotlin.String>, f2: kotlin.Function0<kotlin.String>): kotlin.String declared in <root>' type=kotlin.String origin=null
CATCH parameter=val e: java.lang.Exception{ kotlin.Exception } [val] declared in <root>.box
VAR CATCH_PARAMETER name:e type:java.lang.Exception{ kotlin.Exception } [val]
BLOCK type=kotlin.Unit origin=null
SET_VAR 'var result: kotlin.String [var] declared in <root>.box' type=kotlin.Unit origin=EQ
CONST String type=kotlin.String value="OK"
CATCH parameter=val e: java.lang.Exception{ kotlin.Exception } [val] declared in <root>.box
VAR CATCH_PARAMETER name:e type:java.lang.Exception{ kotlin.Exception } [val]
BLOCK type=kotlin.Unit origin=null
SET_VAR 'var result: kotlin.String [var] declared in <root>.box' type=kotlin.Unit origin=EQ
CONST String type=kotlin.String value="OK"
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String declared in kotlin.String' type=kotlin.String origin=PLUS
$this: CALL 'public final fun f (f1: kotlin.Function0<kotlin.String>, f2: kotlin.Function0<kotlin.String>): kotlin.String declared in <root>' type=kotlin.String origin=null