Class SynthesizeSuperFunction

java.lang.Object
org.ek9lang.compiler.phase2.SynthesizeSuperFunction
All Implemented Interfaces:
Consumer<FunctionSymbol>

final class SynthesizeSuperFunction extends Object implements Consumer<FunctionSymbol>
Looks at the function and if it has no super function, attempts to work out what would be the best super function generic type it could implement.

Also ensures that purity is retained. So for some abstract generic functions like UnaryOperator of T for example the function must be pure. i.e. is it really a Supplier of T and Consumer of T, etc.

The reason for this, is that it enables just functions to be defined but then accept them via their generic function signature. Less coding for the EK9 developer.

A closeable type is never a type argument (E81061), and that holds for the compiler's own parameterisations too (D7, Steve 2026-10-06): a function whose parameter or return type is closeable gets NO implicit generic super (no Consumer of TCP, Acceptor of Res, Supplier of Res, ...) - its super is Any, as for any function with no idiomatic super. A caller that wants to pass such a function declares a dedicated non-generic function type for it, as TCPReadyHandler does. The parameterisations made here are checked by CloseableNotInGenericParameterOrError like any other, so a synthesis path that ever named a closeable would be an E81061, not a silent exemption.