[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
@@ -276,7 +276,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 reversed (): java.util.SequencedCollection<kotlin.Int> 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=java.util.SequencedCollection<kotlin.Int> origin=EXCLEXCL
|
||||
<T0>: kotlin.Nothing
|
||||
arg0: CONST Null type=kotlin.Nothing? value=null
|
||||
CLASS CLASS name:C modality:ABSTRACT visibility:public superTypes:[<root>.Java1]
|
||||
@@ -543,7 +543,7 @@ FILE fqName:<root> fileName:/1.kt
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.D
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public open fun reversed (): java.util.SequencedCollection<kotlin.Int> declared in <root>.D'
|
||||
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.SequencedCollection<kotlin.Int> origin=EXCLEXCL
|
||||
<T0>: kotlin.Nothing
|
||||
arg0: CONST Null type=kotlin.Nothing? value=null
|
||||
PROPERTY name:size visibility:public modality:OPEN [val]
|
||||
|
||||
Reference in New Issue
Block a user