assert_constant
Finds assert(true) or #assert true, which can never fail.
Category style, warn by default.
#import "Basic";
main :: () {
x := 3;
assert(true, "x is positive");
print("%\n", x);
}warning[assert_constant]: `assert(true)` can never fail
--> example.jai:6:5
|
6 | assert(true, "x is positive");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove it, or assert the condition it stands in for
|
6 - assert(true, "x is positive");
7 -
|
= note: `assert_constant` is `warn` by default#import "Basic";
main :: () {
x := 3;
assert(x > 0, "x is positive");
print("%\n", x);
}The call must be to a procedure with the @AssertsArgument note (the library's assert).