Class DefaultedComparisonDelegate
- All Implemented Interfaces:
BiFunction<IAggregateSymbol, ISymbol, DefaultedComparisonDelegate.Resolver>
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal classThe decision for the operators of one aggregate - seeDefaultedComparisonDelegate. -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BiFunction
andThen
-
Constructor Details
-
DefaultedComparisonDelegate
public DefaultedComparisonDelegate()
-
-
Method Details
-
apply
- Specified by:
applyin interfaceBiFunction<IAggregateSymbol, ISymbol, DefaultedComparisonDelegate.Resolver>
-