[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:
committed by
Space Team
parent
8d04ab3142
commit
c9d7b47900
+2
-2
@@ -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<!>
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user