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
When I try to do something like {if GLOBAL == 'x' or GLOBAL == 'y' or GLOBAL== 'z'}
I get a bushel (4, in fact - G==x or G==y, G==x, G==y, G==z) of compiler warnings like
warning: Constant operand 'GLOBAL == 'x' or GLOBAL == 'y'' used with 'or' operator. Consider simplifying
or using the ?: operator, see go/soy/reference/expressions.md#logical-operators
This seems like a fine use of the or operator to me. Yeah the GLOBAL's constant, but I don't know what it's going to be when I'm writing the template. It's my understanding that this is trying to prevent things like {if $x or true} or {let $x: $y or 5} but this is neither of those. The only way out I see to appease the compiler warning is adding some ?: and parens in which seems...unpleasant.
Am I missing something or is this just unfortunate?
The text was updated successfully, but these errors were encountered:
When I try to do something like
{if GLOBAL == 'x' or GLOBAL == 'y' or GLOBAL== 'z'}
I get a bushel (4, in fact - G==x or G==y, G==x, G==y, G==z) of compiler warnings like
This seems like a fine use of the
or
operator to me. Yeah the GLOBAL's constant, but I don't know what it's going to be when I'm writing the template. It's my understanding that this is trying to prevent things like{if $x or true}
or{let $x: $y or 5}
but this is neither of those. The only way out I see to appease the compiler warning is adding some?:
and parens in which seems...unpleasant.Am I missing something or is this just unfortunate?
The text was updated successfully, but these errors were encountered: