Closed
Description
I couldn't find any definitive specification on this other than PEP 285
Here's the input program (which I expect to cause no linting errors)
x = True
x |= False
However it results in the following:
$ mypy test.py
test.py:2: error: Incompatible types in assignment (expression has type "int", variable has type "bool")
$ pip freeze -l
mypy==0.560
psutil==5.4.2
typed-ast==1.1.0
It seems that PEP 285 is implemented faithfully in the versions of python I was able to check:
$ echo -n '2.6 2.7 3.4 3.5 3.6' | xargs -d' ' --replace -- bash -xc "python{} -c 'assert type(False | True) is bool'"
+ python2.6 -c 'assert type(False | True) is bool'
+ python2.7 -c 'assert type(False | True) is bool'
+ python3.4 -c 'assert type(False | True) is bool'
+ python3.5 -c 'assert type(False | True) is bool'
+ python3.6 -c 'assert type(False | True) is bool'
Metadata
Metadata
Assignees
Labels
No labels