This repository was archived by the owner on Mar 17, 2026. It is now read-only.
Open
Conversation
Add 'defer pre { handler }; body' construct that executes handler
whenever execution leaves body (both normal fall-through and goto/return).
- Syntax: Tm_Defer with handler_pre (slprop), handler, and body
- Parser: 'defer' keyword with slprop pre and braced handler block
- ElimGoto: preserve defer blocks, conditionalize body but not handler
- Extraction: defer extracted as sequential composition (body then handler)
- Remove --cmi from all Makefiles (flag no longer recognized by F*) - Fix make_auto_paren_lexer to track DOT_LPAREN, DOT_LBRACK, DOT_LBRACK_BAR, DOT_LENS_PAREN_LEFT, LENS_PAREN_LEFT, BAR_RBRACK, and LENS_PAREN_RIGHT for depth counting. Without this, qualified-open syntax like US.(expr) in if/match conditions caused the scanner to lose track of nesting depth and consume the entire file. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
72e7758 to
4a0ae21
Compare
gebner
reviewed
Mar 9, 2026
|
|
||
| ``` | ||
| if (if true then !r = 0 else false) { ... } // fails: !r buried in Tv_Match | ||
| ``` |
Contributor
There was a problem hiding this comment.
FWIW, this is kind of the easy case. We could support this very easily be desugaring it during checking to:
let __tmp = (if true then !r = 0 else false);
if (__tmp) { ... }
(And indeed, after reading the PR that's exactly what you're doing, which is good.)
Maybe this wasn't clear from the issue description, but the actually hard issue is the following where a stateful expression needs to be hoisted out of an if in a pure expression.
let foo = (if b then !x + 42 else 67) + 10;
| | File | Change | | ||
| |------|--------| | ||
| | `pulseparser.mly` — `ifStmt`, `matchStmt` | `IF LPAREN pulseStmt RPAREN`, `MATCH LPAREN pulseStmt RPAREN` | | ||
| | `PulseSyntaxExtension_Parser.ml` — `make_auto_paren_lexer` | Token preprocessor: auto-inserts `LPAREN`/`RPAREN` when omitted. Detects `LBRACE` at depth 0 as end-of-condition. Passes through F\*-level `if/then` and `match/with` unmodified. | |
Contributor
There was a problem hiding this comment.
Please just add two productions (one for pulseStmt, one for terms) to the grammar instead.
| # DPE directory above, but in a test we first run verify on DPE which | ||
| # involves verifying everything here already, so this saves some time. | ||
| OTHERFLAGS += --warn_error -342 --cmi | ||
| OTHERFLAGS += --warn_error -342 |
Contributor
There was a problem hiding this comment.
This requires updating CI to use the fstar2 branch.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Issue #443