autocast_in_arg
Finds xx, the automatic cast, written as an argument of a call.
Category restriction, allow by default.
Off by default; the example is shown with the rule enabled.
#import "Basic";
draw :: (x: s32, y: s32) -> s32 {
return x + y;
}
main :: () {
width: s64 = 640;
print("%\n", draw(xx width, 10));
}warning[autocast_in_arg]: `xx` leaves the target type to the parameter (`s64` to `s32`)
--> example.jai:10:23
|
10 | print("%\n", draw(xx width, 10));
| ^^
|
help: write `cast(s32)` to say so
|
10 ~ print("%\n", draw(cast(s32) width, 10));
|#import "Basic";
draw :: (x: s32, y: s32) -> s32 {
return x + y;
}
main :: () {
width: s64 = 640;
print("%\n", draw(cast(s32) width, 10));
}The call site then depends on the parameter types: changing draw to take a float instead of an s32 changes what xx does at every call, and nothing there says so.