Allow submitting rename conflicts and rename unambiguous erroneous references - #84686
Merged
Conversation
|
Azure Pipelines: Successfully started running 2 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
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
OverloadResolutionFailuresites 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
Contributor
There was a problem hiding this comment.
Copilot's findings
Comments suppressed due to low confidence (1)
src/EditorFeatures/Test2/Rename/InlineRenameTests.vb:161
RenameToConflictingMemberReportsConflictAndAllowsSubmitnow asserts only thatSubmit()returns true for an unresolved-conflict scenario, but it doesn't verify the commit actually applied (i.e., thatFoowas renamed). SinceSubmit()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
dibarbet
approved these changes
Jul 29, 2026
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)
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: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2942743
Two issues fixed:
Test(x)wherexdoes not exist, are renamed if there is exactly one candidateMicrosoft Reviewers: Open in CodeFlow