[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()
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ public class JavaClassCase3{
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case3() {
|
||||
val x = JavaClassCase3.id(null) // Nothing!
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?..kotlin.Nothing??")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>
|
||||
val a = if (x) {
|
||||
"NOK"
|
||||
} else "NOK"
|
||||
|
||||
Reference in New Issue
Block a user