Skip to content

Conversation

@edgarfgp
Copy link
Contributor

@edgarfgp edgarfgp commented Aug 18, 2025

Description

In this PR I propose we captured the block separators in the same way we do it when we do it records

This is a pre-requisite for #18833 where we need to able to track the separator.

BEFORE

  • No block separator captured
// Union cases: Simple Ident
SynArgPats.NamePatPairs(
    pats = [(Ident("a"), Option<Range>, SynPat)]
)

// Records: Complex tuple with LongIdent
SynPat.Record(
    fieldPats = [((LongIdent, Ident("X")), Option<Range>, SynPat)]
)

AFTER

  • Block separator captured
// Unified representation across all constructs
SynArgPats.NamePatPairs(
    pats = [NamePatPairField]  // Consistent type
)

SynPat.Record(
    fieldPats = [NamePatPairField]  // Same type used
)

// Both use the same field name type
NamePatPairField(
    fieldName = SynLongIdent([a], [], [None])  // Unified representation
)
// Union case with named fields - now uses SynLongIdent and captures separators
match x with
| A(a = a; b = b; c = c) -> 2
//  ^SynLongIdent for field names, separators captured

// Record pattern - unified representation
let { X = x; Y = y } = record
//    ^Same SynLongIdent structure

// Future possibility: qualified field names
// | SomeCase(Module.field = value) -> ...  // Now structurally possible

Checklist

  • Test cases added
  • Release notes entry updated

@edgarfgp
Copy link
Contributor Author

/run ilverify

@github-actions
Copy link
Contributor

🔧 CLI Command Report

  • Command: /run ilverify
  • Outcome: success

✅ Command succeeded, no changes needed.

@edgarfgp edgarfgp force-pushed the capture-named-fields-block-separators branch from 8f19aee to f8c969a Compare August 21, 2025 21:48
@edgarfgp edgarfgp force-pushed the capture-named-fields-block-separators branch from f8c969a to 532955c Compare August 21, 2025 22:19
@T-Gro T-Gro enabled auto-merge (squash) August 26, 2025 13:36
auto-merge was automatically disabled August 26, 2025 16:37

Head branch was pushed to by a user without write access

@T-Gro T-Gro merged commit cfd4121 into dotnet:main Aug 27, 2025
38 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.

2 participants