Raw FIR: fix unary operators (now convention calls use receivers)

This commit is contained in:
Simon Ogorodnik
2019-04-16 14:38:44 +03:00
committed by Mikhail Glukhikh
parent 77e83dd8cf
commit 73b1676a03
13 changed files with 106 additions and 79 deletions
@@ -22,8 +22,7 @@ FILE fqName:<root> fileName:/whenByFloatingPoint.kt
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Double
GET_VAR 'x: kotlin.Any declared in <root>.testSmartCastInWhenSubject' type=kotlin.Any origin=null
then: RETURN type=kotlin.Nothing from='public final fun testSmartCastInWhenSubject (x: kotlin.Any): kotlin.Int declared in <root>'
ERROR_CALL 'Unresolved reference: <Unresolved name: unaryMinus>#' type=IrErrorType
CONST Int type=kotlin.Int value=1
CALL 'public final fun unaryMinus (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
RETURN type=kotlin.Nothing from='public final fun testSmartCastInWhenSubject (x: kotlin.Any): kotlin.Int declared in <root>'
BLOCK type=kotlin.Int origin=WHEN
VAR IR_TEMPORARY_VARIABLE name:tmp1_subject type:kotlin.Any [val]
@@ -45,8 +44,7 @@ FILE fqName:<root> fileName:/whenByFloatingPoint.kt
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Double
GET_VAR 'y: kotlin.Any declared in <root>.testSmartCastInWhenCondition' type=kotlin.Any origin=null
then: RETURN type=kotlin.Nothing from='public final fun testSmartCastInWhenCondition (x: kotlin.Double, y: kotlin.Any): kotlin.Int declared in <root>'
ERROR_CALL 'Unresolved reference: <Unresolved name: unaryMinus>#' type=IrErrorType
CONST Int type=kotlin.Int value=1
CALL 'public final fun unaryMinus (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
RETURN type=kotlin.Nothing from='public final fun testSmartCastInWhenCondition (x: kotlin.Double, y: kotlin.Any): kotlin.Int declared in <root>'
BLOCK type=kotlin.Int origin=WHEN
VAR IR_TEMPORARY_VARIABLE name:tmp2_subject type:kotlin.Double [val]
@@ -59,26 +57,25 @@ FILE fqName:<root> fileName:/whenByFloatingPoint.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CONST Int type=kotlin.Int value=1
FUN name:testSmartCastInWhenConditionInBranch visibility:public modality:FINAL <> (x:kotlin.Any) returnType:IrErrorType
FUN name:testSmartCastInWhenConditionInBranch visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.Int
VALUE_PARAMETER name:x index:0 type:kotlin.Any
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testSmartCastInWhenConditionInBranch (x: kotlin.Any): IrErrorType declared in <root>'
BLOCK type=IrErrorType origin=WHEN
RETURN type=kotlin.Nothing from='public final fun testSmartCastInWhenConditionInBranch (x: kotlin.Any): kotlin.Int declared in <root>'
BLOCK type=kotlin.Int origin=WHEN
VAR IR_TEMPORARY_VARIABLE name:tmp3_subject type:kotlin.Any [val]
WHEN type=IrErrorType origin=WHEN
WHEN type=kotlin.Int origin=WHEN
BRANCH
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Double
GET_VAR 'val tmp3_subject: kotlin.Any [val] declared in <root>.testSmartCastInWhenConditionInBranch' type=kotlin.Any origin=null
then: ERROR_CALL 'Unresolved reference: <Unresolved name: unaryMinus>#' type=IrErrorType
CONST Int type=kotlin.Int value=1
then: CALL 'public final fun unaryMinus (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
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 tmp3_subject: kotlin.Any [val] declared in <root>.testSmartCastInWhenConditionInBranch' type=kotlin.Any origin=null
arg1: CONST Double type=IrErrorType value=0.0
then: CONST Int type=IrErrorType value=0
arg1: CONST Double type=kotlin.Int value=0.0
then: CONST Int type=kotlin.Int value=0
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CONST Int type=IrErrorType value=1
then: CONST Int type=kotlin.Int value=1
FUN name:testSmartCastToDifferentTypes visibility:public modality:FINAL <> (x:kotlin.Any, y:kotlin.Any) returnType:kotlin.Int
VALUE_PARAMETER name:x index:0 type:kotlin.Any
VALUE_PARAMETER name:y index:1 type:kotlin.Any
@@ -88,15 +85,13 @@ FILE fqName:<root> fileName:/whenByFloatingPoint.kt
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Double
GET_VAR 'x: kotlin.Any declared in <root>.testSmartCastToDifferentTypes' type=kotlin.Any origin=null
then: RETURN type=kotlin.Nothing from='public final fun testSmartCastToDifferentTypes (x: kotlin.Any, y: kotlin.Any): kotlin.Int declared in <root>'
ERROR_CALL 'Unresolved reference: <Unresolved name: unaryMinus>#' type=IrErrorType
CONST Int type=kotlin.Int value=1
CALL 'public final fun unaryMinus (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
WHEN type=kotlin.Int origin=IF
BRANCH
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Float
GET_VAR 'y: kotlin.Any declared in <root>.testSmartCastToDifferentTypes' type=kotlin.Any origin=null
then: RETURN type=kotlin.Nothing from='public final fun testSmartCastToDifferentTypes (x: kotlin.Any, y: kotlin.Any): kotlin.Int declared in <root>'
ERROR_CALL 'Unresolved reference: <Unresolved name: unaryMinus>#' type=IrErrorType
CONST Int type=kotlin.Int value=1
CALL 'public final fun unaryMinus (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
RETURN type=kotlin.Nothing from='public final fun testSmartCastToDifferentTypes (x: kotlin.Any, y: kotlin.Any): kotlin.Int declared in <root>'
BLOCK type=kotlin.Int origin=WHEN
VAR IR_TEMPORARY_VARIABLE name:tmp4_subject type:kotlin.Any [val]