Handle using var in redundant assignment removal#75952
Merged
CyrusNajmabadi merged 1 commit intodotnet:mainfrom Nov 18, 2024
Merged
Handle using var in redundant assignment removal#75952CyrusNajmabadi merged 1 commit intodotnet:mainfrom
using var in redundant assignment removal#75952CyrusNajmabadi merged 1 commit intodotnet:mainfrom
Conversation
Contributor
Author
|
@dotnet-policy-service agree |
- Adds a test to ensure redundant assignment removal respects the `using var` statement. - closes issue dotnet#72829.
23a9d95 to
3d59049
Compare
CyrusNajmabadi
approved these changes
Nov 18, 2024
Contributor
|
Thanks! |
This was referenced Nov 20, 2024
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.
using varstatement.On changing an unused variable to discard
CSharpReplaceDiscardDeclarationsWithAssignmentsService.ReplaceAsync()ensures that instead of local declarations, simple discards are used. Without an exception for using statements, this end up changingusing var _within the scope to be replaced with_regardless of any relation to the variable targeted by the suggestion. This change adds a filter to the method, preserving using statements and the disposal they provide.