Class FunctionRelations


  • public class FunctionRelations
    extends java.lang.Object
    calculates, e.g., whether a function can be called given specified arguments, one may assume this functionality ought to be in SymTypeOfFunction, however, it relies on other functionality in SymTypeRelations, and the behaviour of SymTypeClasses should not be dependent on the current type system (or one would need to pass the SymTypeRelations to the SymTypes) delegate of SymTypeRelations
    • Constructor Detail

      • FunctionRelations

        public FunctionRelations()
    • Method Detail

      • canBeCalledWith

        public static boolean canBeCalledWith​(SymTypeOfFunction func,
                                              java.util.List<SymTypeExpression> args)
        whether the function can be called with the given arguments.
      • getMostSpecificFunctionOrLogError

        public static java.util.Optional<SymTypeOfFunction> getMostSpecificFunctionOrLogError​(java.util.Collection<SymTypeOfFunction> funcs)
        for overloaded and applicable(!) functions, selects the best fitting one we expect inferred arities (no elliptic functions) simplified version (which can be extended) of: * Java spec v.20 15.12.2.5 * Java spec v.20 18.5.4
      • _getMostSpecificFunctionOrLogError

        protected java.util.Optional<SymTypeOfFunction> _getMostSpecificFunctionOrLogError​(java.util.Collection<SymTypeOfFunction> funcs)
      • getMostSpecificFunctions

        protected java.util.List<SymTypeOfFunction> getMostSpecificFunctions​(java.util.Collection<SymTypeOfFunction> funcs)
        calculates the most specific functionS(!). This is never required (one only ever needs THE most specific function), except to give better log messages.
      • internal_canPotentiallyBeCalledWith

        public static boolean internal_canPotentiallyBeCalledWith​(SymTypeOfFunction func,
                                                                  java.util.List<SymTypeExpression> args)
        does not check the argument types for generic methods s.a. Java spec 21 15.12.2.1 ignores "potential compatibility" poly expressions
      • printFunctionForLog

        protected java.lang.String printFunctionForLog​(SymTypeOfFunction func)
      • init

        public static void init()
      • reset

        public static void reset()