Closed
Description
If cond: Bool
, a: A
, and b: B
, then mypy thinks (cond and a) or b
has type Union[bool, A, B]
. But in fact the type should just be Union[A, B]
. The only way (cond and a) or b
can be a bool
is for it to be (cond and a)
, and for that to be truth-y; but in that case (cond and a)
would have type A
, and never type bool
(from cond
).