Skip to content

Analyzer: no error assigning to a final local via for in loop #35508

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

Closed
MichaelRFairhurst opened this issue Dec 27, 2018 · 1 comment
Closed
Labels
legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@MichaelRFairhurst
Copy link
Contributor

Discovered seemingly on accident by language_2/void/void_type_usage_test/final_local_for_in2

  final Object x = null;                                                         
  for(x in [1, 2]) {}

This doesn't show any errors but of course should. x is final so it cannot be set to 1 and 2.

@MichaelRFairhurst MichaelRFairhurst added legacy-area-analyzer Use area-devexp instead. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Dec 27, 2018
@stereotype441 stereotype441 added the P2 A bug or feature request we're likely to work on label Dec 28, 2018
@srawlins
Copy link
Member

srawlins commented Jun 9, 2020

I think I fixed this at some point.

error • The final variable 'x' can only be set once. • 35508.dart:3:7 • assignment_to_final_local

@srawlins srawlins closed this as completed Jun 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants