Class OperatorKeepsValueUnsetOrError
text <- String() then text += "more", or count <- Integer()
then count++. The operation can never give the value a value: the program runs and quietly leaves it
unset.
🔑 Steve's rule (2026-10-26): fire ONLY when the compiler is sure the value is unset AND sure the operation
cannot set it; anything uncertain is silent, never an error. Sure the value is unset: the value tracker holds it
UNSET (a CONSTRUCTS_UNSET constructor, or if not x?); inside a loop the finding waits until every
enclosing loop ends without writing the variable (ValueTrackingAnalyzer.reportWhenSure(ISymbol, Runnable)). Sure the operation
cannot set it: the RESOLVED operator carries KEEPS_UNSET (UnsetKeepingOperator), which only the
built-in literal types' += -= *= /= ++ -- do - a user type's operator never does, so it stays silent.
Aliasing, calls and escapes leave the value unknown exactly as they always have.
A <- guard's variable in a later block of its own if chain is left to E08270, which reports
every use there.
Not covered: x := x + 1 (a store of a new value, which is unset too, but through a different route).
-
Constructor Summary
ConstructorsConstructorDescriptionOperatorKeepsValueUnsetOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener, ValueTrackingAnalyzer valueTracker) -
Method Summary
Modifier and TypeMethodDescription(package private) voidThe right-hand side of an assignment statement has been walked: a target kept unset is reported if it is still known unset (a call in the right-hand side that may have changed it leaves it unknown, and silent).(package private) voidconstructedUnset(ISymbol symbol, ISymbol type) symbolwas given the value aCONSTRUCTS_UNSETconstructor oftypemakes.(package private) voiddeclaredWithoutValue(ISymbol symbol) symbolwas declaredas T?, with no value.(package private) booleankeepsIncrementedUnset(EK9Parser.IdentifierContext ctx, ISymbol target) An identifier written in place byx++orx--: true when it is UNSET and the operator keeps it unset - reported, and it stays UNSET.(package private) booleankeepsTargetUnset(EK9Parser.AssignmentStatementContext ctx, ISymbol target) An assignment statementx += y(any in-place operator but a store): true when its target is UNSET and the operator keeps it unset - the target then stays UNSET and the finding is made once the right-hand side has been walked (assignmentCompleted(EK9Parser.AssignmentStatementContext)).(package private) voidsymbolwas narrowed by a set-check (if not x?): known unset now because of the check.(package private) voidotherwiseGiven(ISymbol symbol) symbolwas given some other value, by a store or a narrowing.
-
Constructor Details
-
OperatorKeepsValueUnsetOrError
OperatorKeepsValueUnsetOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener, ValueTrackingAnalyzer valueTracker)
-
-
Method Details
-
constructedUnset
-
declaredWithoutValue
symbolwas declaredas T?, with no value. -
otherwiseGiven
symbolwas given some other value, by a store or a narrowing. -
narrowed
symbolwas narrowed by a set-check (if not x?): known unset now because of the check. -
keepsTargetUnset
An assignment statementx += y(any in-place operator but a store): true when its target is UNSET and the operator keeps it unset - the target then stays UNSET and the finding is made once the right-hand side has been walked (assignmentCompleted(EK9Parser.AssignmentStatementContext)). -
assignmentCompleted
The right-hand side of an assignment statement has been walked: a target kept unset is reported if it is still known unset (a call in the right-hand side that may have changed it leaves it unknown, and silent). -
keepsIncrementedUnset
An identifier written in place byx++orx--: true when it is UNSET and the operator keeps it unset - reported, and it stays UNSET.
-