Class TypeInferenceUtil


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

    The following steps summarize the envisioned type inference process. Not all features are implemented or exposed through the API yet (*).

    • 1. Validate number of arguments.
    • 2. (*) Apply assignment operators on the call by permuting operands and adding default values. These are preparations for CallContext.
    • 3. 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).
    • 4. Try infer unknown operands, fail if not possible.
    • 5. (*) Check the usage of DEFAULT operands are correct using validator.isOptional().
    • 6. Perform input type validation.
    • 7. (Optional) Infer accumulator type.
    • 8. Infer return type.
    • 9. (*) 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.
    • 10. (*) 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.