Open mppf opened 2 months ago
This is related to the discussion in https://github.com/chapel-lang/chapel/issues/20873. Reading this issue, I was convinced by the argument that we could transform the code into just the evaluation of the LHS expression, and it looks like that's where I stood most recently at the end of the comment stream on #20873 as well.
Just stumbled across this, which also may be related: https://github.com/chapel-lang/chapel/issues/20496
Summary of Problem
Description: I wrote some code with a pattern like
if i==0 && someType != nothing { something() }
expecting that the compiler will not try to compilesomething()
whensomeType == nothing
. However that doesn't work unless I write it asif someType != nothing && i==0 { something() }
.I'm not sure if this is a bug or not. I understand that if we have
a() && false
that we have to evaluatea()
for side effects. But I would think the compiler can avoid compiling the body of a conditional such asif a() && false { compilerError("bad"); }
.Is this issue currently blocking your progress? No, there is an easy workaround
Steps to Reproduce
Source Code:
Note that it does compile as I would expect if we write
i t != nothing && i == 1
in the above.Associated Future Test(s): TODO