This is used by functions to specify arguments and return values of variable type. These are only valid as argument and return types of FnCallExprs.
As an expression is typechecked, UniversalType instances will be compared against the actual types of arguments to the function; constraints generated by these comparisons will result in the UniversalType being replaced in the official expression by a concrete type.
UniversalType instances may carry constraints that restrict the set of concrete types to which they may be unified. Each constraint is a promotesTo relationship. e.g., adding a constraint of Type.TypeName.TYPECLASS_NUMERIC asserts that the final type this takes on must promote to TYPECLASS_NUMERIC.
Note that the equals() method operates on the alias and the constraints; if two instances of a UniversalType have the same alias and the same constraints (or no constraints at all), they will be judged "equal;" if a function has two unbound argument types that are unrelated, they should be instantiated with different aliases, such as "'a" and "'b".
|
|
|
|
|
|