Closed LeXofLeviafan closed 4 years ago
I'm really glad you reported this. I remember when I was investigating #1096, I noticed the code that caused this issue and idly wondered how it was that it worked. It can't be broken, I thought; surely someone would have reported that bug! So much for that flawless reasoning. :grimacing:
When compiling the code
x = (if foo! then bar(that) or baz(that))
(that is, relying on if-let to locally bind result of the first subexpression), the resulting JavaScript looks like this:Which works pretty straightforwardly, as one would expect. If, however, you pass the same exact expression to, say,
while
loop, the output will have different structure:Which deviates from expected behaviour, because now
baz
will be executed even whenthat
is falsey (due to JavaScript operator precedence). It is possible to reproduce structure from the first example in second case, but only by providing an explicitelse
branch: