Add more test cases for type narrowing#20603
Conversation
743acf4 to
96fffd3
Compare
test-data/unit/check-isinstance.test
Outdated
| if type(y) is int: # E: Subclass of "str" and "int" cannot exist: would have incompatible method signatures | ||
| y # E: Statement is unreachable | ||
| if type(y) is int: | ||
| y |
There was a problem hiding this comment.
I don't quite get the change here?
There was a problem hiding this comment.
Nothing can be a subclass of an integer and a string at the same time. This error existed in previous versions of Mypy, so I think we should not change it.
There was a problem hiding this comment.
It looks like you removed the error?
There was a problem hiding this comment.
Ah yes - I have fixed that now
ef5cab5 to
f9c63f6
Compare
f9c63f6 to
f76e174
Compare
hauntsaninja
left a comment
There was a problem hiding this comment.
Thank you! This conflicts with some of the changes I have queued up (meta issue #20564 ) / those changes fix some of this, so I will wait for those to land and rebase on top
|
I think I preserved the relevant changes over the merge, but it was a little messy so lmk if I made a mistake |
|
Looks okay to me |
|
Rebased again because #20639 was merged, fixing some more of this. Thanks for the PR and for the issues! |
Test cases added from #20277 (initial PR) after issue #20600 (failing test cases), caused by #20492 (type narrowing PR).
Failing cases have been marked with
-xfail