FIR: Change the Fir2Ir handling of smart casts.
Generate the expression with the original type and then insert an implicit conversion. That matches the behavior of psi2ir better and therefore avoids breaking backend assumptions. In particular, IrGetValue expects the type of the underlying symbol and the type of the IrGetValue to be the same.
This commit is contained in:
@@ -17,7 +17,8 @@ FILE fqName:<root> fileName:/breakContinueInLoopHeader.kt
|
||||
then: BREAK label=null loop.label=L
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val tmp_0: kotlin.Boolean? [val] declared in <root>.test1' type=kotlin.Boolean origin=null
|
||||
then: TYPE_OP type=kotlin.Boolean origin=IMPLICIT_CAST typeOperand=kotlin.Boolean
|
||||
GET_VAR 'val tmp_0: kotlin.Boolean? [val] declared in <root>.test1' type=kotlin.Boolean? origin=null
|
||||
body: BLOCK type=kotlin.Unit origin=null
|
||||
FUN name:test2 visibility:public modality:FINAL <> (c:kotlin.Boolean?) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:c index:0 type:kotlin.Boolean?
|
||||
@@ -37,7 +38,8 @@ FILE fqName:<root> fileName:/breakContinueInLoopHeader.kt
|
||||
then: CONTINUE label=null loop.label=L
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val tmp_1: kotlin.Boolean? [val] declared in <root>.test2' type=kotlin.Boolean origin=null
|
||||
then: TYPE_OP type=kotlin.Boolean origin=IMPLICIT_CAST typeOperand=kotlin.Boolean
|
||||
GET_VAR 'val tmp_1: kotlin.Boolean? [val] declared in <root>.test2' type=kotlin.Boolean? origin=null
|
||||
body: BLOCK type=kotlin.Unit origin=null
|
||||
FUN name:test3 visibility:public modality:FINAL <> (ss:kotlin.collections.List<kotlin.String>?) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:ss index:0 type:kotlin.collections.List<kotlin.String>?
|
||||
@@ -57,7 +59,8 @@ FILE fqName:<root> fileName:/breakContinueInLoopHeader.kt
|
||||
then: CONTINUE label=null loop.label=L
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val tmp_3: kotlin.collections.List<kotlin.String>? [val] declared in <root>.test3' type=kotlin.collections.List<kotlin.String> origin=null
|
||||
then: TYPE_OP type=kotlin.collections.List<kotlin.String> origin=IMPLICIT_CAST typeOperand=kotlin.collections.List<kotlin.String>
|
||||
GET_VAR 'val tmp_3: kotlin.collections.List<kotlin.String>? [val] declared in <root>.test3' type=kotlin.collections.List<kotlin.String>? origin=null
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_4 type:kotlin.collections.Iterator<kotlin.String> [val]
|
||||
CALL 'public abstract fun iterator (): kotlin.collections.Iterator<kotlin.String> [operator] declared in kotlin.collections.List' type=kotlin.collections.Iterator<kotlin.String> origin=null
|
||||
$this: GET_VAR 'val tmp_2: kotlin.collections.List<kotlin.String> [val] declared in <root>.test3' type=kotlin.collections.List<kotlin.String> origin=null
|
||||
@@ -86,7 +89,8 @@ FILE fqName:<root> fileName:/breakContinueInLoopHeader.kt
|
||||
then: BREAK label=null loop.label=L
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val tmp_6: kotlin.collections.List<kotlin.String>? [val] declared in <root>.test4' type=kotlin.collections.List<kotlin.String> origin=null
|
||||
then: TYPE_OP type=kotlin.collections.List<kotlin.String> origin=IMPLICIT_CAST typeOperand=kotlin.collections.List<kotlin.String>
|
||||
GET_VAR 'val tmp_6: kotlin.collections.List<kotlin.String>? [val] declared in <root>.test4' type=kotlin.collections.List<kotlin.String>? origin=null
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_7 type:kotlin.collections.Iterator<kotlin.String> [val]
|
||||
CALL 'public abstract fun iterator (): kotlin.collections.Iterator<kotlin.String> [operator] declared in kotlin.collections.List' type=kotlin.collections.Iterator<kotlin.String> origin=null
|
||||
$this: GET_VAR 'val tmp_5: kotlin.collections.List<kotlin.String> [val] declared in <root>.test4' type=kotlin.collections.List<kotlin.String> origin=null
|
||||
|
||||
Reference in New Issue
Block a user