analysis_options: move to language - strict-casts:true (#1725)

Handle extra strictness around for loops.

- Add a cast to `List`.
- Extract some work to a helper method that can be called from two
  branches so that inference from the `is` checks works better with
  no reassignment.

Co-authored-by: Nate Bosch <nbosch@google.com>
8 files changed