Class DispatcherAmbiguityOrError

java.lang.Object
org.ek9lang.compiler.phase5.DispatcherAmbiguityOrError

final class DispatcherAmbiguityOrError extends Object
Validates that no reachable type in a dispatcher's hierarchy resolves ambiguously between two or more handlers at equal cost.

The dispatcher entry point (marked as dispatcher) is treated as the fallback of last resort — it only handles types that no specific handler matches. Specific handlers are preferred over the entry point, which is excluded from competition during ambiguity analysis.

For each reachable type in the base type's hierarchy, the checker computes the assignment cost to each handler's parameter type. If two or more handlers match at equal cost (within tolerance), this is an ambiguity error.