Refactor type inference in functions #523
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So far, we were unsure what the best abstraction for type inference would be. After a couple of code generators, the structure for the type inference crystalized out: we refactor it into two functions, one for the class invariants and one for the transpilable verification functions.
The type inference for pattern verification functions is explicitly left out as we can not infer the type of the matching result in any meaningful way with the simple types we have so far, and we also do not need to. Namely, we ensure that pattern verification functions follow a very strict structure where each variable can only be a string in the parsing stage.