-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.Use area-devexp instead.type-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
Description
When using non-nullable types, it is possible to write the following:
int? a;
int? b = a!;While this is valid code, it doesn't make sense to do a! when a simple a would be enough.
Since b is nullable, there is no reason to assert that a is not null, as any usage of b would handle the null case.
This is problematic because as we refactor code, it is possible for b to change from non-nullable to nullable.
So while the ! used to make sense, after refactoring it is instead harmful.
This should also support function calls:
void function(int? b) {}
function(a!); // do function(a) insteadMetadata
Metadata
Assignees
Labels
devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.Use area-devexp instead.type-enhancementA request for a change that isn't a bugA request for a change that isn't a bug