Skip to content

Conversation

edgarfgp
Copy link
Contributor

@edgarfgp edgarfgp commented Oct 15, 2025

Description

This PR fixes a bug where match clauses without the optional leading bar (|) were being treated differently from those with it.

The IsTrueMatchClause property was checking for both a bar and an arrow, but the bar is actually optional syntax in F#. This meant these two equivalent patterns behaved differently:

// This worked fine
match x with
| SomeCase -> 1

// This had issues  
match x with SomeCase -> 1

The same problem affected function expressions and try...with blocks when the first clause didn't have a bar.

This only affects SynMatchClause nodes in the AST (used by match, function, and try...with).
Not other uses of -> in F# like type signatures or lambdas.

Looking at the parser, ArrowRange is only None when we're in error recovery or dealing with compiler-generated synthetic clauses. user written match clauses always have an arrow, regardless of whether they have a bar.

Fixes #18992

Checklist

  • Test cases added
  • Release notes entry updated

Copy link
Contributor

github-actions bot commented Oct 15, 2025

❗ Release notes required


✅ Found changes and release notes in following paths:

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/11.0.0.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

Regression of FS0049 (uppercase variable identifiers)

1 participant