Package net.hydromatic.morel.compile
Class TypeMap
java.lang.Object
net.hydromatic.morel.compile.TypeMap
The result of type resolution, a map from AST nodes to types.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classVisitor that converts type terms into actual types. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<AstNode, Unifier.Term> (package private) final Unifier.Substitutionfinal TypeSystemMap from type variable name to type variable. -
Constructor Summary
ConstructorsConstructorDescriptionTypeMap(TypeSystem typeSystem, Map<AstNode, Unifier.Term> nodeTypeTerms, Unifier.Substitution substitution) -
Method Summary
Modifier and TypeMethodDescriptionReturns an AST node's data type.@Nullable TypegetTypeOpt(AstNode node) Returns an AST node's data type, or null if no type is known.booleanReturns whether an AST node has a type.(package private) TypetermToType(Unifier.Term term) toString()typeFieldNames(AstNode node) Returns the field names if an AST node has a type that is a record or a tuple, otherwise null.booleantypeIsVariable(AstNode node) Returns whether an AST node's type will be a type variable.
-
Field Details
-
typeSystem
-
nodeTypeTerms
-
substitution
-
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
-
TypeMap
TypeMap(TypeSystem typeSystem, Map<AstNode, Unifier.Term> nodeTypeTerms, Unifier.Substitution substitution)
-
-
Method Details
-
toString
-
termToType
-
getType
Returns an AST node's data type. -
getTypeOpt
Returns an AST node's data type, or null if no type is known. -
typeIsVariable
Returns whether an AST node's type will be a type variable. -
hasType
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.
-
typeFieldNames
Returns the field names if an AST node has a type that is a record or a tuple, otherwise null.
-