mdgriffith/elm-codegen

Missing parentheses for boolean operations

Closed this issue · 1 comments

This code:

(Elm.Op.and (Elm.bool False)
    (Elm.Op.or (Elm.bool True)
        (Elm.bool True)
    )
)

Produces

False && True || True

instead of

False && (True || True)

Which drastically changes the meaning.

Good catch!

Now each term in an infix op will potentially get parens if appropriate (as determined by Compiler.parens)