Class RedundantConditionMatrix
java.lang.Object
org.ek9lang.compiler.phase5.RedundantConditionMatrix
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 asrequire x?.
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 Summary
ConstructorsConstructorDescriptionRedundantConditionMatrix(ErrorListener errorListener, ErrorListener.SemanticClassification redundant, ErrorListener.SemanticClassification never, boolean suppressNeverWhenPlainInRequireOrAssert) -
Method Summary
Modifier and TypeMethodDescription(package private) voidreport(org.antlr.v4.runtime.Token at, ConditionResult result, boolean negated, boolean inRequireOrAssert, String plainMessage, String negatedMessage) Report what the answer earns, if anything.
-
Constructor Details
-
RedundantConditionMatrix
RedundantConditionMatrix(ErrorListener errorListener, ErrorListener.SemanticClassification redundant, ErrorListener.SemanticClassification never, boolean suppressNeverWhenPlainInRequireOrAssert)
-
-
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 reportedresult- TRUE when the checked property provably holds, FALSE when it provably does notnegated- whether the check is written negated (not x?,x not empty)inRequireOrAssert- whether the check sits inside arequireorassertplainMessage- the message when the check is plainnegatedMessage- the message when the check is negated
-