Skip to content

cs2gs + LS: preserve C# tuple element names + completion (ADR-0172 Phases C+D, #3501) - #3623

Merged
DavidObando merged 2 commits into
feature/named-tuple-elementsfrom
feature/named-tuple-cs2gs
Aug 29, 2026
Merged

DavidObando merged 2 commits into
feature/named-tuple-elementsfrom
feature/named-tuple-cs2gs

Conversation

@DavidObando

Copy link
Copy Markdown
Owner

Summary

Stacked on #3622 (named tuple elements, Phases A+B) — Phase C of ADR-0172: cs2gs stops erasing C# tuple element names, delivering the #3501 readability win across the ~830 named-tuple declaration lines in the self-migration corpus.

  • Types print name-first: (int Line, int Column)(Line int32, Column int32) (CSharpTypeMapper keeps Roslyn's TupleElements names; a default ItemN-at-position counts as unnamed; the ADR-0115 §B.4 name-drop Info diagnostic is retired). Names survive the nullability-promotion rebuild sites too (oblivious promotion, whole-type nullable wraps).
  • Literal labels survive: (Count: 3, Name: "three") via NameColon.
  • Named element access stays by-name: item.Price * item.Quantity round-trips verbatim where it previously lowered to item.Item2 * item.Item3; default positional .ItemN access still normalizes positionally.
  • TupleTypeReference / TupleLiteralExpression gain optional element-name lists; the printer renders both forms.

Verification

  • New Adr0172NamedTupleTranslationTests (6): name-first types, by-name access, positional access unchanged, literal labels, unnamed tuples unchanged, names inside generics — every snippet re-binds through the real gsc (exercising the G#: named tuple elements — Phases A+B: front end + metadata interop (ADR-0172, #3501) #3622 front end).
  • Existing tuple-behavior tests updated to the named surface (Issue1914 alias, Issue2469 nullability ×6, Issue3615 receiver probe, oblivious-promotion sinks); coverage-matrix notes moved into the inventory and docs/cs2gs-coverage-matrix.md regenerated via cs2gs coverage --write.
  • Full Cs2Gs.Tests green (2454 tests; the two last local failures were a stale out/bin/Release gsc found by FindCompiler — rebuilt — and a stale expectation).
  • Corpus diagnostic-run 18/20 green with the branch gsc (CompileGap-Library is the known wontfix; L3-Library's test-parity failure is the documented stale-SDK-nupkg trap — the parity stage rebuilds with the packaged gsc, which predates ADR-0172; CI builds the SDK from the same commit). Translated L1 now reads total += item.Price * item.Quantity with List[(Name string, Price int32, Quantity int32)].

🤖 Generated with Claude Code

https://claude.ai/code/session_01Nng28yiBdPVdeML7mSZphs

DavidObando and others added 2 commits August 28, 2026 17:04
The translator now emits the ADR-0172 named-tuple surface instead of
erasing names: tuple TYPES print name-first ((Line int32, Column
int32) — CSharpTypeMapper keeps Roslyn's TupleElements names, default
ItemN-at-position counts as unnamed, and the ADR-0115 §B.4 name-drop
Info diagnostic is gone), literal LABELS survive ((Count: 3, Name:
"three") via NameColon), and a named element ACCESS stays by-name —
item.Price * item.Quantity round-trips verbatim where it previously
lowered to item.Item2 * item.Item3. Default positional access (.ItemN)
still normalizes to the positional field. TupleTypeReference and
TupleLiteralExpression gain optional element-name lists; the printer
renders both forms.

Corpus: 18/20 diagnostic-run green with the branch gsc (CompileGap-
Library is the known wontfix; L3-Library's test-parity failure is the
documented stale-SDK-nupkg trap — the parity stage rebuilds with the
packaged gsc, which predates ADR-0172; CI builds the SDK from the same
commit). L1's translated output now reads item.Price * item.Quantity
with List[(Name string, Price int32, Quantity int32)].

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nng28yiBdPVdeML7mSZphs
A tuple-typed receiver's dot-completion offers its declared element
names first, then the positional ItemN spellings (both resolve), with
the element type as the detail. Hover/diagnostics already render named
tuples via SymbolDisplay's ADR-0172 tuple case.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nng28yiBdPVdeML7mSZphs
@DavidObando
DavidObando force-pushed the feature/named-tuple-cs2gs branch from 9b7f1d7 to 3fc6d43 Compare August 29, 2026 00:06
@DavidObando
DavidObando force-pushed the feature/named-tuple-elements branch from 77ea62e to a806e04 Compare August 29, 2026 00:06
@DavidObando DavidObando changed the title cs2gs: preserve C# tuple element names (ADR-0172 Phase C, #3501) cs2gs + LS: preserve C# tuple element names + completion (ADR-0172 Phases C+D, #3501) Aug 29, 2026
@DavidObando

Copy link
Copy Markdown
Owner Author

Also carries Phase D (LS): tuple-typed receivers' dot-completion now offers declared element names first, then the positional ItemN spellings, with element types as detail. Full LanguageServer.Tests green (486). Both branches rebased onto main after #3621's squash-merge.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant