Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
SpecTec IL: Implement and formalise the semantics of dynamic checking of type side conditions, as discussed with @zilinc and @conrad-watt. Now, when e.g. a type
is defined, every application of
DIGwill actually evaluate the premises associated with the constructor. If that fails, the application fails. IOW, constructors with side conditions are partial. The motivation is to actually check and preserve defined invariants. This is necessary to get the right failure behaviour for undefined constructor applications. To give a silly but simple example, a rule likewill now properly be rejected for n, m ≥ 10, where previously it succeeded according to the operational semantics.
The implementation in the evaluator is simple. It does not affect the frontend much, since that only does simple evaluations for type-checking purposes. However, middlends/backends translating constructors (or records) should now respect this refined semantics if they don't already (@zilinc, @DCupello1, FYI).
The formalisation got a bit more complicated than I'd like, due to the need to express it via a reduction semantics. For this purpose, INJ and STR forms can now carry a temporary list of yet-to-check premises. Also, they now have a type annotation, since reduction has to know where to look for the premises initially.
@zilinc, @conrad-watt, @DCupello1, PTAL.