Class DefaultedComparisonDelegate

java.lang.Object
org.ek9lang.compiler.support.DefaultedComparisonDelegate
All Implemented Interfaces:
BiFunction<IAggregateSymbol, ISymbol, DefaultedComparisonDelegate.Resolver>

public final class DefaultedComparisonDelegate extends Object implements BiFunction<IAggregateSymbol, ISymbol, DefaultedComparisonDelegate.Resolver>
THE decision of which operator a GENERATED comparison is answered by - hold one and use it, do not re-derive it.

A defaulted < <= > >= is <=> against zero. A defaulted == is <=> when the type has its own comparator (HasOwnComparator), otherwise field by field. A defaulted <> is <=> when the type has its own comparator and no hand-written == (HasHandWrittenEquality), otherwise the negation of ==.

Two parts of the compiler must answer this identically: synthesis (SyntheticOperatorGenerator), which emits the delegating call, and the phase-5 call graph, which must hold the same edge - without it an assert in a <=> reached only through a generated < was reported orphaned (E81011) instead of reached from production (E81012) (B18 prerequisite P3). Extracted 2026-09-30 from SyntheticOperatorGenerator's private predicates so they cannot drift; B18 reshapes these rules here, once.

Applied to an aggregate (and the Any type) it gives a DefaultedComparisonDelegate.Resolver for the operators of that ONE aggregate, for a caller that asks about each of them in turn: the type's facts - whether it has its own comparator or a hand-written ==, and which <=> and == serve it - are worked out at most once, not once per operator. A resolver holds answers about the type as it is now, so use it while nothing is being defined into the type.