Class TypeInferenceUtil


  • @Internal
    public final class TypeInferenceUtil
    extends Object
    Utility for performing type inference.

    It assumes that argument assignments have been applied by argument reordering and inserting values for optional arguments.

    The following steps summarize the type inference process.

    • 1. Validate number of arguments.
    • 2. For resolving unknown (NULL) operands: Access the outer wrapping call and try to get its operand type for the return type of the actual call. E.g. for takes_string(this_function(NULL)) infer operands from takes_string(NULL) and use the inferred string type as the return type of this_function(NULL).
    • 3. Try infer unknown operands, fail if not possible.
    • 4. Perform input type validation.
    • 5. Infer return type.
    • 6. (Optional) Infer state types.
    • 7. In the planner: Call the strategies again at any point in time to enrich a DataType that has been created from a logical type with a conversion class.
    • 8. In the planner: Check for an implementation evaluation method matching the operands. The matching happens class-based. Thus, for example, eval(Object) is valid for (INT). Or eval(Object...) is valid for (INT, STRING). We rely on the conversion classes specified by DataType.