Integrate generics by creating layered type checker:
A Context has GenericTypes internally, and exports Types when given a name of Type and a list of Generics.
An Environment maps Strings to ExpressionTypes.
ExpressionTypes internally store two booleans, one for mutability, and another for nullability.
An ExpressionType stores either a single, tuple, or anonymous function of Types.
In the type inference stage, we return InferTypes.
InferTypes store a list of errors that the statement or expression may throw, which should be handled, in addition to an Optional ExpressionType, which may be None for statements.
We should perhaps consider dropping Singlar Types in favour of only Tuples and Anonymous Functions, as Tuples can also just store a vector of a single Type.
Also add Python primitives by default to the context with the accompanying methods that are defined for these primitives.
Relevant issues
Summary
Integrate generics by creating layered type checker:
A Context has GenericTypes internally, and exports Types when given a name of Type and a list of Generics.
An Environment maps Strings to ExpressionTypes.
ExpressionType
s internally store two booleans, one for mutability, and another for nullability. AnExpressionType
stores either a single, tuple, or anonymous function of Types.In the type inference stage, we return
InferTypes
.InferTypes
store a list of errors that the statement or expression may throw, which should be handled, in addition to anOption
alExpressionType
, which may beNone
for statements.We should perhaps consider dropping Singlar Types in favour of only Tuples and Anonymous Functions, as Tuples can also just store a vector of a single Type.
Also add Python primitives by default to the context with the accompanying methods that are defined for these primitives.
Added Tests