[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.
diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/IntersectionWithJavaString.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/IntersectionWithJavaString.kt
index 3fd79de..907f337 100644
--- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/IntersectionWithJavaString.kt
+++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/IntersectionWithJavaString.kt
@@ -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) {}
}
diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirEqualityCompatibilityChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirEqualityCompatibilityChecker.kt
index 672272e..87f8228 100644
--- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirEqualityCompatibilityChecker.kt
+++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirEqualityCompatibilityChecker.kt
@@ -121,14 +121,12 @@
// 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)
}
}
diff --git a/compiler/testData/diagnostics/tests/BinaryCallsOnNullableValues.fir.kt b/compiler/testData/diagnostics/tests/BinaryCallsOnNullableValues.fir.kt
index 76c71e0..0244920 100644
--- a/compiler/testData/diagnostics/tests/BinaryCallsOnNullableValues.fir.kt
+++ b/compiler/testData/diagnostics/tests/BinaryCallsOnNullableValues.fir.kt
@@ -10,8 +10,8 @@
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<!>