You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One could say the root cause is that one of our optimizations for simplifying &&s is based off of whether the contextual type is bool (the problem goes away if you add : bool after export const runtime). That optimization would work if both operand types are bool, but since avoiding compiling the RHS is part of that optimization (and we don't know the expression type until compiling it), we can't exactly do that. (Note: just checking the left operand's type wouldn't work, since true && 3 should return an i32.)
Anyways, my fix for this is to precompute the left operand if possible, and then simplify the expression further if possible. PR coming shortly.
Activity
CountBleck commentedon Sep 7, 2025
One could say the root cause is that one of our optimizations for simplifying
&&s is based off of whether the contextual type isbool(the problem goes away if you add: boolafterexport const runtime). That optimization would work if both operand types arebool, but since avoiding compiling the RHS is part of that optimization (and we don't know the expression type until compiling it), we can't exactly do that. (Note: just checking the left operand's type wouldn't work, sincetrue && 3should return ani32.)Anyways, my fix for this is to precompute the left operand if possible, and then simplify the expression further if possible. PR coming shortly.
fix: simplify && and || when the LHS is constant
fix: simplify && and || when the LHS is constant