pico8-ls icon indicating copy to clipboard operation
pico8-ls copied to clipboard

Formatter removing necessary parentheses in math

Open icegoat9 opened this issue 1 year ago • 0 comments

I saw some unexpected program behavior after autoformatting, and tracked it down to the formatter removing necessary parentheses in math expressions, which changes the order of operations.

Simple example:

x = 20 - (2 + 3 * 4)

autoformats to:

x = 20 - 2 + 3 * 4

Another example:

x = not (true and false)

Autoformats to the logically different expression:

x = not true and false

icegoat9 avatar Nov 28 '23 07:11 icegoat9