-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Eliminate use of 'as' casts #524
Conversation
This is PR 3 of 44. |
This lint might be deprecated in the future. See dart-lang/sdk#57894 |
Good to know. In general, I think this is still a worthwhile patch for the time being. None of these casts are required under Dart 2's type system. The one case I'm a little disappointed about is having to apply De Morgan's law to the conditional in stream_buffer.dart. It still reads fine, I guess. |
Also enables the avoid_as lint.
} else { | ||
ret[follower] = chunk; | ||
} | ||
follower += subsize; | ||
_offset += subsize; | ||
_counter -= subsize; | ||
leftToRead -= subsize; | ||
if (chunk is! List || _offset >= (chunk as List).length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we file a bug about is!
not promoting to List
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pq do you know if there's a bug on file for this already for the analyzer? I did a quick search on "is! infer type"... guessing this must already exist though :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this is being tracked anywhere. It's possible this will get better w/ the type work for NNBD. @stereotype441: do you happen to know?
Enables the avoid_as lint.