Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix F# semantic classification for delegates, slices, CEs, open type#19960

Merged
abonie merged 5 commits into
dotnet:mainfrom
T-Gro:fix/issue-19905
Jun 30, 2026
Merged

Fix F# semantic classification for delegates, slices, CEs, open type#19960
abonie merged 5 commits into
dotnet:mainfrom
T-Gro:fix/issue-19905

Conversation

@T-Gro

@T-Gro T-Gro commented Jun 16, 2026

Copy link
Copy Markdown
Member

Addresses #19905. Four F# editor semantic-classification errors:

  • Delegate declarations no longer paint the delegate of … signature as a method.
  • Computation-expression builders inside list/array comprehensions classify as ComputationExpression.
  • The closing ] of an open-ended slice (xs[0..]) is no longer classified as Function/Method.
  • open type T is no longer reported as unused when its static members, static fields, or DU cases are used.

The generic-argument colorization items (Type<int>.Member, generic constructor/method calls) are deferred: narrowing the shared name-resolution range to fix coloring breaks find-all-references, completion, and parameter-info.

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

❗ Release notes required

You can open this PR in browser to add release notes: open in github.dev


✅ 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

T-Gro pushed a commit to T-Gro/fsharp that referenced this pull request Jun 16, 2026
@github-actions github-actions Bot added the AI-Tooling-Check-Scanned-Clean Tooling check: diff analyzed, no interesting infrastructure files label Jun 16, 2026
@T-Gro T-Gro changed the title Fix semantic classification regressions Fix semantic classification regressions (#19905) Jun 17, 2026
T-Gro pushed a commit that referenced this pull request Jun 17, 2026
@T-Gro T-Gro changed the title Fix semantic classification regressions (#19905) Fix F# semantic classification for delegates, slices, CEs, open type Jun 18, 2026
@T-Gro T-Gro force-pushed the fix/issue-19905 branch 2 times, most recently from 4c44aad to 1637561 Compare June 18, 2026 12:25
…5/7)

Items 1/2/5/7 are completion-safe and shipped here:
- item 1: suppress the synthesized delegate Invoke value over the `delegate of ...` RHS
- item 2: classify CE builders inside list/array comprehensions as ComputationExpression
- item 5: don't paint slice brackets as Method; fix open-ended slice upper-bound range
- item 7: `open type T` is not unused when its static members/fields or DU cases are used

Items 3/4/6 (generic `<...>` argument colorization) are deferred: narrowing the
shared name-resolution range to fix colorization breaks find-all-references,
completion and parameter-info, because the resolution sink matches symbol uses by
exact range end. The correct fix requires separating classification ranges from
symbol-use ranges in the sink. Guard tests assert the IDE features still work.

Co-authored-by: Copilot <[email protected]>
@T-Gro T-Gro force-pushed the fix/issue-19905 branch from 1637561 to 91f7e55 Compare June 18, 2026 12:56
@T-Gro T-Gro requested a review from abonie June 25, 2026 14:14
@abonie

abonie commented Jun 25, 2026

Copy link
Copy Markdown
Member

@copilot resolve the merge conflicts in this pull request

@T-Gro T-Gro left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 This review was generated by AI (@expert-reviewer agent). Findings may contain inaccuracies — please verify independently.

Nice, well-targeted set of fixes with thorough regression tests. The range1 → range2 change in ExpandIndexArgs correctly attaches the synthesized None of an open-ended slice's upper bound to the upper-bound range. A few suppression heuristics look slightly broader than the bugs they target — flagged inline for verification (all editor-classification only, low severity).

Comment thread src/Compiler/Service/SemanticClassification.fs
Comment thread src/Compiler/Service/SemanticClassification.fs
Comment thread src/Compiler/Service/ServiceAnalysis.fs
@T-Gro T-Gro added the AI-reviewed PR reviewed by AI review council label Jun 30, 2026
Copilot AI and others added 2 commits June 30, 2026 12:18
Responds to the expert-reviewer feedback on the editor semantic-classification fixes:

- GetSlice/SetSlice suppression: document why the synthesized indexer (xs[a..])
  cannot be distinguished from an explicit .GetSlice(..) call in this pass (no
  source text; both Item.MethodGroup resolutions cover the receiver). The broad
  suppression is an intentional trade-off.
- open type unused-detection: clarify that recording static-member/static-field
  uses against the declaring entity mirrors existing open <module> behavior, and
  add a regression test asserting open type and open <module> behave consistently
  when their members are only ever used fully qualified.

Co-authored-by: Copilot <[email protected]>
@abonie abonie merged commit edc2513 into dotnet:main Jun 30, 2026
49 checks passed
T-Gro added a commit that referenced this pull request Jul 1, 2026
The merge=union driver on docs/release-notes/**/*.md dropped main's
#19960 and #19883 entries when merging main into the branch. Restore
main's file and keep only our FS0039 entry as the added change.

Co-authored-by: Copilot <[email protected]>
@T-Gro T-Gro deleted the fix/issue-19905 branch July 2, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-reviewed PR reviewed by AI review council AI-Tooling-Check-Scanned-Clean Tooling check: diff analyzed, no interesting infrastructure files

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants