Avoid using TypeSystemInferenceExtensionContextDelegate in FIR
It's only needed in old FE to avoid clashes when initializing DI The main idea is gettind rid of intermediate interfaces because each of them adds another intermediate DefaultImpls call
This commit is contained in:
+8
-1
@@ -11,8 +11,11 @@ import org.jetbrains.kotlin.types.model.KotlinTypeMarker
|
||||
import org.jetbrains.kotlin.types.model.TypeSystemInferenceExtensionContext
|
||||
import org.jetbrains.kotlin.types.model.TypeSystemInferenceExtensionContextDelegate
|
||||
|
||||
class TrivialConstraintTypeInferenceOracle(context: TypeSystemInferenceExtensionContextDelegate) :
|
||||
class TrivialConstraintTypeInferenceOracle private constructor(context: TypeSystemInferenceExtensionContext) :
|
||||
TypeSystemInferenceExtensionContext by context {
|
||||
// This constructor is used for injection only in old FE
|
||||
constructor(context: TypeSystemInferenceExtensionContextDelegate) : this(context as TypeSystemInferenceExtensionContext)
|
||||
|
||||
// The idea is to add knowledge that constraint `Nothing(?) <: T` is quite useless and
|
||||
// it's totally fine to go and resolve postponed argument without fixation T to Nothing(?).
|
||||
// In other words, constraint `Nothing(?) <: T` is *not* proper
|
||||
@@ -62,4 +65,8 @@ class TrivialConstraintTypeInferenceOracle(context: TypeSystemInferenceExtension
|
||||
private fun KotlinTypeMarker.containsOnlyNonNullableNothing(): Boolean =
|
||||
contains { it.isNothing() } && !contains { it.isNullableNothing() }
|
||||
|
||||
|
||||
companion object {
|
||||
fun create(context: TypeSystemInferenceExtensionContext) = TrivialConstraintTypeInferenceOracle(context)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user