Skip to content

Allow typed bindings(and!) in CE without parentheses - #18682

Merged
T-Gro merged 58 commits into
dotnet:mainfrom
edgarfgp:allow-and-bang-typed-bindings
Jul 29, 2025
Merged

Allow typed bindings(and!) in CE without parentheses#18682
T-Gro merged 58 commits into
dotnet:mainfrom
edgarfgp:allow-and-bang-typed-bindings

Conversation

@edgarfgp

@edgarfgpedgarfgp commented Jun 10, 2025

Copy link
Copy Markdown
Contributor

Description

Allow computation expression (CE) bindings (let!, use!, and!) to accept type annotations without requiring parentheses.

Continuation of #18508
Implements RFC FS-1329: fsharp/fslang-design#802

Introduces significant grammar unification:

  • New parsing rules: bindingPatternWithOptType and ceBindingCore
  • New helper functions: mkLetExpression and mkAndBang
  • Renamed language feature to AllowTypedLetUseAndBang

The above rule unification will allow us to remove in a separate PR LetOrUseBang, adding boolenisComputed property(true for let!/use!, false for let/use) to LetOrUse.

typeSynExpr=| LetOrUse of isRecursive: bool * isUse: bool * isComputed: bool *// NEW: true for let!/use!, false for let/use
bindings: SynBinding list * body: SynExpr * range: range * trivia: SynExprLetOrUseTrivia

Checklist

  • Test cases added
  • Release notes entry updated

@edgarfgpedgarfgp changed the title Allow and bang typed bindingsAllow and! typed bindingsJun 10, 2025
@github-actions

github-actionsBot commented Jun 10, 2025

Copy link
Copy Markdown
Contributor

❗ Release notes required


✅ Found changes and release notes in following paths:

Change pathRelease notes pathDescription
src/Compilerdocs/release-notes/.FSharp.Compiler.Service/10.0.100.md
LanguageFeatures.fsidocs/release-notes/.Language/preview.md

@edgarfgpedgarfgp changed the title Allow and! typed bindingsAllow typed bindings(and!) in CE without parenthesesJun 10, 2025
@edgarfgp
edgarfgp requested review from T-Gro and auduchinokJuly 15, 2025 03:03
Comment threadsrc/Compiler/pars.fsy
Comment threadsrc/Compiler/pars.fsy
@edgarfgpedgarfgp reopened this Jul 23, 2025
@edgarfgp
edgarfgp requested a review from T-GroJuly 23, 2025 03:31
@edgarfgp

Copy link
Copy Markdown
ContributorAuthor

This is ready @T-Gro

@T-Gro

Copy link
Copy Markdown
Member

Thanks @edgarfgp for getting this in.
The resulting parser code is more unified and better readable across the similar syntactical constructs 👍 .

@edgarfgp

Copy link
Copy Markdown
ContributorAuthor

/azn run

@edgarfgp

Copy link
Copy Markdown
ContributorAuthor

Thanks @T-Gro. Can you please re-run the CI ?. Don't want to close a re-open the PR.

@T-Gro

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 2 pipeline(s).

@T-Gro
T-Gro enabled auto-merge (squash) July 29, 2025 10:43
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants

@edgarfgp@T-Gro@auduchinok