Class DefaultOperatorCoverage

java.lang.Object
org.ek9lang.compiler.support.DefaultOperatorCoverage

public final class DefaultOperatorCoverage extends Object
THE test of whether a type already has what a default operator would give it - call this, do not re-derive it.

🔑 By SIGNATURE, never by name. A Point with its own ==(Integer) does not have the default ==(Point): the default is still generated beside it, and first == second compiles only because it is (front-end audit FE74, F2 - phase 1 once compared names, and the defaulted <> relying on the missing == crashed code generation). An own operator of that name serves the default only when it can be called with the default's arguments - a user's ==(Point) or ==(Any). Inherited operators are not the type's own and are ignored, as the compiler does.

Extracted 2026-09-29 from OperationFactory (the compiler's bare-default completion) so the editors that decline to write a default operator line the type already has (AlreadyDeclaredOperator, AddOperatorEditor) answer exactly as the compiler does; both had compared names.

  • Method Details

    • servingOwnOperator

      public static Optional<MethodSymbol> servingOwnOperator(IAggregateSymbol aggregate, String operator)
      The type's own operator that already serves default operator <operator>, if any. For an operator that cannot be defaulted there is no default signature to compare, so any own operator of that name answers.
    • accepts

      public static boolean accepts(MethodSymbol existing, MethodSymbol candidate)
      True when the existing operator can be called with the candidate default's arguments.