Initial type checking implementation #312
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.
These changes add basic support for type inference and type checking.
Type inference covers queries (i.e., terms/vars inside queries) as well as virtual docs. Type information for base docs is not available yet--and type checking treats base docs as having "any" type.
Type inference and checking are performed in one pass. The output of the type checking phase is a type environment that contains all relevant type information (for the query or rule set).
Type inference and checking for virtual docs is performed bottom-up after topologically sorting the rules. In the future, we could investigate relaxing this so that type errors/conflicts in base documents could be detected.
Currently, type checking handles the following: