Class SameRuntimeOperator
- All Implemented Interfaces:
BiPredicate<MethodSymbol, MethodSymbol>
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleantest(MethodSymbol first, MethodSymbol second) Are these two operators, spelt differently, one runtime operator with the same parameter types?Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BiPredicate
and, negate, or
-
Constructor Details
-
SameRuntimeOperator
public SameRuntimeOperator()
-
-
Method Details
-
test
Are these two operators, spelt differently, one runtime operator with the same parameter types?- Specified by:
testin interfaceBiPredicate<MethodSymbol, MethodSymbol>- Parameters:
first- an operatorsecond- another operator- Returns:
- true when both lower to the same runtime method and only the spelling differs
-