Skip to content

Allow submitting rename conflicts and rename unambiguous erroneous references  - #84686

Merged
akhera99 merged 2 commits into
dotnet:mainfrom
akhera99:fix_rename_refactor_conflict
Jul 30, 2026
Merged

Allow submitting rename conflicts and rename unambiguous erroneous references #84686
akhera99 merged 2 commits into
dotnet:mainfrom
akhera99:fix_rename_refactor_conflict

Conversation

@akhera99

@akhera99 akhera99 commented Jul 29, 2026

Copy link
Copy Markdown
Member

Fixes: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2942743

Two issues fixed:

  • Unresolved conflicts remain visible but no longer block submission. Invalid replacement text still blocks submission
  • References with unrelated binding errors, such as Test(x) where x does not exist, are renamed if there is exactly one candidate
Microsoft Reviewers: Open in CodeFlow

Copilot AI review requested due to automatic review settings July 29, 2026 18:31
@akhera99
akhera99 requested a review from a team as a code owner July 29, 2026 18:31
@akhera99 akhera99 changed the title  Allow submitting rename conflicts and rename unambiguous erroneous references  Allow submitting rename conflicts and rename unambiguous erroneous references  Jul 29, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts rename behavior to (1) allow committing an inline rename even when unresolved conflicts remain, and (2) treat certain overload-resolution-failure reference sites as renamable when binding is effectively unambiguous. It also updates and adds regression tests around these scenarios.

Changes:

  • Inline rename UI now blocks submission only on invalid replacement text, not on unresolved-conflict status.
  • Rename reference processing reclassifies some OverloadResolutionFailure sites to allow renaming when exactly one candidate symbol is present.
  • Adds/updates editor/rename tests for erroneous-but-unambiguous references and submit-with-conflicts scenarios.
Show a summary per file
File Description
src/Workspaces/Core/Portable/Rename/SymbolicRenameLocations.ReferenceProcessing.cs Computes a refined candidate-reason for overload-resolution-failure references to allow renaming when unambiguous.
src/Workspaces/Core/Portable/Rename/RenameUtilities.cs Expands symbol picking at caret to include OverloadResolutionFailure candidate symbols.
src/EditorFeatures/Test2/Rename/RenameEngineTests.CSharpConflicts.vb Adds regression tests for rename over unbound arguments and constructor arguments.
src/EditorFeatures/Test2/Rename/InlineRenameTests.vb Updates a test to validate submit behavior with conflicts vs invalid replacement text.
src/EditorFeatures/Core/InlineRename/UI/Adornment/RenameFlyoutViewModel.cs Changes submit gating to rely on replacement-text validity instead of status severity.

Copilot's findings

  • Files reviewed: 5/5 changed files
  • Comments generated: 3

Comment thread src/EditorFeatures/Test2/Rename/InlineRenameTests.vb
Copilot AI review requested due to automatic review settings July 29, 2026 20:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot's findings

Comments suppressed due to low confidence (1)

src/EditorFeatures/Test2/Rename/InlineRenameTests.vb:161

  • RenameToConflictingMemberReportsConflictAndAllowsSubmit now asserts only that Submit() returns true for an unresolved-conflict scenario, but it doesn't verify the commit actually applied (i.e., that Foo was renamed). Since Submit() is fire-and-forget, this test can pass even if commit is still blocked deeper in the pipeline.
                    Assert.Equal(RenameFlyoutViewModel.Severity.Error, viewModel.StatusSeverity)
                    Assert.True(viewModel.Submit())

                    Await WaitForRename(workspace)
  • Files reviewed: 5/5 changed files
  • Comments generated: 0 new

@akhera99
akhera99 merged commit 7970a5a into dotnet:main Jul 30, 2026
25 checks passed
jaredpar pushed a commit to jaredpar/roslyn that referenced this pull request Jul 30, 2026
…ferences  (dotnet#84686)

Fixes: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2942743

Two issues fixed:
- Unresolved conflicts remain visible but no longer block submission.
Invalid replacement text still blocks submission
- References with unrelated binding errors, such as `Test(x)` where `x`
does not exist, are renamed if there is exactly one candidate

###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/dotnet/roslyn/pull/84686)
@jjonescz jjonescz added this to the 18.11 milestone Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants