Parser: recover on missing 'when' conditions - #20071
Merged
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
T-Gro
approved these changes
Aug 3, 2026
T-Gro
left a comment
Member
There was a problem hiding this comment.
🤖 AI review (@expert-reviewer): no significant issues found. Please verify independently.
Reviewed the parser recovery for missing/invalid when guard expressions and the supporting refactor:
- The four new
parenPattern WHEN ...productions are correctly gated by%prec prec_recover, so they only engage when the normalWHEN declExprreduction fails; a valid guard still parses throughpatternGuard. The complementaryparenPattern patternGuard+recoverpath (guard present, result missing) remains handled by the existingpatternAndGuard recoverrules. patternResulttype change (Range→range option) andArrowRange = mArrowthreading are consistent; recovered clauses correctly emitArrowRange = Noneand anArbitraryAfterErrorresult node.mkMatchClauses/mkMatchClausesRecoverMissingResultpreserve the original range semantics (mLastOuter |> Option.defaultValue mLast,mNextBarcontinuation threading), matching the updated.bslbaselines.- Setting
guard = Nonein the missing-expression cases is appropriate since no valid guard expression exists, and the singleparsExpectingExpressiondiagnostic is reported at thewhenkeyword.
Baselines (Match - When 01–04, Try - With 09) look correct.
T-Gro
self-requested a review
August 3, 2026 19:12
auduchinok
force-pushed
the
parser-matchWhen
branch
from
August 17, 2026 17:57
ff89428 to
2e152a0
Compare
Contributor
❗ Release notes requiredYou can open this PR in browser to add release notes: open in github.dev
Warning No PR link found in some release notes, please consider adding it.
|
Contributor
|
🔍 Tooling Safety Check — Affects-Compiler-Output
|
T-Gro
approved these changes
Aug 19, 2026
This was referenced Aug 19, 2026
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 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.
Fixes parsing of missing
whenclause expressions, like the following: