Class RemovedCoalescingOperatorOrError

java.lang.Object
org.ek9lang.compiler.phase1.RemovedCoalescingOperatorOrError
All Implemented Interfaces:
Consumer<EK9Parser.ExpressionContext>

final class RemovedCoalescingOperatorOrError extends Object implements Consumer<EK9Parser.ExpressionContext>
E01095 (Steve, 2026-10-21, sameness wave 2, section 4.9 b1): the comparison coalescing operators <=? and >=? were removed. On equal values (<=> gives 0) <? and >? now give the LEFT operand, which is what <=? and >=? gave, so each has a plain replacement: <? for <=? and >? for >=?. (To get the RIGHT operand on a tie, swap the operands.)

The grammar keeps recognising the two tokens ONLY to give this error, as it keeps break and return (E0107x); a program that uses one stops here, in phase 1, with a message that names the replacement.

E01096 (Steve, 2026-10-21) is the same for ??, the null coalescing operator: EK9 is designed so that no value is absent, leaving it nothing to test, so x ?? y would give x (D75). It is reported at the ?? token, once per use.

??= (the null coalescing assignment, C#, JavaScript, PHP) is removed with it, under the same E01096: the message names :=? (assign only if currently unset), the assignment that tests unset rather than absent. It is reported by onAssignment(EK9Parser.AssignmentStatementContext) at the ??= token.

isRemoved(Token) is THE test for one of the four tokens: a phase-1 check that would report AT such a token for another reason (E08269 reports a coalescing operand from the enclosing expression, before this one is entered) leaves it to this error, so the first error at the place says what is wrong.

  • Constructor Details

    • RemovedCoalescingOperatorOrError

      RemovedCoalescingOperatorOrError(ErrorListener errorListener)
  • Method Details