effekt icon indicating copy to clipboard operation
effekt copied to clipboard

Overeager JS inliner forgets to parenthesize

Open jiribenes opened this issue 1 year ago • 1 comments

Continuing from https://github.com/effekt-lang/effekt/pull/493, we haven't solved the general issue: the JS inliner is great at inlining, but it might inline (s1 + s2).length into s1 + s2.length without the parentheses.

Here's an example from @marvinborner from #493 which showcases similar buggy behaviour:

> "abc" == "def"
false
> ("abc" == "def").not
false
> not ("abc" == "def")
false
> val huh = "abc" == "def"
> huh.not
true

jiribenes avatar Jun 18 '24 15:06 jiribenes

Inductively, it should be enough to always parenthesize the spliced expressions.

b-studios avatar Jun 18 '24 18:06 b-studios