Class HasRealComparator

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

public final class HasRealComparator extends Object implements Predicate<IAggregateSymbol>
THE shared test for "is this type orderable?" - does it have a REAL <=> operator, one it declares itself or inherits from a real (user) super, as opposed to only the degenerate Any._cmp that EVERY type inherits and which is not value ordering.

It walks the super chain with resolveInThisScopeOnly (declared-at-that-level only) and stops BEFORE Any. This is exactly why a direct list <=> list is rejected with E07620: List declares no <=> and Any._cmp does not count. Used to decide whether a default operator comparison (<=>,<,<=,>,>=) can be produced over a field of this type - reuse this, do not re-derive the "excludes Any._cmp" walk. Construct once with the resolved Any type.

  • Constructor Details

    • HasRealComparator

      public HasRealComparator(ISymbol ek9Any)
  • Method Details

    • test

      public boolean test(IAggregateSymbol type)
      Specified by:
      test in interface Predicate<IAggregateSymbol>
    • isOrderingOperator

      public static boolean isOrderingOperator(MethodSymbol operator)
      The ORDERING operator family - each delegates (directly, or via DerivedComparisonGenerator) to <=>, so each needs the receiver AND every field type to be orderable. Deliberately EXCLUDES == / <>, which are equality-only (delegate to _eq) and remain available on non-orderable-field types.