Class OwnershipBorrowVerifier

java.lang.Object
org.ek9lang.compiler.phase9.OwnershipBorrowVerifier
All Implemented Interfaces:
Function<IRConstruct, List<String>>

public final class OwnershipBorrowVerifier extends Object implements Function<IRConstruct, List<String>>
THE borrow rule of the ownership form, V-I (EK9_IR_OWNERSHIP_MODEL.md §8, EK9_IR_OWNERSHIP_STAGE4_DESIGN.md §6): no borrowed value is used after its source may have let it go.
  • A local borrow - t = LOAD x - is valid until the next SLOT_ASSIGN x / STORE x on the path, or the exit of x's owner region. A call does not end it: EK9 has no address-of.
  • A heap borrow - LOAD_FIELD, LOAD_STATIC_FIELD, a capture read - must be OWNed before any call, field or static store, or chain merge: another method may reassign the field, and releasing its old value frees what the borrow points at. pure licenses nothing: :=? is legal in a pure scope on any object, and a FIELD_ASSIGN releases the old value.

Paths, with "the borrow ended" a MAY fact: the union over flat branches at a label; a chain as it runs (each condition in turn, an arm's body after its own condition, a try's handlers from anywhere in its body); a loop's iteration walked twice, so a borrow ended late in one iteration is seen ended at a use early in the next; any other composite's list may or may not run, and the values it defines take their state from running it alone.

ENFORCED (design §6): IR_ANALYSIS fails a compile on any finding, as it does for OwnershipPathVerifier. It was measured report-only first over every corpus (703 findings over the codegen fixtures, to 0). Each finding starts with a shape tag - (V-I heap-call ...), (V-I use-after ...), (V-I merge) - carrying the callee's kind and declared purity, so the corpus measurement can group them (Steve, 2026-10-28: measure every refinement, assume none). Two are made, each measured and argued: a field of a RAW form (an enum's _ordinal) holds no count, so loading it borrows nothing; and a call that runs no EK9 code (RunsNoEk9Code) can neither reassign a field nor release a value.

  • Constructor Details

    • OwnershipBorrowVerifier

      public OwnershipBorrowVerifier()
  • Method Details