Class SelfComparisonOrError

All Implemented Interfaces:
Consumer<EK9Parser.ExpressionContext>

final class SelfComparisonOrError extends TypedSymbolAccess implements Consumer<EK9Parser.ExpressionContext>
Detects self-comparison expressions where both sides resolve to the same symbol (E08081).

Expressions like value == value (always true), value <> value (always false), or value <=> value (always 0) are pointless and indicate copy-paste errors or logic bugs.

Only comparison operators are flagged. Arithmetic operators like a + a (valid doubling) and logical operators like a and a are not flagged.

Research basis: Microsoft study (2011) found self-comparison bugs in 3% of copy-paste errors. GCC, Clang, and IntelliJ all flag self-comparison as a warning.