[FIR] Fold flexible types after substitution if possible
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@ FILE: main.kt
|
||||
^ R|<local>/x|.R|kotlin/Any.toString|()
|
||||
}
|
||||
)
|
||||
R|/MyFunction|<R|kotlin/Nothing|, R|kotlin/Any?|>(<L> = MyFunction@fun <anonymous>(x: R|ft<kotlin/Nothing, kotlin/Nothing?>!|): R|ft<kotlin/Any?, kotlin/Any?>?| {
|
||||
R|/MyFunction|<R|kotlin/Nothing|, R|kotlin/Any?|>(<L> = MyFunction@fun <anonymous>(x: R|ft<kotlin/Nothing, kotlin/Nothing?>!|): R|kotlin/Any?| {
|
||||
^ String()
|
||||
}
|
||||
)
|
||||
|
||||
+6
-1
@@ -50,7 +50,12 @@ abstract class AbstractConeSubstitutor : ConeSubstitutor() {
|
||||
is ConeClassErrorType -> return null
|
||||
is ConeClassLikeType -> this.substituteArguments()
|
||||
is ConeLookupTagBasedType -> return null
|
||||
is ConeFlexibleType -> this.substituteBounds()
|
||||
is ConeFlexibleType -> this.substituteBounds()?.let {
|
||||
// TODO: may be (?) it's worth adding regular type comparison via AbstractTypeChecker
|
||||
// However, the simplified check here should be enough for typical flexible types
|
||||
if (it.lowerBound == it.upperBound) it.lowerBound
|
||||
else it
|
||||
}
|
||||
is ConeCapturedType -> return null
|
||||
is ConeDefinitelyNotNullType -> this.substituteOriginal()
|
||||
is ConeIntersectionType -> this.substituteIntersectedTypes()
|
||||
|
||||
Reference in New Issue
Block a user