• Andrei Paskevich's avatar
    Mlw: slightly generalize the rules for overloading · 084211c1
    Andrei Paskevich authored
    A symbol is now considered overloadable if it satisfies
    the following conditions:
      - it has at least one parameter
      - it is non-ghost and has fully visible result
      - all of its parameters are non-ghost and have the same type
      - its result is either of the same type as its parameters
        or it is a monomorphic immutable type.
    
    An overloadable symbol can be combined with other symbols of the
    same arity and overloading kind. Otherwise, the new symbol shadows
    the previously defined ones.
    
    This generalisation allows us to overload symbols such as "size"
    or "length", and also symbols of arbitraty non-zero arity.
    
    I am reluctant to generalize this any further, because then we
    won't have reasonable destructible signatures for type inference.
    084211c1
pmodule.ml 45.8 KB