Revert "NI: Prefer nullable lower bound to flexible one when substitution of type variable is performed ^KT-32435 Fixed"

This reverts commit 09c2b92b
This commit is contained in:
victor.petukhov
2019-12-11 15:31:38 +03:00
parent ccea2b73da
commit a92f58b1ac
14 changed files with 4 additions and 187 deletions
@@ -136,7 +136,7 @@ abstract class AbstractTypeCheckerContextForConstraintSystem : AbstractTypeCheck
*
* => Foo <: T! -- (Foo!! .. Foo) <: T
*
* Foo? <: T! -- Foo? <: T
* Foo? <: T! -- (Foo!! .. Foo?) <: T
*
*
* (Foo..Bar) <: T! --
@@ -163,11 +163,7 @@ abstract class AbstractTypeCheckerContextForConstraintSystem : AbstractTypeCheck
when (subType) {
is SimpleTypeMarker ->
// Foo <: T! -- (Foo!! .. Foo) <: T
if (subType.isNullableType()) {
subType // prefer nullable type to flexible one: `Foo? <: (T..T?)` => lowerConstraint = `Foo?`
} else {
createFlexibleType(subType.makeSimpleTypeDefinitelyNotNullOrNotNull(), subType)
}
createFlexibleType(subType.makeSimpleTypeDefinitelyNotNullOrNotNull(), subType)
is FlexibleTypeMarker ->
// (Foo..Bar) <: T! -- (Foo!! .. Bar) <: T