mypy icon indicating copy to clipboard operation
mypy copied to clipboard

Fix dataclass/protocol crash on joining types

Open ikonst opened this issue 2 years ago • 2 comments

The root cause is hacky creation of incomplete symbols; instead switching to add_method_to_class which does the necessary housekeeping.

Fixes #15618.

ikonst avatar Jul 09 '23 12:07 ikonst

Diff from mypy_primer, showing the effect of this PR on open source code:

steam.py (https://github.com/Gobot1234/steam.py)
+ steam/app.py:406: error: Cannot use a covariant type variable as a parameter  [misc]
+ steam/profile.py:193: error: Cannot use a covariant type variable as a parameter  [misc]
+ steam/profile.py:270: error: Cannot use a covariant type variable as a parameter  [misc]
+ steam/abc.py:277: error: Cannot use a covariant type variable as a parameter  [misc]
+ steam/post.py:28: error: Cannot use a covariant type variable as a parameter  [misc]
+ steam/comment.py:52: error: Cannot use a covariant type variable as a parameter  [misc]
+ steam/comment.py:54: error: Cannot use a covariant type variable as a parameter  [misc]
+ steam/leaderboard.py:80: error: Cannot use a covariant type variable as a parameter  [misc]
+ steam/leaderboard.py:88: error: Cannot use a covariant type variable as a parameter  [misc]

streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/runtime/state/common.py: note: In member "__mypy-replace" of class "RegisterWidgetResult":
+ lib/streamlit/runtime/state/common.py:128:12: error: Cannot use a covariant type variable as a parameter  [misc]

github-actions[bot] avatar Jul 09 '23 12:07 github-actions[bot]

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

github-actions[bot] avatar Jul 09 '23 13:07 github-actions[bot]