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,8 +23,8 @@ FILE fqName:<root> fileName:/breakContinueInWhen.kt
VAR FOR_LOOP_VARIABLE name:x type:kotlin.Int [val]
CALL 'public final fun next (): kotlin.Int declared in kotlin.collections.IntIterator' type=kotlin.Int origin=FOR_LOOP_NEXT
$this: GET_VAR 'val tmp0_iterator: kotlin.collections.IntIterator [val] declared in <root>.testBreakFor' type=kotlin.collections.IntIterator origin=null
BLOCK type=kotlin.Nothing origin=null
WHEN type=kotlin.Nothing origin=WHEN
BLOCK type=kotlin.Unit origin=null
WHEN type=kotlin.Unit origin=WHEN
BRANCH
if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
arg0: GET_VAR 'var k: kotlin.Int [var] declared in <root>.testBreakFor' type=kotlin.Int origin=null
@@ -39,7 +39,7 @@ FILE fqName:<root> fileName:/breakContinueInWhen.kt
arg0: GET_VAR 'var k: kotlin.Int [var] declared in <root>.testBreakWhile' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=10
body: BLOCK type=kotlin.Unit origin=null
WHEN type=kotlin.Nothing origin=WHEN
WHEN type=kotlin.Unit origin=WHEN
BRANCH
if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
arg0: GET_VAR 'var k: kotlin.Int [var] declared in <root>.testBreakWhile' type=kotlin.Int origin=null
@@ -52,7 +52,7 @@ FILE fqName:<root> fileName:/breakContinueInWhen.kt
BLOCK type=kotlin.Unit origin=null
DO_WHILE label=null origin=DO_WHILE_LOOP
body: COMPOSITE type=kotlin.Unit origin=null
WHEN type=kotlin.Nothing origin=WHEN
WHEN type=kotlin.Unit origin=WHEN
BRANCH
if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
arg0: GET_VAR 'var k: kotlin.Int [var] declared in <root>.testBreakDoWhile' type=kotlin.Int origin=null
@@ -85,8 +85,8 @@ FILE fqName:<root> fileName:/breakContinueInWhen.kt
VAR FOR_LOOP_VARIABLE name:x type:kotlin.Int [val]
CALL 'public final fun next (): kotlin.Int declared in kotlin.collections.IntIterator' type=kotlin.Int origin=FOR_LOOP_NEXT
$this: GET_VAR 'val tmp0_iterator: kotlin.collections.IntIterator [val] declared in <root>.testContinueFor' type=kotlin.collections.IntIterator origin=null
BLOCK type=kotlin.Nothing origin=null
WHEN type=kotlin.Nothing origin=WHEN
BLOCK type=kotlin.Unit origin=null
WHEN type=kotlin.Unit origin=WHEN
BRANCH
if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
arg0: GET_VAR 'var k: kotlin.Int [var] declared in <root>.testContinueFor' type=kotlin.Int origin=null
@@ -101,7 +101,7 @@ FILE fqName:<root> fileName:/breakContinueInWhen.kt
arg0: GET_VAR 'var k: kotlin.Int [var] declared in <root>.testContinueWhile' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=10
body: BLOCK type=kotlin.Unit origin=null
WHEN type=kotlin.Nothing origin=WHEN
WHEN type=kotlin.Unit origin=WHEN
BRANCH
if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
arg0: GET_VAR 'var k: kotlin.Int [var] declared in <root>.testContinueWhile' type=kotlin.Int origin=null
@@ -122,7 +122,7 @@ FILE fqName:<root> fileName:/breakContinueInWhen.kt
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=PREFIX_INCR
$this: GET_VAR 'var k: kotlin.Int [var] declared in <root>.testContinueDoWhile' type=kotlin.Int origin=PREFIX_INCR
GET_VAR 'var k: kotlin.Int [var] declared in <root>.testContinueDoWhile' type=kotlin.Int origin=PREFIX_INCR
WHEN type=kotlin.Nothing origin=WHEN
WHEN type=kotlin.Unit origin=WHEN
BRANCH
if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
arg0: GET_VAR 'var k: kotlin.Int [var] declared in <root>.testContinueDoWhile' type=kotlin.Int origin=null