moonbitlang / core

MoonBit's Core library
https://moonbitlang.com/
Apache License 2.0
483 stars 54 forks source link

report unused loop state variable #485

Open bobzhang opened 1 month ago

bobzhang commented 1 month ago

in cases like this:

for i = 0, len=arr.len() {
   continue i + 1, len
}

we should report warnings for such cases:

  1. when loop state variables never change // this should be lifted
  2. when loop state varabiles never used, not used in break condition or anywhere