[FIR] Set isStubTypeEqualsToAnything = true for inference as in FE 1.0

#KT-43616 Fixed
This commit is contained in:
Mikhail Glukhikh
2020-11-26 18:18:34 +03:00
parent eae8821dec
commit 2429f429c5
12 changed files with 131 additions and 18 deletions
+2 -2
View File
@@ -70,7 +70,7 @@ fun <T : Any?> test(value: T, value2: T) {
}
}
val x7: Any = { // BLOCK
val <elvis>: T? = { // BLOCK
val <elvis>: T = { // BLOCK
val <elvis>: T? = magic<T?>()
when {
EQEQ(arg0 = <elvis>, arg1 = null) -> value
@@ -79,7 +79,7 @@ fun <T : Any?> test(value: T, value2: T) {
}
when {
EQEQ(arg0 = <elvis>, arg1 = null) -> 42
else -> <elvis> /*as T */
else -> <elvis>
}
}
}
+5 -6
View File
@@ -137,12 +137,12 @@ FILE fqName:<root> fileName:/kt30796.kt
then: GET_VAR 'val tmp_8: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
VAR name:x7 type:kotlin.Any [val]
BLOCK type=kotlin.Any origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_10 type:T of <root>.test? [val]
BLOCK type=T of <root>.test? origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_10 type:T of <root>.test [val]
BLOCK type=T of <root>.test origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_11 type:T of <root>.test? [val]
CALL 'public final fun magic <T> (): T of <root>.magic declared in <root>' type=T of <root>.test? origin=null
<T>: T of <root>.test?
WHEN type=T of <root>.test? origin=ELVIS
WHEN type=T of <root>.test 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: T of <root>.test? [val] declared in <root>.test' type=T of <root>.test? origin=null
@@ -155,10 +155,9 @@ FILE fqName:<root> fileName:/kt30796.kt
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: T of <root>.test? [val] declared in <root>.test' type=T of <root>.test? origin=null
arg0: GET_VAR 'val tmp_10: 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: CONST Int type=kotlin.Int value=42
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: TYPE_OP type=T of <root>.test origin=IMPLICIT_CAST typeOperand=T of <root>.test
GET_VAR 'val tmp_10: T of <root>.test? [val] declared in <root>.test' type=T of <root>.test? origin=null
then: GET_VAR 'val tmp_10: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
@@ -1,5 +1,5 @@
fun <T : Any?> problematic(lss: List<List<T>>): List<T> {
return lss.flatMap<List<T>, T>(transform = local fun <anonymous>(it: List<T>): Iterable<T> {
return lss.flatMap<List<T>, T?>(transform = local fun <anonymous>(it: List<T>): Iterable<T?> {
return id<T?>(v = it) /*!! List<T?> */
}
)
@@ -4,15 +4,15 @@ FILE fqName:<root> fileName:/typeParametersInImplicitCast.kt
VALUE_PARAMETER name:lss index:0 type:kotlin.collections.List<kotlin.collections.List<T of <root>.problematic>>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun problematic <T> (lss: kotlin.collections.List<kotlin.collections.List<T of <root>.problematic>>): kotlin.collections.List<T of <root>.problematic> declared in <root>'
CALL 'public final fun flatMap <T, R> (transform: kotlin.Function1<T of kotlin.collections.flatMap, kotlin.collections.Iterable<R of kotlin.collections.flatMap>>): kotlin.collections.List<R of kotlin.collections.flatMap> [inline] declared in kotlin.collections' type=kotlin.collections.List<T of <root>.problematic> origin=null
CALL 'public final fun flatMap <T, R> (transform: kotlin.Function1<T of kotlin.collections.flatMap, kotlin.collections.Iterable<R of kotlin.collections.flatMap>>): kotlin.collections.List<R of kotlin.collections.flatMap> [inline] declared in kotlin.collections' type=kotlin.collections.List<T of <root>.problematic?> origin=null
<T>: kotlin.collections.List<T of <root>.problematic>
<R>: T of <root>.problematic
<R>: T of <root>.problematic?
$receiver: GET_VAR 'lss: kotlin.collections.List<kotlin.collections.List<T of <root>.problematic>> declared in <root>.problematic' type=kotlin.collections.List<kotlin.collections.List<T of <root>.problematic>> origin=null
transform: FUN_EXPR type=kotlin.Function1<kotlin.collections.List<T of <root>.problematic>, kotlin.collections.Iterable<T of <root>.problematic>> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:kotlin.collections.List<T of <root>.problematic>) returnType:kotlin.collections.Iterable<T of <root>.problematic>
transform: FUN_EXPR type=kotlin.Function1<kotlin.collections.List<T of <root>.problematic>, kotlin.collections.Iterable<T of <root>.problematic?>> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:kotlin.collections.List<T of <root>.problematic>) returnType:kotlin.collections.Iterable<T of <root>.problematic?>
VALUE_PARAMETER name:it index:0 type:kotlin.collections.List<T of <root>.problematic>
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: kotlin.collections.List<T of <root>.problematic>): kotlin.collections.Iterable<T of <root>.problematic> declared in <root>.problematic'
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: kotlin.collections.List<T of <root>.problematic>): kotlin.collections.Iterable<T of <root>.problematic?> declared in <root>.problematic'
TYPE_OP type=kotlin.collections.List<T of <root>.problematic?> origin=IMPLICIT_NOTNULL typeOperand=kotlin.collections.List<T of <root>.problematic?>
CALL 'public/*package*/ open fun id <T> (v: kotlin.collections.List<T of <root>.ListId.id?>?): @[EnhancedNullability] kotlin.collections.List<T of <root>.ListId.id?> declared in <root>.ListId' type=@[EnhancedNullability] kotlin.collections.List<T of <root>.problematic?> origin=null
<T>: T of <root>.problematic?