Skip to content

Fix C# named-argument type references - #4926

Merged
Widthdom merged 4 commits into
mainfrom
fix-issue4833
Jul 27, 2026
Merged

Fix C# named-argument type references#4926
Widthdom merged 4 commits into
mainfrom
fix-issue4833

Conversation

@Widthdom

Copy link
Copy Markdown
Owner

Summary

  • suppress C# named-argument labels from type_reference rows without name-based exceptions
  • preserve value-side types from named out declarations, explicitly typed lambdas and anonymous methods, typed LINQ range variables, and property subpatterns
  • add extractor and persisted references/deps regressions covering positional, reordered, attribute, constructor, nested, multiline, alias, label, nullable, and ternary cases

Root cause

The shared declaration-type scanner treated invocation argument fragments and comma-terminated continuation lines as declarations, so a leading name: label could be emitted as a type reference and resolve to an unrelated same-named symbol.

Validation

  • dotnet build CodeIndex.sln -c Release -p:UseSharedCompilation=false --no-restore — 0 warnings, 0 errors
  • dotnet test tests/CodeIndex.Tests/CodeIndex.Tests.csproj --no-restore -p:UseSharedCompilation=false --filter "FullyQualifiedName~Issue4830|FullyQualifiedName~Issue4832|FullyQualifiedName~Issue4833" — .NET 8/9: 6 passed each
  • dotnet test CodeIndex.sln -c Release --no-build --no-restore -p:UseSharedCompilation=false — .NET 8: 10,515 passed / 7 skipped; .NET 9: 10,042 passed / 419 skipped; 0 failed
  • dotnet run --project tools/CodeIndex.Changelog -- check — validated 8 fragments
  • full local index rebuild and status --check --json — fresh, 1,210 files, 0 warnings/errors
  • references overwrite --exact --lang csharp --json — 0 references
  • Codex adversarial review — 2 rounds completed; all actionable findings were fixed and covered by regression fixtures

Documentation and changelog

  • DEVELOPER_GUIDE.md
  • TESTING_GUIDE.md
  • changelog.d/unreleased/4833.fixed.md

Follow-up candidates

None.

Fixes #4833

@Widthdom
Widthdom marked this pull request as ready for review July 27, 2026 08:10
@Widthdom
Widthdom merged commit 6c6ba2c into main Jul 27, 2026
12 checks passed
@Widthdom
Widthdom deleted the fix-issue4833 branch July 27, 2026 08:10
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.

Do not treat C# named-argument labels as type references

1 participant