Class CloseOperatorCallOrError

java.lang.Object
org.ek9lang.compiler.common.RuleSupport
org.ek9lang.compiler.phase3.CloseOperatorCallOrError

final class CloseOperatorCallOrError extends RuleSupport
The close operator is never called by EK9 code (E81060, Steve 2026-10-05, 2026-10-06).

Closing is generated (D4): a try-with-resources resource is closed when its try ends, a closeable value a statement makes but never names is closed when that statement finishes, and a type's own closeable properties are closed by its operator close - default operator close or one the developer writes for extra work - which ends with the generated chain (CloseSteps). There is no close statement any more (the grammar keeps close x only to report E01094). Calling the operator as a METHOD - res.close(), this.close(), a bare close() inside the type, make().close() - would close a value its owner still closes, so a try resource could be closed inside its try and again by the try, a capture closed under the scope that owns it, a property closed and then used. Any call that resolves to a close operator, on any receiver, is therefore an error. The compiler's own closes are generated in IR and never pass through here.

super.close() is no exception (Steve, 2026-10-06): the generated chain closes the type's own closeable properties and then calls the super CLASS's close non-virtually, so a hand-written super.close() would close the super's resources twice.

  • Constructor Details

  • Method Details

    • accept

      void accept(IToken errorLocation, ISymbol resolved, boolean viaSuper)
      Check a call that has been resolved.
      Parameters:
      errorLocation - where the call is written
      resolved - what the call resolved to
      viaSuper - true when the call is written super.close()