-
Notifications
You must be signed in to change notification settings - Fork 39
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
Add parsing of sum type declarations #1088
Conversation
7bd63a1
to
0dd0d29
Compare
…d-ids Require record fields to be simple identifiers
Not sure why this updating. Tests succeed whether this file is updated or not. But, well, it's up to date now :)
0dd0d29
to
c52028b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a few small remarks
type T = | ||
| A | ||
| B(int) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also test type T = A | B(int)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call! I've added this :)
Thanks for the review! |
* Add syntax for sum type declarations * Add parser generator updates * Adapt flattening and graphics for sum types * Add unit test for sum type declaration parsing * Update the super spec Not sure why this updating. Tests succeed whether this file is updated or not. But, well, it's up to date now :) * Add test for IRPrinting
* Add syntax for sum type declarations * Add parser generator updates * Adapt flattening and graphics for sum types * Add unit test for sum type declaration parsing * Update the super spec Not sure why this updating. Tests succeed whether this file is updated or not. But, well, it's up to date now :) * Add test for IRPrinting
* Add syntax for sum type declarations * Add parser generator updates * Adapt flattening and graphics for sum types * Add unit test for sum type declaration parsing * Update the super spec Not sure why this updating. Tests succeed whether this file is updated or not. But, well, it's up to date now :) * Add test for IRPrinting
These changes address the comments from #1088 I had fixed all of these, but then merged the PR without pushing my fixes.
These changes address the comments from #1088 I had fixed all of these, but then merged the PR without pushing my fixes.
These changes address the comments from #1088 I had fixed all of these, but then merged the PR without pushing my fixes.
Addresses the type declaration part of #1082.
This adds support for the sum type declaration syntax proposed in #1062.
The most interesting part of these changes is the addition of the IR constructs
to represent the declaration of sum types. This includes a specialized
variant of the row types allowing us to statically enforce that the rows of a
variant type cannot be open. See the discussion on #1062 for the motivation for
this design decision.
Note that we do not add a parsing rule to
type
for sum types. This reflectsthe fact that sum types can only be referenced by their defined name: anonymous
sum types are not supported.
Note that this PR is into the
sf/sum-type
feature branch.CHANGELOG.md
for any new functionalityREADME.md
updated for any listed functionality