Resolution: extract projections from captured flexible type properly

#KT-54100 Fixed
Related to KT-54196, KT-54198
This commit is contained in:
Mikhail Glukhikh
2022-09-20 13:59:29 +02:00
committed by teamcity
parent 8517249776
commit e9bb0f4fda
12 changed files with 130 additions and 4 deletions
@@ -122,6 +122,7 @@ interface ClassicTypeSystemContext : TypeSystemInferenceExtensionContext, TypeSy
}
override fun CapturedTypeMarker.lowerType(): KotlinTypeMarker? {
// TODO: https://youtrack.jetbrains.com/issue/KT-54196 (old captured type here)
require(this is NewCapturedType, this::errorMessage)
return this.lowerType
}
@@ -101,6 +101,7 @@ class FlexibleTypeImpl(lowerBound: SimpleType, upperBound: SimpleType) : Flexibl
assert(!lowerBound.isFlexible()) { "Lower bound of a flexible type can not be flexible: $lowerBound" }
assert(!upperBound.isFlexible()) { "Upper bound of a flexible type can not be flexible: $upperBound" }
// TODO: https://youtrack.jetbrains.com/issue/KT-54198 (two captured types)
assert(lowerBound != upperBound) { "Lower and upper bounds are equal: $lowerBound == $upperBound" }
assert(KotlinTypeChecker.DEFAULT.isSubtypeOf(lowerBound, upperBound)) {
"Lower bound $lowerBound of a flexible type must be a subtype of the upper bound $upperBound"