Class GenericFunctionInference

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

public final class GenericFunctionInference extends Object
THE rule for when a call to a generic FUNCTION may infer its type arguments from its arguments (D12, Steve 2026-10-19): only when the function's parameters are exactly its type parameters, in order, and nothing else - the shape of a generic class's inferring constructor (E06050). Then argument N's type IS type argument N.

identity(42) (-> item as T) infers; countOf(names) (-> items as List of T), tag("x", 3) (item as T, count as Integer) and repeat(3) (no T at all) do not: those are written countOf() of String. There is no unification - reading an argument's type as a type argument in any other shape is what crashed IR generation (B-1).

  • Method Details

    • infersFromArguments

      public static boolean infersFromArguments(FunctionSymbol genericFunction)
      True when a call with arguments may infer this generic function's type arguments.