-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sum types #1602
Sum types #1602
Conversation
This is similar to what happens in Haskell, and is useful when we validate patterns---we need to make sure that only constructors can appear in patterns, and not some random top-level name. NSConstructor is a sub-namespace of NSValue, so whenever we look for name uses of NSValue, we also check in NSConstructor
These are useful enough that it is worth defining them in the standard library.
With my most recent push, I believe all of the remaining work has been completed. The one thing that is missing is @yav, do you have any review comments? The things that are new since the last time you looked are:
We should also try updating GaloisInc/saw-script#2020 once more. |
The failing CI on GaloisInc/saw-script#2020 in this job reveals a regression in the way Cryptol handles abstract types. Cryptol 3.0.0 accepts this:
But it now rejects it with the
(There's also a typo in "parameterss".) I'll mark this PR as a draft until we sort this out. |
Ah, I think the problem lies in this code: cryptol/src/Cryptol/TypeCheck/Kind.hs Lines 339 to 361 in a9e35fe
The case that handles Relatedly, we ought to change the error messages for |
We must treat built-in abstract types slightly differently from user-defined abstract types. Also fix a bug in the way that the return kind of primitive types are computed: we previously said that they all return `*`, but this is not necessarily the case.
I've pushed a fix for the issue described in #1602 (comment) in commit ca0eb7e. |
This branch implements non-recursive nominal sum types for Cryptol. See also #1588.