The type system for Laurel programs (each constructor is documented
individually below). Two constructors are internal, not surface types:
Unknown (resolution-error recovery / gradual wildcard) and MultiValuedExpr
(multi-output-call results).
Constructors
Strata.Laurel.HighType.TVoid : Strata.Laurel.HighType
The void type, used for statements that produce no value.
Strata.Laurel.HighType.TBool : Strata.Laurel.HighType
Boolean type.
Strata.Laurel.HighType.TInt : Strata.Laurel.HighType
Arbitrary-precision integer type.
Strata.Laurel.HighType.TFloat64 : Strata.Laurel.HighType
64-bit floating point type. Required for JavaScript (number), also used by Python (float) and Java (double).
Strata.Laurel.HighType.TReal : Strata.Laurel.HighType
Mathematical real type. Maps to Core's real type.
Strata.Laurel.HighType.TString : Strata.Laurel.HighType
String type for text data.
Strata.Laurel.HighType.TSet (elementType : Strata.Laurel.AstNode Strata.Laurel.HighType) : Strata.Laurel.HighType
Set type, e.g. Set int.
Strata.Laurel.HighType.TMap (keyType valueType : Strata.Laurel.AstNode Strata.Laurel.HighType) : Strata.Laurel.HighType
The TOTAL map type, TotalMap K V — Core's Map sort, i.e. an SMT array. Every key
has a value and select is defined everywhere, so this cannot express key absence.
This is the low-level map the heap, the type-hierarchy tables and the
select/update/mapConst primitives are stated over. The user-facing PARTIAL map is
Map<K, V>, an opaque prelude type represented as TotalMap K ($MapEntry V); it is an
.Applied head, not this node.
Strata.Laurel.HighType.UserDefined (name : Strata.Laurel.Identifier) : Strata.Laurel.HighType
A Identifier to a user-defined composite or constrained type by name.
Strata.Laurel.HighType.TVar (name : Strata.Laurel.Identifier) : Strata.Laurel.HighType
A bound type variable, e.g. T in procedure f<T>(x: T). Introduced by
resolution when a name in type position matches an in-scope type parameter
(declared on a procedure, composite, or datatype). Distinct from UserDefined,
which names a concrete type.
Strata.Laurel.HighType.Applied (base : Strata.Laurel.AstNode Strata.Laurel.HighType) (typeArguments : List (Strata.Laurel.AstNode Strata.Laurel.HighType)) : Strata.Laurel.HighType
A generic type application, e.g. List<Int>.
Strata.Laurel.HighType.Intersection (types : List (Strata.Laurel.AstNode Strata.Laurel.HighType)) : Strata.Laurel.HighType
An intersection of types. Used for implicit intersection types, e.g. Scientist & Scandinavian.
Strata.Laurel.HighType.TBv (size : Nat) : Strata.Laurel.HighType
Bitvector type of a given width.
Strata.Laurel.HighType.Unknown : Strata.Laurel.HighType
Type used internally by the Laurel compilation pipeline. This type is used when a resolution error occurs, to continue compilation without producing superfluous errors Any type can be assigned to unknown and unknown can be assigned to any type. The unknown type can not be represented in Core so its occurence will abort compilation before evaluating Core
Strata.Laurel.HighType.MultiValuedExpr (types : List (Strata.Laurel.AstNode Strata.Laurel.HighType)) : Strata.Laurel.HighType
An internal-only type produced by computeExprType for multi-output procedure calls.
Consumed by the resolution arity check and highEq. Should never appear in a serialized program.