int_plus_one
Finds x >= y + 1, which is x > y.
Category complexity, warn by default.
#import "Basic";
over_limit :: (count: int, limit: int) -> bool {
return count >= limit + 1;
}
main :: () {
print("%\n", over_limit(5, 4));
}warning[int_plus_one]: `count >= limit + 1` is a strict comparison written with `1`
--> example.jai:4:12
|
4 | return count >= limit + 1;
| ^^^^^^^^^^^^^^^^^^
|
help: write `count > limit`
|
4 ~ return count > limit;
|
= note: `int_plus_one` is `warn` by default#import "Basic";
over_limit :: (count: int, limit: int) -> bool {
return count > limit;
}
main :: () {
print("%\n", over_limit(5, 4));
}Integers only, and only the literal 1. The editor offers the strict comparison; --fix leaves it, since where y + 1 wraps (the top of the type) the two forms differ.