# to complete the Type 1 (ast.*) nmigen language construct abstraction
# from Type 2 (Module - this class) Module must be told what AST type
# it may cast m.If/Elif conditions and m.Switch
+ self._astType = _astType or Value
def _check_context(self, construct, context):
if self._ctrl_context != context:
"Replace `~flag` with `not flag`. (If this is a false positive, "
"silence this warning with `m.If(x)` → `m.If(x.bool())`.)",
SyntaxWarning, stacklevel=4)
+ # check if the condition is not considered boolean, and only
+ # convert it if it is not
+ if not cond.considered_bool():
+ cond = cond.bool()
return cond
@_guardedcontextmanager("If")