[FIR] Ensure K2 doesn't report Int? === String?

This commit is contained in:
Nikolay Lunyak
2023-04-19 10:02:49 +03:00
committed by Space Team
parent 898ed7658a
commit 5ecedcbb16
2 changed files with 48 additions and 0 deletions
@@ -72,3 +72,27 @@ fun incompatibleEnumComparisonSmartCast(c: Any?, e: Any?) {
c == e
}
}
fun incompatibleIdentityRegardlessNullability(a: Int?, b: String?) {
<!EQUALITY_NOT_APPLICABLE!>a == b<!>
<!EQUALITY_NOT_APPLICABLE!>a === b<!>
}
fun incompatibleIdentityRegardlessNullabilitySmartCast(a: Any?, b: Any?) {
if (a is Int? && b is String?) {
a == b
a === b
}
}
fun incompatibleIdentityRegardlessNullabilityWithValueClasses(c: C?, d: D?) {
<!EQUALITY_NOT_APPLICABLE!>c == d<!>
<!EQUALITY_NOT_APPLICABLE, FORBIDDEN_IDENTITY_EQUALS!>c === d<!>
}
fun incompatibleIdentityRegardlessNullabilityWithValueClassesSmartCast(c: Any?, d: Any?) {
if (c is C? && d is D?) {
c == d
c === d
}
}