1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

[FunC] Require parenthesis in tricky bitwise precedence cases

Example: "flags & 0xFF != 0" is equivalent to "flags & 1",
most likely it's unexpected.
Example: "a << 2 + 1" (equal to "a << 3", probably unexpected).

The only way to suppress this error for the programmer
is to use parenthesis.
This commit is contained in:
Aleksandr Kirsanov 2024-06-21 15:39:19 +03:00
parent 5867d52926
commit 79721d230e
No known key found for this signature in database
GPG key ID: B758BBAA01FFB3D3
10 changed files with 189 additions and 10 deletions

View file

@ -0,0 +1,11 @@
const MAX_SLIPAGE = 100;
_ main(int jetton_amount, int msg_value, int slippage) {
if (0 == jetton_amount) | (msg_value == 0) | true | false | slippage > MAX_SLIPAGE {
}
}
{-
@compilation_should_fail
@stderr | has lower precedence than >
-}