-
Notifications
You must be signed in to change notification settings - Fork 57
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 front-end support for case expressions boolean side conditions #2852
Merged
Conversation
This file contains 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
janmasrovira
force-pushed
the
syntax-case-side-conditions
branch
3 times, most recently
from
June 22, 2024 11:33
ed4e7db
to
d1c2e98
Compare
janmasrovira
changed the title
Add syntax for case expressions boolean side conditions
Add front-end support for case expressions boolean side conditions
Jun 25, 2024
janmasrovira
force-pushed
the
syntax-case-side-conditions
branch
2 times, most recently
from
June 25, 2024 15:36
d7706e8
to
8f90a07
Compare
janmasrovira
force-pushed
the
syntax-case-side-conditions
branch
from
June 26, 2024 13:15
7792bc1
to
2d79121
Compare
janmasrovira
added a commit
to anoma/juvix-stdlib
that referenced
this pull request
Jun 28, 2024
janmasrovira
force-pushed
the
syntax-case-side-conditions
branch
3 times, most recently
from
July 2, 2024 15:22
604d7c4
to
4740d22
Compare
lukaszcz
reviewed
Jul 3, 2024
| else := n | ||
| suc n if 0 < 0 := 3; | ||
end; | ||
|
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.
Can we have a test with multiple if
conditions for one pattern? I understand this is allowed.
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.
done
lukaszcz
previously approved these changes
Jul 3, 2024
janmasrovira
force-pushed
the
syntax-case-side-conditions
branch
from
July 3, 2024 17:46
4740d22
to
031e8e1
Compare
lukaszcz
approved these changes
Jul 3, 2024
This was referenced Aug 30, 2024
lukaszcz
added a commit
that referenced
this pull request
Sep 9, 2024
* Closes #2804 * Requires #3003 * Front-end syntax for side conditions was implemented in #2852. This PR implements compilation of side conditions. * Adds side-conditions to `Match` nodes in Core. Updates Core parsing, printing and the evaluator. * Only side-conditions without an `else` branch are allowed in Core. If there is an `else` branch, the side conditions are translated in `fromInternal` into nested ifs. Because with `else` the conditions are exhaustive, there are no implications for pattern exhaustiveness checking. * Adjusts the "wildcard row" case in the pattern matching compilation algorithm to take into account the side conditions.
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.
if
->ite
renaming from stdlib #2869.This pr introduces:
if
is a reserved keyword.if
is allowed to have only theelse
branch. I've also refactored the parser to be simpler.Example:
The side if branches must satisfy the following.
if
branch.else
branch is optional. If present, it must be the last.Future work: