Esc

shadowed_it

Finds a nested for hides an it the enclosing loop uses.

Category suspicious, warn by default.

Example
#import "Basic";

main :: () {
    rows := int.[1, 2];

    for rows {
        for 0..it print("%", it);
        print(" row %\n", it);
    }
}
Diagnostic
warning[shadowed_it]: this loop's `it` hides the `it` of the loop on line 6, which is also used
  --> example.jai:7:9
   |
 7 |         for 0..it print("%", it);
   |         ^^^^^^^^^
   |
   = help: name one of the iterators: `for name: ...`
   = note: `shadowed_it` is `warn` by default
Fixed
#import "Basic";

main :: () {
    rows := int.[1, 2];

    for row: rows {
        for 0..row print("%", it);
        print(" row %\n", row);
    }
}

row := it; before the inner loop is the usual idiom and is not reported.