Decouple TypeCheckerContext and TypeSystemContext
This commit is contained in:
committed by
TeamCityServer
parent
53a7dc1126
commit
3909e3c54c
+11
-6
@@ -23,7 +23,9 @@ import org.jetbrains.kotlin.types.TypeConstructor
|
||||
import org.jetbrains.kotlin.types.TypeConstructorSubstitution
|
||||
import org.jetbrains.kotlin.types.TypeSubstitutor
|
||||
import org.jetbrains.kotlin.types.checker.ClassicTypeCheckerContext
|
||||
import org.jetbrains.kotlin.types.checker.ClassicTypeSystemContext
|
||||
import org.jetbrains.kotlin.types.checker.NewKotlinTypeChecker
|
||||
import org.jetbrains.kotlin.types.model.TypeConstructorMarker
|
||||
import org.jetbrains.kotlin.types.typeUtil.asTypeProjection
|
||||
import org.jetbrains.kotlin.utils.SmartList
|
||||
import org.jetbrains.kotlin.utils.keysToMap
|
||||
@@ -326,14 +328,17 @@ object ExpectedActualResolver {
|
||||
if (b == null) return false
|
||||
|
||||
with(NewKotlinTypeChecker.Default) {
|
||||
val context = object : ClassicTypeCheckerContext(false) {
|
||||
override fun areEqualTypeConstructors(a: TypeConstructor, b: TypeConstructor): Boolean {
|
||||
return isExpectedClassAndActualTypeAlias(a, b, platformModule) ||
|
||||
isExpectedClassAndActualTypeAlias(b, a, platformModule) ||
|
||||
super.areEqualTypeConstructors(a, b)
|
||||
val context = object : ClassicTypeSystemContext {
|
||||
override fun areEqualTypeConstructors(c1: TypeConstructorMarker, c2: TypeConstructorMarker): Boolean {
|
||||
require(c1 is TypeConstructor)
|
||||
require(c2 is TypeConstructor)
|
||||
return isExpectedClassAndActualTypeAlias(c1, c2, platformModule) ||
|
||||
isExpectedClassAndActualTypeAlias(c2, c1, platformModule) ||
|
||||
super.areEqualTypeConstructors(c1, c2)
|
||||
}
|
||||
}
|
||||
return context.equalTypes(a.unwrap(), b.unwrap())
|
||||
return ClassicTypeCheckerContext(errorTypeEqualsToAnything = false, typeSystemContext = context)
|
||||
.equalTypes(a.unwrap(), b.unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user