Class RedundantConditionMatrix

java.lang.Object
org.ek9lang.compiler.phase5.RedundantConditionMatrix

final class RedundantConditionMatrix extends Object
THE matrix of the redundant-condition checks - the set check (x?, E08088/E08089) and the empty check (x empty, E08092/E08093) - deciding which error a provable answer earns (F29, 2026-10-20: it was written out twice). The caller works out whether the checked property provably HOLDS (result TRUE) or provably does NOT (result FALSE) and whether the check is negated; this says what to report:
  • the check can never pass (holds and negated, or does not hold and plain): the "never" error. A negated check that cannot pass is a runtime bug, so it is reported even inside require/assert.
  • the check always passes (holds and plain, or does not hold and negated): the "redundant" error, which is suppressed inside require/assert - that is scaffolding, such as require x?.
One cell is a deliberate per-check decision, stated by suppressNeverWhenPlainInRequireOrAssert: a plain check that cannot pass. The set check suppresses it inside require/assert, because USED_BEFORE_INITIALISED already flags the same site; the empty check does not, because a provably NON-EMPTY collection is not an uninitialised one and nothing else flags it.
  • Constructor Details

  • Method Details

    • report

      void report(org.antlr.v4.runtime.Token at, ConditionResult result, boolean negated, boolean inRequireOrAssert, String plainMessage, String negatedMessage)
      Report what the answer earns, if anything.
      Parameters:
      at - where the error is reported
      result - TRUE when the checked property provably holds, FALSE when it provably does not
      negated - whether the check is written negated (not x?, x not empty)
      inRequireOrAssert - whether the check sits inside a require or assert
      plainMessage - the message when the check is plain
      negatedMessage - the message when the check is negated