Class TypeMap

java.lang.Object
net.hydromatic.morel.compile.TypeMap

public class TypeMap extends Object
The result of type resolution, a map from AST nodes to types.
  • Field Details

    • typeSystem

      public final TypeSystem typeSystem
    • nodeTypeTerms

      private final Map<AstNode,Unifier.Term> nodeTypeTerms
    • substitution

      final Unifier.Substitution substitution
    • typeVars

      private final Map<String,TypeVar> typeVars
      Map from type variable name to type variable. The ordinal of the variable is the size of the map at the time it is registered.

      This map is never iterated over, and therefore the deterministic iteration provided by LinkedHashMap is not necessary, and HashMap is sufficient.

  • Constructor Details

  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • termToType

      Type termToType(Unifier.Term term)
    • getType

      public Type getType(AstNode node)
      Returns the type of an AST node.
    • getTypeOpt

      @Nullable public Type getTypeOpt(AstNode node)
      Returns the type of an AST node, or null if no type is known.
    • typeIsVariable

      public boolean typeIsVariable(AstNode node)
      Returns whether the type of an AST node will be a type variable.
    • hasType

      public boolean hasType(AstNode node)
      Returns whether an AST node has a type.

      If it does not, perhaps it was ignored by the unification algorithm because it is not relevant to the program.