Skip to content

Add "," as separator for pattern matching on multiple named discriminated unions fields#18833

Closed
edgarfgp wants to merge 45 commits into
dotnet:mainfrom
edgarfgp:fs-lang-957
Closed

Add "," as separator for pattern matching on multiple named discriminated unions fields#18833
edgarfgp wants to merge 45 commits into
dotnet:mainfrom
edgarfgp:fs-lang-957

Conversation

@edgarfgp

@edgarfgp edgarfgp commented Aug 9, 2025

Copy link
Copy Markdown
Contributor

Description

Implements fsharp/fslang-suggestions#957

Checklist

  • Test cases added
  • Release notes entry updated

@github-actions

github-actions Bot commented Aug 11, 2025

Copy link
Copy Markdown
Contributor

❗ 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/10.0.100.md
LanguageFeatures.fsi docs/release-notes/.Language/preview.md

| SyntaxNode.SynExpr(SynExpr.Record(None, _, fields, _)) :: _ ->
let isFirstField =
match field, fields with
| Some contextLid, SynExprRecordField(fieldName = lid, _) :: _ -> contextLid.Range = lid.Range

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing pattern matching code seems incorrect - it was missing the tuple parentheses that should have been there. fieldName = lid, _ should have been fieldName = (lid, _).

match recordFields with
| [] -> false
| SynExprRecordField(expr = Some(SynExpr.Paren(expr = Is inner)); blockSeparator = Some _) :: SynExprRecordField(
fieldName = SynLongIdent(id = id :: _), _) :: _ -> problematic inner.Range id.idRange

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@edgarfgp edgarfgp closed this Aug 27, 2025
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.

2 participants