Class HasRealOperator
- All Implemented Interfaces:
Predicate<IAggregateSymbol>
<operator>?" - one it declares itself or
inherits from a real (user) super OR from a trait (its own, a super's, or a trait's trait), as opposed to only the degenerate Any.<operator> that
EVERY type inherits (e.g. Any._cmp/Any._string/Any._hashcode, which are the
unset defaults, not value semantics).
It walks the super chain with resolveInThisScopeOnly (declared-at-that-level only) and stops
BEFORE Any, then the type's traits (getAllTraits, which already folds in supers' traits and
traits' traits). Traits were missed until B18: an element whose == came from a trait body, or was
inherited from a super, made a Optional/List wrapper's == a constant UNSET, because
the wrapper generator scanned the element's own scope only (B18 prerequisite P1). This is the generalisation of HasRealComparator (which is now a thin
"<=>" wrapper over this) to any operator glyph - reuse THIS, do not re-derive the
"excludes the degenerate Any operator" walk. Construct once with the resolved Any type, the
operator glyph, and whether the operator is binary (self-typed single argument, e.g. <=>,
==) or unary (no argument, e.g. $, #?).
The synthesis generators (CompareGenerator, EqualsGenerator, ToStringGenerator,
HashCodeGenerator) use this to decide whether a default operator over a field of this
type may direct-call the field type's own operator, or must fall back to Any's - the latter is
required for a monomorphised generic field (e.g. Box of (List of String) where List has
no real <=>), otherwise the emitted call targets a symbol that does not exist (a native
eager-link failure the JVM only tolerates by lazy dispatch).
-
Constructor Details
-
HasRealOperator
-
-
Method Details
-
test
- Specified by:
testin interfacePredicate<IAggregateSymbol>
-