Use typing constraints for proper type inference.
This is all done in two stages:
Generation stage, where we generate constraints
Unification stage, where we solve these constraints like a set of equations. We also make use of substitution.
All this should also make it easier to type-check more complex language constructs in future.
We remove the old type inference logic, as well as any old (helper) functions which were used by the old type inference stage.
With regards to the Node class itself, we also did some cleanup by making mutable and the type properties of function arguments and variable definitions directly.
This means we don't constantly have to recursively check whether the identifier stored within these was an IdType.
We also make TypeName and InferType top-level in the type checker as these are universal constructs within the type checker.
Added Tests
A few.
Removed Tests
Some old tests have been removed due to them being to difficult to implement in one go.
We will gradually be re-adding language functionality, using these ignored tests as a roadmap.
Relevant issues
Resolves #166 Resolves #150
Summary
Use typing constraints for proper type inference. This is all done in two stages:
All this should also make it easier to type-check more complex language constructs in future.
We remove the old type inference logic, as well as any old (helper) functions which were used by the old type inference stage.
With regards to the
Node
class itself, we also did some cleanup by making mutable and the type properties of function arguments and variable definitions directly. This means we don't constantly have to recursively check whether the identifier stored within these was anIdType
.We also make
TypeName
andInferType
top-level in the type checker as these are universal constructs within the type checker.Added Tests
A few.
Removed Tests
Some old tests have been removed due to them being to difficult to implement in one go. We will gradually be re-adding language functionality, using these ignored tests as a roadmap.