|
Should this always warn or in strict mode only? This could be a general "Condition is always true" warning. Always enabled. Makes sense. Landed in rev. 3152 as a generalized "WARNING: Expression is constant (always true or always false)." I think slightly better wording would be "WARNING: Expression will always have the same boolean value". Also, it just hit me - callable are not necessarily always true. Any callable that isn't an implicit conversion from a method group might evaluate to false if it's null: event MyEvent as callable() MyEvent() if MyEvent # raise MyEvent if it has any subscribers We don't want a warning on that. So warnings should only be emitted when using method names in a boolean context. This case with event does not warn since code is already looking specifically for the method kind of callables. Anyways your comment made me review code and I noticed only implicit internal callables issued a warning, this is fixed now (rev. 3164). Changed the text to "WARNING: Boolean expression will always have the same value." |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sounds like a good idea to provide a warning, at least.