Class NearestSelfComparisonAbove

java.lang.Object
org.ek9lang.compiler.support.operators.NearestSelfComparisonAbove

public final class NearestSelfComparisonAbove extends Object
THE nearest SAMENESS operator above an aggregate (D19, Steve 2026-10-20): the nearest operatorName (== or <=>) declared above it that compares the level declaring it with ITSELF (IsSelfComparison) - matched by SIGNATURE, never by name, never Any's. A ==(Integer) compares with an Integer, so it is never an answer: NearestOperatorAbove's any-overload fallback once returned it, and the generated == called it as _eq(Base), a compile-clean NoSuchMethodError. Where a level declares several self-comparisons, the one taking that level itself is preferred. Used by phase 3's E07190 check and by the generated ==/<=> super call, so the two cannot disagree. Hold one.
  • Constructor Details

    • NearestSelfComparisonAbove

      public NearestSelfComparisonAbove()
  • Method Details

    • of

      public Optional<MethodSymbol> of(IAggregateSymbol aggregate, String operatorName, ISymbol ek9Any)
      The nearest self-comparison above, if any.
      Parameters:
      aggregate - the type whose super chain is walked (the type itself is not consulted)
      operatorName - "==" or "<=>"
      ek9Any - the Any type, which is never an answer
      Returns:
      the nearest self-comparison above, if any