[FIR] Remove the fast path if as insignificant

This if is a bit inconsistent with the
LUB checking approach, so if it doesn't
improve performance it's better to remove it.
This commit is contained in:
Nikolay Lunyak
2023-04-04 15:15:43 +03:00
committed by Space Team
parent 4813b659ab
commit 3987efa036
3 changed files with 6 additions and 8 deletions
@@ -5,5 +5,5 @@
fun collapse(path: String) {
val result = (path as <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.String<!>).replace("123", "456")
if (<!EQUALITY_NOT_APPLICABLE_WARNING!>result !== path<!>) {}
if (result !== path) {}
}
@@ -121,14 +121,12 @@ object FirEqualityCompatibilityChecker : FirEqualityOperatorCallChecker() {
// we only need to check if one is related
// to the other
fun TypeInfo.isSubclassOf(other: TypeInfo) = when {
other.enforcesEmptyIntersection -> type.classId == other.type.classId
else -> notNullType.isSubtypeOf(other.notNullType, context.session)
}
fun TypeInfo.isSubtypeOf(other: TypeInfo) =
notNullType.isSubtypeOf(other.notNullType, context.session)
return when {
l.type.isNothingOrNullableNothing || r.type.isNothingOrNullableNothing -> false
else -> !l.isSubclassOf(r) && !r.isSubclassOf(l)
else -> !l.isSubtypeOf(r) && !r.isSubtypeOf(l)
}
}
@@ -10,8 +10,8 @@ fun f(): Unit {
x <!UNSAFE_OPERATOR_CALL!><<!> 1
<!ASSIGNMENT_TYPE_MISMATCH!>x += 1<!>
<!EQUALITY_NOT_APPLICABLE_WARNING!>x == 1<!>
<!EQUALITY_NOT_APPLICABLE_WARNING!>x != 1<!>
x == 1
x != 1
<!EQUALITY_NOT_APPLICABLE!>A() == 1<!>