Skip to content

Parser: Allow comma as named field separator - #18881

Closed
edgarfgp wants to merge 61 commits into
dotnet:mainfrom
edgarfgp:allow-comma-as-name-field-separator
Closed

Parser: Allow comma as named field separator#18881
edgarfgp wants to merge 61 commits into
dotnet:mainfrom
edgarfgp:allow-comma-as-name-field-separator

Conversation

@edgarfgp

@edgarfgpedgarfgp commented Sep 2, 2025

Copy link
Copy Markdown
Contributor

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for using commas as separators in named field patterns for discriminated union cases and exception patterns in F#, alongside the existing semicolon separators. The feature is gated behind the Preview language version and maintains backward compatibility while making pattern syntax consistent with construction syntax.

Key changes:

  • Parser modifications to accept both comma and semicolon separators in named field patterns
  • New diagnostic for inconsistent separator usage within the same pattern
  • Comprehensive test coverage for the new syntax

Reviewed Changes

Copilot reviewed 223 out of 223 changed files in this pull request and generated no comments.

FileDescription
Multiple .bsl filesUpdated syntax tree baseline files to reflect new separator representations in AST
Multiple .fs test filesAdded test cases covering comma-separated named field patterns and mixed separator error cases
Comments suppressed due to low confidence (5)

@edgarfgp
edgarfgp marked this pull request as ready for review September 8, 2025 20:09
@edgarfgp
edgarfgp requested a review from a team as a code ownerSeptember 8, 2025 20:09
@edgarfgp
edgarfgpforce-pushed the allow-comma-as-name-field-separator branch from 3b95dad to a8fe750CompareSeptember 10, 2025 10:35
@edgarfgp
edgarfgp marked this pull request as draft September 13, 2025 14:16
@edgarfgp

Copy link
Copy Markdown
ContributorAuthor

Going to split this PR in small ones to make easier to review

# Conflicts:
#	src/Compiler/Checking/CheckRecordSyntaxHelpers.fs
#	src/Compiler/Service/ServiceParseTreeWalk.fs
#	src/Compiler/SyntaxTree/SyntaxTree.fsi
#	src/Compiler/pars.fsy
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.

2 participants

@edgarfgp