-
Notifications
You must be signed in to change notification settings - Fork 263
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
feat: Allow forall statements in statement expressions #5894
Merged
RustanLeino
merged 16 commits into
dafny-lang:master
from
RustanLeino:forall-stmt-in-expr
Dec 1, 2024
Merged
Changes from 9 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
31f2136
Improve code and comments
RustanLeino 414c4c1
Make test run with both resolvers
RustanLeino 6f97e14
Allow forall statements in statement expressions
RustanLeino 216b63a
Deprecate forall statements with parenthesized bound variables
RustanLeino 2921cd4
Update documentation
RustanLeino fd7ea46
Add release notes
RustanLeino ace95ab
Fix deprecated parentheses in standard library
RustanLeino 463a5f6
Adjust tests
RustanLeino 137f3ad
Merge branch 'master' into forall-stmt-in-expr
RustanLeino 2e60809
Merge branch 'master' into forall-stmt-in-expr
RustanLeino 1ede1ce
Move deprecation tests to Deprecation.dfy
RustanLeino e191c36
Rename Parallel* test files to ForallStmt*
RustanLeino 1dbad1b
Applying renaming in test files
RustanLeino 81ca722
Merge branch 'master' into forall-stmt-in-expr
RustanLeino 0923ee9
Merge branch 'master' into forall-stmt-in-expr
RustanLeino 4f79e30
Merge branch 'master' into forall-stmt-in-expr
RustanLeino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Oops, something went wrong.
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.
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.
That works. It means we could theoretically do the same for if statements (last week I would have loved to have that) and I think that could be useful too and less surprising in the future, although out of scope for this PR.
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.
I agree it's out of scope for this PR, but I do find it an interesting idea. I suppose such an
if
statement would still just be for theStmtExpr
, rather than being an alternative syntax forif-then-else
expressions? This would then allow you to write some proofs inside theif
statement and follow that by the expression you want to return. (I have never felt the need for this myself, but perhaps only because I knew the feature wasn't available.)Some new users confuse
if-then-else
expressions andif
statements (which, curiously, seems not to be a confusion in languages that use the more cryptic? :
for the former). On one hand, also allowingif
statements in expressions might add to that confusion. But on the other hand, maybe this would give us a place in the parser to give a better error message if the program gets this wrong.While we're thinking about such things, one could also imagine other statements, in particular
while
loops, in expressions. Again, such awhile
statement would just be for theStmtExpr
, to allow an inline proof that uses a loop.