[FIR] Report == for identity-less

Since we forbid overriding `equals` for
value classes, and value classes may only
implement interfaces, we know everything
about their `equals`, hence we can
guarantee if it always returns `false`
for different value classes.
This commit is contained in:
Nikolay Lunyak
2023-04-19 14:54:26 +03:00
committed by Space Team
parent 8d04ab3142
commit c9d7b47900
2 changed files with 4 additions and 3 deletions
@@ -86,13 +86,13 @@ fun incompatibleIdentityRegardlessNullabilitySmartCast(a: Any?, b: Any?) {
}
fun incompatibleIdentityRegardlessNullabilityWithValueClasses(c: C?, d: D?) {
c == d
<!EQUALITY_NOT_APPLICABLE!>c == d<!>
<!FORBIDDEN_IDENTITY_EQUALS!>c === d<!>
}
fun incompatibleIdentityRegardlessNullabilityWithValueClassesSmartCast(c: Any?, d: Any?) {
if (c is C? && d is D?) {
c == d
<!EQUALITY_NOT_APPLICABLE_WARNING!>c == d<!>
<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>c === d<!>
}
}