Class MultiType

java.lang.Object
net.hydromatic.morel.type.MultiType
All Implemented Interfaces:
Type

public class MultiType extends Object implements Type
Overloaded type.

Not really a type, just a way for a BuiltIn.typeFunction to indicate that it is overloaded. An overloaded function has a type that is a MultiType. Each of those types must be a function type and must differ on the argument type.

For example, int -> int and int * string -> real is a good pair of overloads. int -> int and int -> int -> string is not a good pair of overloads because both have int as the argument type.

  • Field Details

  • Constructor Details

  • Method Details

    • key

      public Type.Key key()
      Description copied from interface: Type
      Description of the type, e.g. "int", "int -> int", " NONE | SOME of 'a".
      Specified by:
      key in interface Type
    • op

      public Op op()
      Description copied from interface: Type
      Type operator.
      Specified by:
      op in interface Type
    • copy

      public Type copy(TypeSystem typeSystem, UnaryOperator<Type> transform)
      Description copied from interface: Type
      Copies this type, applying a given transform to component types, and returning the original type if the component types are unchanged.
      Specified by:
      copy in interface Type
    • accept

      public <R> R accept(TypeVisitor<R> typeVisitor)
      Specified by:
      accept in interface Type