Class CloseableErasedByStoreOrError
A closeable value STORED into a variable, property or returning variable whose DECLARED type is not
closeable - x as IO: HTTP(), s as StringInput: TextFile(p).input(), a as Any: Res() -
escapes both halves of the ownership rule: the slot's type has no close, so E81056 does not see a
closeable local and nothing can ever close it through that name; and the statement that created the value sees
a store, so it hands the value on instead of closing it. Nothing ever closes it.
A store is a StoreSite: a declaration with an initialiser (<-, :=, =,
:) or a pointer assignment (:=, =, :, :=?) as
ReferenceAssignment.repointsTarget(EK9Parser.AssignmentStatementContext) reads it, to a local, a property or the returning variable alike.
A merge, copy or other in-place operator hands the value to the target's operator and stores no reference.
An ARGUMENT is not a store: passing a
CloseableStringInput to a StringInput parameter lends a view, and the owner still closes it.
"Closeable" is CloseableResourceToBeChecked.isManagedCloseableType(ISymbol), the one predicate E81056 and the
statement wrap ask, so a slot typed as the Closeable trait (which has close) is a closeable slot,
and the global standard streams are never closeable values.
-
Field Summary
Fields inherited from class RuleSupport
errorListener, symbolsAndScopes -
Constructor Summary
ConstructorsConstructorDescriptionCloseableErasedByStoreOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener) -
Method Summary
Modifier and TypeMethodDescription(package private) voidA pointer assignment to an existing variable or property (by name or through an object access).(package private) voidA declaration with an initialiser: the declared type is the slot, the initialiser the value.
-
Constructor Details
-
CloseableErasedByStoreOrError
CloseableErasedByStoreOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener)
-
-
Method Details
-
accept
A declaration with an initialiser: the declared type is the slot, the initialiser the value. -
accept
A pointer assignment to an existing variable or property (by name or through an object access).
-