Closed
Description
Consider the following code
foo = sum([True, False])
foo += 1
mypy
v0.931 is OK with it and reportsfoo
type asint
mypy
v0.940 warns
Incompatible types in assignment (expression has type "int", variable has type "Union[bool, Literal[0]]")
The stub does indeed state
@overload
def sum(__iterable: Iterable[_SumT]) -> _SumT | Literal[0]: ...
Though it is somewhat unfortunate. I've got beaten by this after updating mypy
to the latest version.
Metadata
Metadata
Assignees
Labels
No labels