Skip to content

Render declaring type for C#-style extensions in overload errors#19925

Open
T-Gro wants to merge 5 commits into
mainfrom
fix/issue-9838
Open

Render declaring type for C#-style extensions in overload errors#19925
T-Gro wants to merge 5 commits into
mainfrom
fix/issue-9838

Conversation

@T-Gro

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

Copy link
Copy Markdown
Member

Fixes #9838

Overload-resolution error messages for C#-style extension methods now
attribute candidates to their declaring type (e.g. MemoryExtensions)
instead of the receiver type.

Copilot and others added 4 commits June 9, 2026 16:20
…type

Failing tests (4) drive the fix where C#-style extension method overload

errors should attribute extension overloads to their declaring type

(e.g. MemoryExtensions) rather than the receiver type (e.g. Foo).

Gate tests (2) protect F#-style extension and regular instance method

renderings from regressing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… comment

On net48 the test sandbox does not reference System.Memory, so Span<T> resolves to FS0039 rather than producing the bug-bearing FS0041 overload-resolution diagnostic. Use [<FactForNETCOREAPP>] for the four RED tests so they exercise the real bug on net10.0 and are skipped on net472 instead of failing for the wrong reason. The GATE tests (F#-style extension, regular instance method) keep [<Fact>] and run on both frameworks.

Also append a multi-line (* ... *) comment block at the bottom of the file capturing the current vs expected diagnostic text, so the implementation sprint has the exact strings to compare against.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
C#-style extension method overload-error messages now show the type that declares the extension (e.g. MemoryExtensions) instead of the receiver type (e.g. Foo). Tooltip/hover rendering and F#-style extension rendering are unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Document the fix for C#-style extension method overload error rendering in the FSharp.Compiler.Service 11.0.100 release notes.

Sprint 3 verification:

- dotnet fantomas on touched files: no changes

- SurfaceAreaTest (Release): passed, stringOfMethInfoForOverloadError not in public surface

- Issue9838 component tests (Debug): 6/6 passed

- ErrorMessages component tests (Debug): 576/576 succeeded, 2 skipped (pre-existing)

- Overload component tests (Debug): 101/101 succeeded, 23 skipped (pre-existing)

- Full ComponentTests (Release): 7207 passed, 2 unrelated pre-existing failures verified on main (d0e593f) without the fix applied:

    * Language.InterpolatedStringsTests.'Explicit %P does not cause exception when culture set to Thai[th]' (FSharp.Core printf runtime IndexOutOfRange under Thai culture; independent of NicePrint)

    * Language.SequenceExpression.'Handler body executes once when source throws immediately and handler yields nothing' (seq codegen counter mismatch; independent of NicePrint)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Jun 9, 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

@github-actions github-actions Bot added the AI-Tooling-Check-Bypassed Tooling check: non-fork PR, not diff-analyzed label Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-Tooling-Check-Bypassed Tooling check: non-fork PR, not diff-analyzed

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

Confusing message about extension method CopyTo being available for any type

1 participant