FIR: expect nullable type for elvis LHS

This commit is contained in:
pyos
2021-02-05 11:20:57 +01:00
committed by Dmitriy Novozhilov
parent 0e8f4294f0
commit 64c5608f31
13 changed files with 91 additions and 34 deletions
+6 -5
View File
@@ -50,17 +50,17 @@ fun <T : Any?> test(value: T, value2: T) {
}
}
val x5: Any = { // BLOCK
val <elvis>: Any = magic<Any>()
val <elvis>: Any? = magic<Any?>()
when {
EQEQ(arg0 = <elvis>, arg1 = null) -> 42
else -> <elvis>
}
}
val x6: Any = { // BLOCK
val <elvis>: Any = { // BLOCK
val <elvis>: Any? = { // BLOCK
val <elvis>: T = value
when {
EQEQ(arg0 = <elvis>, arg1 = null) -> magic<Any>()
EQEQ(arg0 = <elvis>, arg1 = null) -> magic<Any?>()
else -> <elvis>
}
}
@@ -70,8 +70,8 @@ fun <T : Any?> test(value: T, value2: T) {
}
}
val x7: Any = { // BLOCK
val <elvis>: Any = { // BLOCK
val <elvis>: Any = magic<Any>()
val <elvis>: Any? = { // BLOCK
val <elvis>: Any? = magic<Any?>()
when {
EQEQ(arg0 = <elvis>, arg1 = null) -> value
else -> <elvis>
@@ -83,3 +83,4 @@ fun <T : Any?> test(value: T, value2: T) {
}
}
}
+22 -22
View File
@@ -97,65 +97,65 @@ FILE fqName:<root> fileName:/kt30796.kt
then: GET_VAR 'val tmp_5: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
VAR name:x5 type:kotlin.Any [val]
BLOCK type=kotlin.Any origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_7 type:kotlin.Any [val]
CALL 'public final fun magic <T> (): T of <root>.magic declared in <root>' type=kotlin.Any origin=null
<T>: kotlin.Any
VAR IR_TEMPORARY_VARIABLE name:tmp_7 type:kotlin.Any? [val]
CALL 'public final fun magic <T> (): T of <root>.magic declared in <root>' type=kotlin.Any? origin=null
<T>: kotlin.Any?
WHEN type=kotlin.Any origin=ELVIS
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 tmp_7: kotlin.Any [val] declared in <root>.test' type=kotlin.Any origin=null
arg0: GET_VAR 'val tmp_7: kotlin.Any? [val] declared in <root>.test' type=kotlin.Any? origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CONST Int type=kotlin.Int value=42
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val tmp_7: kotlin.Any [val] declared in <root>.test' type=kotlin.Any origin=null
then: GET_VAR 'val tmp_7: kotlin.Any? [val] declared in <root>.test' type=kotlin.Any? origin=null
VAR name:x6 type:kotlin.Any [val]
BLOCK type=kotlin.Any origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_8 type:kotlin.Any [val]
BLOCK type=kotlin.Any origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_8 type:kotlin.Any? [val]
BLOCK type=kotlin.Any? origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_9 type:T of <root>.test [val]
GET_VAR 'value: T of <root>.test declared in <root>.test' type=T of <root>.test origin=null
WHEN type=kotlin.Any origin=ELVIS
WHEN type=kotlin.Any? origin=ELVIS
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 tmp_9: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CALL 'public final fun magic <T> (): T of <root>.magic declared in <root>' type=kotlin.Any origin=null
<T>: kotlin.Any
then: CALL 'public final fun magic <T> (): T of <root>.magic declared in <root>' type=kotlin.Any? origin=null
<T>: kotlin.Any?
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val tmp_9: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
WHEN type=kotlin.Any origin=ELVIS
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 tmp_8: kotlin.Any [val] declared in <root>.test' type=kotlin.Any origin=null
arg0: GET_VAR 'val tmp_8: kotlin.Any? [val] declared in <root>.test' type=kotlin.Any? origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CONST Int type=kotlin.Int value=42
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val tmp_8: kotlin.Any [val] declared in <root>.test' type=kotlin.Any origin=null
then: GET_VAR 'val tmp_8: kotlin.Any? [val] declared in <root>.test' type=kotlin.Any? origin=null
VAR name:x7 type:kotlin.Any [val]
BLOCK type=kotlin.Any origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_10 type:kotlin.Any [val]
BLOCK type=kotlin.Any origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_11 type:kotlin.Any [val]
CALL 'public final fun magic <T> (): T of <root>.magic declared in <root>' type=kotlin.Any origin=null
<T>: kotlin.Any
WHEN type=kotlin.Any origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_10 type:kotlin.Any? [val]
BLOCK type=kotlin.Any? origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_11 type:kotlin.Any? [val]
CALL 'public final fun magic <T> (): T of <root>.magic declared in <root>' type=kotlin.Any? origin=null
<T>: kotlin.Any?
WHEN type=kotlin.Any? origin=ELVIS
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 tmp_11: kotlin.Any [val] declared in <root>.test' type=kotlin.Any origin=null
arg0: GET_VAR 'val tmp_11: kotlin.Any? [val] declared in <root>.test' type=kotlin.Any? origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: GET_VAR 'value: T of <root>.test declared in <root>.test' type=T of <root>.test origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val tmp_11: kotlin.Any [val] declared in <root>.test' type=kotlin.Any origin=null
then: GET_VAR 'val tmp_11: kotlin.Any? [val] declared in <root>.test' type=kotlin.Any? origin=null
WHEN type=kotlin.Any origin=ELVIS
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 tmp_10: kotlin.Any [val] declared in <root>.test' type=kotlin.Any origin=null
arg0: GET_VAR 'val tmp_10: kotlin.Any? [val] declared in <root>.test' type=kotlin.Any? origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CONST Int type=kotlin.Int value=42
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val tmp_10: kotlin.Any [val] declared in <root>.test' type=kotlin.Any origin=null
then: GET_VAR 'val tmp_10: kotlin.Any? [val] declared in <root>.test' type=kotlin.Any? origin=null