dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.28k stars 1.58k forks source link

[warning] UNUSED_LOCAL_VARIABLE false negative #59582

Open stephane-archer opened 22 hours ago

stephane-archer commented 22 hours ago
void foo() {
          var i = 0;
          i = i + 1;
}

there is no warning but it should indicate The value of the local variable 'i' isn't used. Try removing the variable or using it. because it's used to update itself and i is not used elsewhere

while withi += 1; it act correctly

pq commented 16 hours ago

Thanks!

(I changed the title a bit to reflect that this is about the UNUSED_LOCAL_VARIABLE warning.)

stephane-archer commented 12 hours ago

Thanks for helping me making a good issue :)