Class ConstantComparisonOrError

All Implemented Interfaces:
Consumer<EK9Parser.ExpressionContext>

final class ConstantComparisonOrError extends TypedSymbolAccess implements Consumer<EK9Parser.ExpressionContext>
Detects comparisons where both operands are literals (E08082).

Expressions like 1 == 1 (always true), "hello" <> "world" (always true), or true == false (always false) have predetermined results and indicate logic errors, dead code, or copy-paste mistakes.

Only comparison operators are checked. Arithmetic between literals is valid constant folding and is handled separately by the compiler.

Comparisons inside require/assert are exempt — test code legitimately uses patterns like assert 10 - 3 == 7 to verify runtime arithmetic and operator semantics. The compiler can prove these statically, but the developer's intent is to test execution.