[NI] More accurate handle of capture types from subtyping

#KT-31520 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2019-05-21 16:36:46 +03:00
parent cc29ca02f8
commit 5173d5e359
8 changed files with 64 additions and 6 deletions
@@ -181,7 +181,7 @@ class ConstraintInjector(val constraintIncorporator: ConstraintIncorporator, val
if (kind == UPPER) {
val subType =
typeApproximator.approximateToSubType(type, TypeApproximatorConfiguration.SubtypeCapturedTypesApproximation)
if (subType != null && !subType.typeConstructor().isNothingConstructor()) {
if (subType != null) {
targetType = subType
}
}
@@ -189,7 +189,7 @@ class ConstraintInjector(val constraintIncorporator: ConstraintIncorporator, val
if (kind == LOWER) {
val superType =
typeApproximator.approximateToSuperType(type, TypeApproximatorConfiguration.SubtypeCapturedTypesApproximation)
if (superType != null && !superType.typeConstructor().isAnyConstructor()) { // todo rethink error reporting for Any cases
if (superType != null) { // todo rethink error reporting for Any cases
targetType = superType
}
}