Class HasRealOperator

java.lang.Object
org.ek9lang.compiler.common.HasRealOperator
All Implemented Interfaces:
Predicate<IAggregateSymbol>

public final class HasRealOperator extends Object implements Predicate<IAggregateSymbol>
THE shared test for "does this type have a REAL &lt;operator&gt;?" - one it declares itself or inherits from a real (user) super, as opposed to only the degenerate Any.&lt;operator&gt; 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. 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).