Class ConstantCoalescingOrError

All Implemented Interfaces:
Consumer<EK9Parser.ExpressionContext>

final class ConstantCoalescingOrError extends TypedSymbolAccess implements Consumer<EK9Parser.ExpressionContext>
Detects coalescing expressions where both operands are literals (E08094).

Expressions like 5 <? 3 (always 3), "alpha" >? "beta" (always "beta"), or 1.0 <=? 2.0 (always 1.0) have predetermined results and indicate logic errors, dead code, or copy-paste mistakes.

Exemptions: coalescing expressions inside require, assert, and constrain statements are not flagged, as these are test assertions where literal expressions serve a documentation purpose.

Only the coalescing comparison operators (<?, >?, <=?, >=?) are checked. These use ctx.coalescing_equality in the grammar, not ctx.op.