-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Area-CompilersFeature - Nullable Reference TypesNullable Reference TypesNullable Reference TypesFeature Request
Milestone
Description
Version Used: Preview 11152017
I have observed several cases where changing the return type of a member results in cascading updates through the code. In many cases, local variables declared to hold the result of invoking these members were already properly used, and the only reason why an update was required is the local variable was declared using the type name rather than using var.
It would be very helpful for the migration process if the semantics/warnings were slightly altered:
- When a nullable value is assigned to a non-nullable local variable in the initializer for the local variable, use a dedicated warning number for the situation and treat the variable as having been declared with a nullable type.
- Provide a code fix for this warning number which adds the missing
?.
This warning can be disabled during the initial migration process for a project that prefers to not use var, with a final pass at the end to enable the warning and apply the code fix to clean up the code base.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-CompilersFeature - Nullable Reference TypesNullable Reference TypesNullable Reference TypesFeature Request