Class InheritedOperators
C2 (Steve, 2026-10-08): the generated operators and their phase-3 check once asked only the IMMEDIATE super
(resolveInThisScopeOnly). A field-less Middle between Base (which declares $) and
Leaf (which defaults it) then gave a false E07190, so the middle had to declare the operator itself and
added an empty layer (Leaf(Middle(Base(id=1)), name=leaf)). Every generated operator now calls the NEAREST implementation above, and names its
OWNER in the IR (CALL (Base)super._string()) so a back end never re-derives which class that is
(Contract 19 in EK9_BACKEND_IR_CONTRACTS.md, the same shape as the close chain's
CloseSteps.parentClose(IAggregateSymbol), which is built on this walk).
The walk returns the nearest declaration whatever it is - abstract, hand-written or defaulted - and the caller decides what that means (an abstract one has nothing to call). DEFENSIVE: it keeps its own visited set, because phase 3 can meet a hierarchy loop before TYPE_HIERARCHY_CHECKS has reported it.
-
Method Summary
Modifier and TypeMethodDescriptionstatic List<MethodSymbol> allAbove(IAggregateSymbol aggregate, String operatorName, ISymbol ek9Any) EVERY operator calledoperatorNamedeclared ABOVE the aggregate - each level's own overloads, nearest level first, neverAny's.static Optional<IAggregateSymbol> declarationSiteFor(IAggregateSymbol aggregate, ISymbol ek9Any) Where a missing operator belongs when NOTHING above the aggregate declares it (Q4, Steve 2026-10-08): the nearest super class that HAS fields of its own - the root of the data decides whether its fields are exposed (R4) - or, when no super class has fields, the topmost one (the hierarchy's root belowAny).static Optional<MethodSymbol> declaredOperator(IAggregateSymbol aggregate, String operatorName) The operator calledoperatorNamethis type declares in its OWN scope, preferring the overload that takes the type itself when there are several.static Optional<MethodSymbol> nearestAbove(IAggregateSymbol aggregate, String operatorName, ISymbol ek9Any) The nearest operator calledoperatorNamedeclared ABOVE the aggregate, neverAny's:Anydeclares?$$$#?==<=>for every type, which says nothing about a hierarchy's data.static Optional<MethodSymbol> nearestAbove(IAggregateSymbol aggregate, Function<IAggregateSymbol, Optional<MethodSymbol>> declaredOn) The nearest declaration above the aggregate thatdeclaredOnfinds on a level (asked of each super class in turn, nearest first).static IAggregateSymbolownerOf(MethodSymbol operator) The type that declares the operator - its OWNER, which a generated super call names.
-
Method Details
-
nearestAbove
public static Optional<MethodSymbol> nearestAbove(IAggregateSymbol aggregate, String operatorName, ISymbol ek9Any) The nearest operator calledoperatorNamedeclared ABOVE the aggregate, neverAny's:Anydeclares?$$$#?==<=>for every type, which says nothing about a hierarchy's data. Where a level declares several overloads, the one taking that level itself is preferred (its self-comparison or copy).- Parameters:
aggregate- the type whose super chain is walked (the type itself is not consulted)operatorName- the operator, e.g."$"ek9Any- theAnytype, which is never an answer- Returns:
- the nearest declaration, if any
-
nearestAbove
public static Optional<MethodSymbol> nearestAbove(IAggregateSymbol aggregate, Function<IAggregateSymbol, Optional<MethodSymbol>> declaredOn) The nearest declaration above the aggregate thatdeclaredOnfinds on a level (asked of each super class in turn, nearest first). A trait ends the walk: its operators are not inherited through the class chain. -
allAbove
public static List<MethodSymbol> allAbove(IAggregateSymbol aggregate, String operatorName, ISymbol ek9Any) EVERY operator calledoperatorNamedeclared ABOVE the aggregate - each level's own overloads, nearest level first, neverAny's. The same walk asnearestAbove(IAggregateSymbol, String, ISymbol), for a caller that must meet every inherited signature rather than call the nearest one: a generated:=:overrides each inherited:=:(Super)(PolymorphicCopy, Q5b).- Parameters:
aggregate- the type whose super chain is walked (the type itself is not consulted)operatorName- the operator, e.g.":=:"ek9Any- theAnytype, which is never an answer- Returns:
- every declaration above, nearest level first
-
declarationSiteFor
public static Optional<IAggregateSymbol> declarationSiteFor(IAggregateSymbol aggregate, ISymbol ek9Any) Where a missing operator belongs when NOTHING above the aggregate declares it (Q4, Steve 2026-10-08): the nearest super class that HAS fields of its own - the root of the data decides whether its fields are exposed (R4) - or, when no super class has fields, the topmost one (the hierarchy's root belowAny). Empty only when the aggregate has no super class butAny. -
declaredOperator
public static Optional<MethodSymbol> declaredOperator(IAggregateSymbol aggregate, String operatorName) The operator calledoperatorNamethis type declares in its OWN scope, preferring the overload that takes the type itself when there are several. -
ownerOf
The type that declares the operator - its OWNER, which a generated super call names.
-