Title: Confusing error message: List item 0 has incompatible type "Type[Linear]"; expected "Type[Linear]" · Issue #10160 · python/mypy · GitHub
Open Graph Title: Confusing error message: List item 0 has incompatible type "Type[Linear]"; expected "Type[Linear]" · Issue #10160 · python/mypy
X Title: Confusing error message: List item 0 has incompatible type "Type[Linear]"; expected "Type[Linear]" · Issue #10160 · python/mypy
Description: Bug Report In some situations, mypy can report that there was an incompatible type X, but then say that the expected type was also X. Regardless of whether or not the program is correct or not, this error message is bad. To Reproduce fro...
Open Graph Description: Bug Report In some situations, mypy can report that there was an incompatible type X, but then say that the expected type was also X. Regardless of whether or not the program is correct or not, thi...
X Description: Bug Report In some situations, mypy can report that there was an incompatible type X, but then say that the expected type was also X. Regardless of whether or not the program is correct or not, thi...
Opengraph URL: https://github.com/python/mypy/issues/10160
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Confusing error message: List item 0 has incompatible type \"Type[Linear]\"; expected \"Type[Linear]\"","articleBody":"**Bug Report**\r\n\r\nIn some situations, mypy can report that there was an incompatible type X, but then say that the expected type was also X. Regardless of whether or not the program is correct or not, this error message is bad.\r\n\r\n**To Reproduce**\r\n\r\n```\r\nfrom typing import Any\r\n \r\nclass Linear:\r\n def __init__(self, **kwargs) -> None:\r\n pass\r\n\r\nclass QatLinear(Linear):\r\n def __init__(self, qconfig=None):\r\n pass\r\n\r\ndef f(x: Any):\r\n if type(x) in [Linear, QatLinear]:\r\n pass\r\n```\r\n\r\n**Expected Behavior** mypy gives me a good error message\r\n\r\n**Actual Behavior**\r\n\r\n```\r\n(base) ezyang-mbp:~ ezyang$ mypy t.py\r\nt.py:12: error: List item 0 has incompatible type \"Type[Linear]\"; expected \"Type[Linear]\"\r\nFound 1 error in 1 file (checked 1 source file)\r\n```\r\n\r\n**Your Environment**\r\n\r\n- Mypy version used: mypy 0.780\r\n- Mypy command-line flags: none\r\n- Mypy configuration options from `mypy.ini` (and other config files): none\r\n- Python version used: Python 3.7\r\n- Operating system and version: OS X","author":{"url":"https://github.com/ezyang","@type":"Person","name":"ezyang"},"datePublished":"2021-03-03T21:03:11Z","url":"https://github.com/python/mypy/issues/10160"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d6e61437-eb5e-0690-8785-d7f2ac185c36 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BA66:1C3DC0:65E7:87BB:6B001934 |
| html-safe-nonce | aeaca05516d8738abbd2d95a04909fff6192fb1103dbc3a23a608856189d6671 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQTY2OjFDM0RDMDo2NUU3Ojg3QkI6NkIwMDE5MzQiLCJ2aXNpdG9yX2lkIjoiNjYxODk1NTU4MTc2MTc4ODIxMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6cacaadbb7dfa96f6a6666e645a0fe553ee2d15b31048e9762387badc0531c5e |
| hovercard-subject-tag | issue:821482170 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/mypy/10160/issue_layout |
| twitter:image | https://opengraph.githubassets.com/23720b05bc6e721fc34e1f333e20bb002a281415881f8dc6e3dc322bb9ffd1fe/python/mypy/issues/10160 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/23720b05bc6e721fc34e1f333e20bb002a281415881f8dc6e3dc322bb9ffd1fe/python/mypy/issues/10160 |
| og:image:alt | Bug Report In some situations, mypy can report that there was an incompatible type X, but then say that the expected type was also X. Regardless of whether or not the program is correct or not, thi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ezyang |
| hostname | github.com |
| expected-hostname | github.com |
| None | a2dd2291b1b13cc9c06f27ec92fa3dbaf34116fc24c9347b8539db61884c59f4 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 70121d4e855ee0bb7b75cf15d061d91f8863c0f8 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width