Narrow overload-error and symbol-use ranges to terminal identifier#19505
Open
Narrow overload-error and symbol-use ranges to terminal identifier#19505
Conversation
Member
|
@copilot : Try again |
Copilot stopped work on behalf of
T-Gro due to an error
March 27, 2026 08:33
Member
|
@copilot : Try again. |
Copilot stopped work on behalf of
T-Gro due to an error
March 27, 2026 11:44
Member
|
@copilot Try again |
Contributor
Author
Implemented the fix in commit aa4c1a9. The For |
Copilot
AI
changed the title
[WIP] Copilot Request
Narrow 'No matching overload' error range to method name only
Mar 31, 2026
aa4c1a9 to
7d2f1e9
Compare
Contributor
❗ Release notes required
|
auduchinok
reviewed
Apr 9, 2026
2751d6e to
47b948d
Compare
a5ac31e to
fc504b7
Compare
bfeba1a to
e89bb2d
Compare
T-Gro
added a commit
that referenced
this pull request
Apr 21, 2026
Addresses reviewer feedback on PR #19505: - r3058446895 / r3058471629: compute narrow ident range in name resolution so diagnostics and tooling (Find Usages, symbol highlight, FSharpSymbolUse) report on the item name rather than the full long-identifier path. Approach: ComputeItemRange now returns (itemRange, itemIdentRange): - itemRange (wide, unchanged) flows into typed-tree construction, sequence points, and the delay-rest continuation. Structural ranges and the debug experience are untouched. - itemIdentRange (narrow, terminal ident) is consumed only by the CallMethodGroupNameResolutionSink / CallNameResolutionSink calls and RegisterUnionCaseTesterForProperty. This fixes #3920 at the source. The PR #19505 post-hoc trim for FS0041 'No overloads match' is retained because it narrows the overload-resolution diagnostic via column arithmetic and is orthogonal to the sink narrowing. FindReferences test expectations updated for 7 cases to reflect the newly-correct narrow symbol-use ranges. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
09db23f to
18ae276
Compare
T-Gro
added a commit
that referenced
this pull request
Apr 22, 2026
Addresses reviewer feedback on PR #19505: - r3058446895 / r3058471629: compute narrow ident range in name resolution so diagnostics and tooling (Find Usages, symbol highlight, FSharpSymbolUse) report on the item name rather than the full long-identifier path. Approach: ComputeItemRange now returns (itemRange, itemIdentRange): - itemRange (wide, unchanged) flows into typed-tree construction, sequence points, and the delay-rest continuation. Structural ranges and the debug experience are untouched. - itemIdentRange (narrow, terminal ident) is consumed only by the CallMethodGroupNameResolutionSink / CallNameResolutionSink calls and RegisterUnionCaseTesterForProperty. This fixes #3920 at the source. The PR #19505 post-hoc trim for FS0041 'No overloads match' is retained because it narrows the overload-resolution diagnostic via column arithmetic and is orthogonal to the sink narrowing. FindReferences test expectations updated for 7 cases to reflect the newly-correct narrow symbol-use ranges. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…14284, #3920) Narrow the FS0041 'No overloads match' error range from the whole expression to just the method name. For T.Instance.Method(""), the error now covers only 'Method' instead of 'T.Instance.Method("")'. Also narrow name-resolution sink ranges (used by Find Usages, symbol highlight, and semantic classification) to the terminal identifier of a dotted long identifier instead of the whole object-expression path. Changes: - NameResolution.fs: ComputeItemRange now returns (itemRange, itemIdentRange). itemRange is the structural whole-long-id span for typed-tree construction. itemIdentRange is the terminal identifier's range for diagnostics and sinks. - CheckExpressions.fs: Intercept UnresolvedOverloading errors in TcMethodApplication and narrow the error range to the method name. - ServiceParamInfoLocations.fs: Update getAllCurriedArgsAtPosition to handle narrowed symbol-use ranges by also checking the leaf function expression. Fixes #14284, #3920 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
5b96681 to
55769f8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #14284, #3920
Problem
The FS0041 'No overloads match for method' error covered the entire expression including object access chains and arguments. For
T.Instance.Method(""), the error underlined everything fromTto). This is especially problematic on larger expressions where the wide error range hides other diagnostics.Similarly, FSharpSymbolUse ranges reported through the name-resolution sink (used by Find Usages, symbol highlight, and semantic classification) covered the whole dotted long-identifier span instead of just the terminal identifier.
Changes
NameResolution.fs/fsi
ComputeItemRangenow returns(itemRange, itemIdentRange):ResolveLongIdentAsExprAndComputeRangeandResolveExprDotLongIdentAndComputeRangepropagateitemIdentRangeand use it forCallMethodGroupNameResolutionSinkCheckExpressions.fs
TcMethodApplication: interceptsUnresolvedOverloadingerrors and narrows the range from the whole expression to just the method name, with guards for multiline expressions, generic constructors, and backtick-escaped namesServiceParamInfoLocations.fs
getAllCurriedArgsAtPosition: updated to handle narrowed symbol-use ranges by checking whetherposfalls within the leaf function expression's range (excluding infix applications)Tests
OverloadResolutionErrorRangeTests.fsBefore
Error underlines
T.Instance.Method("")— the entire expression.After
Error underlines only
Method— the method name.