[FIR] Infer type of when expressions and try expressions like it is function call
This commit is contained in:
+2
-2
@@ -3,7 +3,7 @@ FILE fqName:<root> fileName:/kt27933.kt
|
||||
BLOCK_BODY
|
||||
VAR name:r type:kotlin.String [var]
|
||||
CONST String type=kotlin.String value=""
|
||||
WHEN type=kotlin.String origin=IF
|
||||
WHEN type=kotlin.Unit origin=IF
|
||||
BRANCH
|
||||
if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
|
||||
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
|
||||
@@ -15,7 +15,7 @@ FILE fqName:<root> fileName:/kt27933.kt
|
||||
then: BLOCK type=kotlin.Unit origin=null
|
||||
SET_VAR 'var r: kotlin.String [var] declared in <root>.box' type=kotlin.String origin=null
|
||||
CONST String type=kotlin.String value="O"
|
||||
WHEN type=kotlin.String origin=IF
|
||||
WHEN type=kotlin.Unit origin=IF
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'var r: kotlin.String [var] declared in <root>.box' type=kotlin.String origin=null
|
||||
|
||||
@@ -36,7 +36,7 @@ FILE fqName:<root> fileName:/smartCasts.kt
|
||||
FUN name:test2 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.String
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
WHEN type=kotlin.String origin=IF
|
||||
WHEN type=kotlin.Unit origin=IF
|
||||
BRANCH
|
||||
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.String
|
||||
GET_VAR 'x: kotlin.Any declared in <root>.test2' type=kotlin.Any origin=null
|
||||
@@ -48,7 +48,7 @@ FILE fqName:<root> fileName:/smartCasts.kt
|
||||
FUN name:test3 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.String
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
WHEN type=kotlin.String origin=IF
|
||||
WHEN type=kotlin.Unit origin=IF
|
||||
BRANCH
|
||||
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.String
|
||||
GET_VAR 'x: kotlin.Any declared in <root>.test3' type=kotlin.Any origin=null
|
||||
|
||||
@@ -2,7 +2,7 @@ FILE fqName:<root> fileName:/varargWithImplicitCast.kt
|
||||
FUN name:testScalar visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.IntArray
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
WHEN type=kotlin.IntArray origin=IF
|
||||
WHEN type=kotlin.Unit origin=IF
|
||||
BRANCH
|
||||
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Int
|
||||
GET_VAR 'a: kotlin.Any declared in <root>.testScalar' type=kotlin.Any origin=null
|
||||
@@ -14,7 +14,7 @@ FILE fqName:<root> fileName:/varargWithImplicitCast.kt
|
||||
FUN name:testSpread visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.IntArray
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
WHEN type=kotlin.IntArray origin=IF
|
||||
WHEN type=kotlin.Unit origin=IF
|
||||
BRANCH
|
||||
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.IntArray
|
||||
GET_VAR 'a: kotlin.Any declared in <root>.testSpread' type=kotlin.Any origin=null
|
||||
|
||||
@@ -13,8 +13,8 @@ FILE fqName:<root> fileName:/whenWithSubjectVariable.kt
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val y: kotlin.Any [val] declared in <root>.test' type=kotlin.Any origin=null
|
||||
arg1: CONST Int type=IrErrorType value=42
|
||||
then: CONST Int type=IrErrorType value=1
|
||||
arg1: CONST Int type=kotlin.Int value=42
|
||||
then: CONST Int type=kotlin.Int value=1
|
||||
BRANCH
|
||||
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.String
|
||||
GET_VAR 'val y: kotlin.Any [val] declared in <root>.test' type=kotlin.Any origin=null
|
||||
@@ -22,21 +22,15 @@ FILE fqName:<root> fileName:/whenWithSubjectVariable.kt
|
||||
BRANCH
|
||||
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Int
|
||||
GET_VAR 'val y: kotlin.Any [val] declared in <root>.test' type=kotlin.Any origin=null
|
||||
then: CONST Int type=IrErrorType value=2
|
||||
then: CONST Int type=kotlin.Int value=2
|
||||
BRANCH
|
||||
if: CALL 'public open fun contains (value: kotlin.Int): kotlin.Boolean declared in kotlin.ranges.IntRange' type=kotlin.Boolean origin=null
|
||||
$this: CALL 'public final fun rangeTo (other: kotlin.Int): kotlin.ranges.IntRange declared in kotlin.Int' type=kotlin.ranges.IntRange origin=null
|
||||
$this: CONST Int type=kotlin.Int value=0
|
||||
other: CONST Int type=kotlin.Int value=10
|
||||
value: GET_VAR 'val y: kotlin.Any [val] declared in <root>.test' type=kotlin.Any origin=null
|
||||
then: CONST Int type=IrErrorType value=3
|
||||
if: ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [kotlin/ranges/IntRange.contains]>#' type=IrErrorType
|
||||
GET_VAR 'val y: kotlin.Any [val] declared in <root>.test' type=kotlin.Any origin=null
|
||||
then: CONST Int type=kotlin.Int value=3
|
||||
BRANCH
|
||||
if: CALL 'public open fun contains (value: kotlin.Int): kotlin.Boolean declared in kotlin.ranges.IntRange' type=kotlin.Boolean origin=null
|
||||
$this: CALL 'public final fun rangeTo (other: kotlin.Int): kotlin.ranges.IntRange declared in kotlin.Int' type=kotlin.ranges.IntRange origin=null
|
||||
$this: CONST Int type=kotlin.Int value=10
|
||||
other: CONST Int type=kotlin.Int value=20
|
||||
value: GET_VAR 'val y: kotlin.Any [val] declared in <root>.test' type=kotlin.Any origin=null
|
||||
then: CONST Int type=IrErrorType value=4
|
||||
if: ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [kotlin/ranges/IntRange.contains]>#' type=IrErrorType
|
||||
GET_VAR 'val y: kotlin.Any [val] declared in <root>.test' type=kotlin.Any origin=null
|
||||
then: CONST Int type=kotlin.Int value=4
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: CALL 'public final fun unaryMinus (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
|
||||
@@ -13,7 +13,7 @@ FILE fqName:<root> fileName:/coercionInLoop.kt
|
||||
condition: CALL 'public abstract fun hasNext (): kotlin.Boolean declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=null
|
||||
$this: GET_VAR 'val x: kotlin.collections.DoubleIterator [val] declared in <root>.box' type=kotlin.collections.DoubleIterator origin=null
|
||||
body: BLOCK type=kotlin.Int origin=null
|
||||
WHEN type=kotlin.String origin=IF
|
||||
WHEN type=kotlin.Unit origin=IF
|
||||
BRANCH
|
||||
if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
|
||||
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
|
||||
|
||||
Reference in New Issue
Block a user