forked from dotnet/roslyn-analyzers
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix to improve code fixer heuristic employed by CA1835 (dotnet#4269)
* Shared Fixer: detect arguments 0 and buffer.Length. * CSharp fixer: Implement method that detects 0 and buffer.Length syntax nodes. * VB fixer: Implement method that detects 0 and buffer.Length syntax nodes. * Test data: Add new test cases to handle partial buffer read/write. Adjust existing test cases that use the full buffer to avoid adding the AsMemory invocation. * ReadAsync tests: Consume the new test data. * WriteAsync tests: Consume the new test data. * Suggestions by Evangelink. * Pass the semantic model to the syntax-specific method. * Adapt the C# syntax-specific method to take the semantic model instance. * Adapt the VB syntax-specific method to take the semantic model instance. * Fix some failing new test cases. * Update the unit tests. * Simplify check for 0 by directly using the constant pattern check on the Value without having to cast to integer first. Use existing WellKnownMemberName instead "Length". Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>
- Loading branch information
1 parent
9f4a09b
commit bdc656a
Showing
6 changed files
with
632 additions
and
230 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.