Esc

range_past_count

Finds for i: 0..xs.count indexing xs[i], one past the end.

Category correctness, deny by default.

Example
#import "Basic";

main :: () {
    names := string.["a", "b", "c"];
    for i: 0..names.count {
        print("%\n", names[i]);
    }
}
Diagnostic
error[range_past_count]: `names.count` is one past the last index of `names`
  --> example.jai:5:15
   |
 5 |     for i: 0..names.count {
   |               ^^^^^^^^^^^
   |
help: ranges include their end: write `names.count - 1`
   |
 5 ~     for i: 0..names.count - 1 {
   |
   = note: `range_past_count` is `deny` by default
Fixed
#import "Basic";

main :: () {
    names := string.["a", "b", "c"];
    for i: 0..names.count - 1 {
        print("%\n", names[i]);
    }
}

Ranges include their end. Quiet when the body mentions xs.count (it may guard the index).