Repository navigation
Report a hand-written __ self identifier to editor tooling - #20598
xperiandri wants to merge 4 commits into
Conversation
✅ Release notes checked
|
0ee7a07 to
4c9b110
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved blocking issues were identified.
Review effort: Lite
Findings: None
What changed in this PR
Updates FCS symbol reporting so hand-written __ self identifiers are available to editor tooling while synthesized auto-property identifiers remain hidden.
Changes:
- Reports declarations and uses of
__self identifiers. - Marks synthesized auto-property self identifiers as synthetic.
- Adds regression tests and release notes.
| File | Description |
|---|---|
tests/FSharp.Compiler.Service.Tests/Symbols.fs |
Adds coverage for self-identifier reporting and auto-property suppression. |
src/Compiler/Checking/Expressions/CheckExpressions.fs |
Removes the blanket __ suppression. |
src/Compiler/Checking/CheckDeclarations.fs |
Marks generated auto-property self identifiers synthetic. |
docs/release-notes/.FSharp.Compiler.Service/11.0.200.md |
Documents the fix. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
🔍 Tooling Safety Check — Affects-Design-Time
|
ef9c825 to
767b3f5
Compare
767b3f5 to
32d5fd2
Compare
T-Gro
left a comment
There was a problem hiding this comment.
The diff is still way too big - apply the NoBloat instructions and CodeCompaction skill.
Especially the massive code comments would benefit not just with drastic reduction, but ideally with well named functions/arguments/bindings/types making the intention clear.
If a well named piece of code just tells what the comment says - delete the comment.
- Delete the 3 implementation/test comment lines. Replace the base-range explanation with a named predicate such as
isUserDeclaredThisVal; the test name should state that the synthesized self identifier does not shadow the property range. - Compact the FCS release note to the observable fix: a hand-written
__self identifier is reported at its declaration. Remove the rename story, desugaring history, and synthetic-range mechanism.
Applies what the pull request gained after e21fe4f. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Applies what the pull request gained after e21fe4f. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Applies what the pull request gained after e21fe4f. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Applies what the pull request gained after e21fe4f. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Compacted as requested in 32b7ec0, on top of current main (
The diff is +38/-12 (it was +49/-8) with no added comment lines (it was 3, 294 characters). |
Applies what the pull request gained after e21fe4f. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The compacted notes of dotnet#20598, dotnet#20599 and dotnet#20637 replace the lines they rewrote; the union merge had kept both. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
T-Gro
left a comment
There was a problem hiding this comment.
🤖🕵️ LGTM ✅
Dimensions covered (expand)
- Exact merge and compaction delta (direct review)
- Explicit self and base symbol reporting (direct review)
- Public API compatibility (direct review and CI evidence)
- Symbol, property, and completion regressions (CI evidence)
Approval withdrawn: current-head check suite 111005229142 is action_required. Build failure workflow tests must clear before approval. The technical source verdict is unchanged.
T-Gro
left a comment
There was a problem hiding this comment.
🤖🕵️ LGTM ✅
Dimensions covered (expand)
- Exact merge and compaction delta (direct review)
- Explicit self and base symbol reporting (direct review)
- Public API compatibility (direct review and CI evidence)
- Symbol, property, and completion regressions (CI evidence)
`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>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… tests The two comment lines about the range of `base` become the name `shadowsCtorParams`, which also makes the `MemberInfo` match redundant: only `MakeAndPublishBaseVal` builds a base val and it has none. The tests reuse `chooseMemberOrFunctionOrValue`, `getRangeCoords` and `shouldEqual`, and the release note states the observable fix only. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The ranges are an array now, and the tests use Assert.Equal and Assert.Empty instead of FSharp.Test.Assert.shouldEqual. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
32b7ec0 to
ed5b6ed
Compare
|
@T-Gro this branch was rebased onto current main ( |
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 leftmember __.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 likethis,selfand_already were.🤖 Generated with Claude Code