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

@github-actions
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

@edgarfgp edgarfgp marked this pull request as ready for review October 20, 2025 06:45
@edgarfgp edgarfgp requested a review from a team as a code owner October 20, 2025 06:45
@edgarfgp edgarfgp closed this Oct 21, 2025
@edgarfgp edgarfgp reopened this Oct 21, 2025
@edgarfgp edgarfgp closed this Oct 21, 2025
@edgarfgp edgarfgp reopened this Oct 21, 2025
@T-Gro
Copy link
Member

T-Gro commented Oct 22, 2025

When it comes to the known regression this fixes, it is just the uppercase warning?
It is very late for the .NET10 (GA) process, and I need to weight in the fix against the late notice insertion.

If it is just the warning, I would go with this fix in main only, and keep .NET10 GA as is.
(since it is a warning and does have a workaround)

@T-Gro T-Gro merged commit e434841 into dotnet:main Oct 22, 2025
42 checks passed
Sign up for free to 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.

Regression of FS0049 (uppercase variable identifiers)

2 participants