Package net.hydromatic.morel.compile
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classTypeMap.TermToTypeConverterVisitor that converts type terms into actual types.
-
Field Summary
Fields Modifier and Type Field Description private Map<AstNode,Unifier.Term>nodeTypeTerms(package private) Unifier.SubstitutionsubstitutionTypeSystemtypeSystemprivate Map<String,TypeVar>typeVars
-
Constructor Summary
Constructors Constructor Description TypeMap(TypeSystem typeSystem, Map<AstNode,Unifier.Term> nodeTypeTerms, Unifier.Substitution substitution)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TypegetType(AstNode node)Returns the type of an AST node.TypegetTypeOpt(AstNode node)Returns the type of an AST node, or null if no type is known.booleanhasType(AstNode node)Returns whether an AST node has a type.(package private) TypetermToType(Unifier.Term term)StringtoString()booleantypeIsVariable(AstNode node)Returns whether the type of an AST node will be a type variable.
-
-
-
Field Detail
-
typeSystem
public final TypeSystem typeSystem
-
nodeTypeTerms
private final Map<AstNode,Unifier.Term> nodeTypeTerms
-
substitution
final Unifier.Substitution substitution
-
-
Constructor Detail
-
TypeMap
TypeMap(TypeSystem typeSystem, Map<AstNode,Unifier.Term> nodeTypeTerms, Unifier.Substitution substitution)
-
-
Method Detail
-
termToType
Type termToType(Unifier.Term term)
-
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.
-
-