[FIR] Add equality constraint from expected type for some synthetic function calls
This fixes some cases where we infer some type variable inside one of the branches to Nothing instead of the expected type because Nothing appeared in some other branch. Specifically, we add an equality instead of a subtype constraint during completion of calls to synthetic functions for if/when, try and !!. We don't do it when the call contains a (possibly nested) elvis or is inside the RHS of an assignment. Otherwise, we would prevent some smart-casts. #KT-65882 Fixed
This commit is contained in:
committed by
Space Team
parent
eaef7122f6
commit
69a7bf7f68
+2
-2
@@ -371,7 +371,7 @@ FILE fqName:<root> fileName:/1.kt
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.B
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public open fun firstEntry (): kotlin.collections.MutableMap.MutableEntry<kotlin.Any, kotlin.Any> declared in <root>.B'
|
||||
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Nothing origin=EXCLEXCL
|
||||
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.collections.MutableMap.MutableEntry<kotlin.Any, kotlin.Any> origin=EXCLEXCL
|
||||
<T0>: kotlin.Nothing
|
||||
arg0: CONST Null type=kotlin.Nothing? value=null
|
||||
FUN name:putFirst visibility:public modality:OPEN <> ($this:<root>.B, k:kotlin.Any?, v:kotlin.Any?) returnType:kotlin.Any
|
||||
@@ -1251,7 +1251,7 @@ FILE fqName:<root> fileName:/1.kt
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.F
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public open fun reversed (): java.util.SequencedMap<kotlin.Any, kotlin.Any> declared in <root>.F'
|
||||
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Nothing origin=EXCLEXCL
|
||||
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=java.util.SequencedMap<kotlin.Any, kotlin.Any> origin=EXCLEXCL
|
||||
<T0>: kotlin.Nothing
|
||||
arg0: CONST Null type=kotlin.Nothing? value=null
|
||||
PROPERTY FAKE_OVERRIDE name:entries visibility:public modality:ABSTRACT [fake_override,val]
|
||||
|
||||
Reference in New Issue
Block a user