Class SameRuntimeOperator

java.lang.Object
org.ek9lang.compiler.support.SameRuntimeOperator
All Implemented Interfaces:
BiPredicate<MethodSymbol, MethodSymbol>

public final class SameRuntimeOperator extends Object implements BiPredicate<MethodSymbol, MethodSymbol>
THE test that two DIFFERENTLY SPELT operators are one runtime operator - hold one and ask it, do not re-derive it.

Some operators have more than one spelling: unary - and ~ are both negation, _negate (OperatorMap.getPrefixForward(String); word not is a third spelling, but cannot be declared). Two such declarations with the same parameter types are the same method once lowered, so they are judged by the runtime name OperatorMap.resolvedMethodName(MethodSymbol) gives them - derived from the map, never a hand list of aliases. A message naming that runtime name asks OperatorMap.resolvedMethodName(MethodSymbol) itself; the first other spelling among several is OtherSpellingIn.

D59 (2026-10-21): a class declaring both unary - and ~ compiled and failed at class load with ClassFormatError: Duplicate method name "_negate", because the duplicate check matched EK9 names. Phase 2's NoDuplicateOperationsOrError reports the second in one type, and phase 3's override check reports a sub-type spelling an inherited operator differently (super ~, sub-type -), which compiled and ran different code for -x and ~x. Both are E02030.

  • Constructor Details

    • SameRuntimeOperator

      public SameRuntimeOperator()
  • Method Details

    • test

      public boolean test(MethodSymbol first, MethodSymbol second)
      Are these two operators, spelt differently, one runtime operator with the same parameter types?
      Specified by:
      test in interface BiPredicate<MethodSymbol, MethodSymbol>
      Parameters:
      first - an operator
      second - another operator
      Returns:
      true when both lower to the same runtime method and only the spelling differs