Esc

neg_multiply

Finds x * -1, which is -x.

Category style, warn by default.

Example
#import "Basic";

flip :: (x: int) -> int {
    return x * -1;
}

main :: () {
    print("%\n", flip(5));
}
Diagnostic
warning[neg_multiply]: `x * -1` is a negation
  --> example.jai:4:12
   |
 4 |     return x * -1;
   |            ^^^^^^
   |
help: write `-x`
   |
 4 ~     return -x;
   |
   = note: `neg_multiply` is `warn` by default
Fixed
#import "Basic";

flip :: (x: int) -> int {
    return -x;
}

main :: () {
    print("%\n", flip(5));
}

Signed integers and floats only, and only the literals -1 and -1.0.