-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add nullability information to extract method (#37851)
Extract method will now maintain nullable reference types for parameters and return types. If the parameters or return types are determined to be non-nullable through flow state analysis, then we will adjust them to be non-null when generating. For return type, the adjustment is done after the method is generated. This is because the generator can and will introduce new return statements that need to be analyzed for null state. The only way a return type can be modified to non null is if it: 1. Was null annotated to start with 2. All returns are determined to return non-null by flow state analysis. Similarly, reference parameters can be assigned null or non-null values inside a method. We determine parameters can be adjusted if: 1. Null is not passed into the parameter. 2. Null is never assigned to the parameter.
- Loading branch information
Showing
10 changed files
with
811 additions
and
113 deletions.
There are no files selected for viewing
613 changes: 613 additions & 0 deletions
613
src/EditorFeatures/CSharpTest/CodeActions/ExtractMethod/ExtractMethodTests.cs
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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.