Skip to content

Report a hand-written __ self identifier to editor tooling - #20598

Open
xperiandri wants to merge 2 commits into
dotnet:mainfrom
xperiandri:fix/self-identifier-symbol
Open

xperiandri wants to merge 2 commits into
dotnet:mainfrom
xperiandri:fix/self-identifier-symbol

Conversation

@xperiandri

Copy link
Copy Markdown
Contributor

Fixes #20566

FCS reported uses of a member __.M() self identifier but not its declaration. Visual Studio's Rename therefore did nothing when invoked on the declaration, and when invoked on a use it rewrote the body and left member __. behind, producing code that no longer compiles.

The suppression was aimed at the self identifier that the auto-property desugaring synthesizes, which sits on the property name's own range and would shadow the property's own symbol. That one is now marked synthetic so the sink drops it on range, and a hand-written __ is reported like this, self and _ already were.

🤖 Generated with Claude Code

`MakeAndPublishVal` skipped the sink for any `MemberThisVal` literally named
`__`. The target was the self identifier that the auto-property desugaring
synthesizes, which sits on the *property name's* range and would therefore
shadow the property's own symbol -- a range collision, not a name problem.

Filtering by name also hid every `member __.M()` a user writes. Declarations go
through `MakeAndPublishVal` and were suppressed, while uses in the body resolve
normally and were not, so FCS reported the uses of `__` without its declaration.
Editor rename then rewrote the body and left `member __.` behind, silently
producing code that no longer compiles.

Mark the synthesized ident's range synthetic instead, as the adjacent backing
field already does. `TcResultsSinkImpl.allowedRange` drops synthetic ranges for
every sink notification, so the auto-property self identifier stays invisible
and the name check becomes dead code.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

✅ Release notes checked


✅ Found changes and release notes in following paths:

Change path Release notes path Description
`src/Compiler` docs/release-notes/.FSharp.Compiler.Service/11.0.100.md

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the AI-Tooling-Check-Scanned-Clean Tooling check: diff analyzed, no interesting infrastructure files label Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-Tooling-Check-Scanned-Clean Tooling check: diff analyzed, no interesting infrastructure files

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

Rename of a member __.M() self identifier silently corrupts the code

1 participant