You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
voidfunction(int? b) {}
function(a!); // do function(a) instead
The text was updated successfully, but these errors were encountered:
When using non-nullable types, it is possible to write the following:
While this is valid code, it doesn't make sense to do
a!
when a simplea
would be enough.Since
b
is nullable, there is no reason to assert thata
is not null, as any usage ofb
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:
The text was updated successfully, but these errors were encountered: