Title: Incorrect incompatible override report with self type + overload · Issue #14002 · python/mypy · GitHub
Open Graph Title: Incorrect incompatible override report with self type + overload · Issue #14002 · python/mypy
X Title: Incorrect incompatible override report with self type + overload · Issue #14002 · python/mypy
Description: Given this code: from typing import overload, TypeVar, Generic T = TypeVar("T", str, int) class A(Generic[T]): @overload def f(self: A[int]) -> int: ... @overload def f(self: A[str]) -> str: ... def f(self): ... class B(A[int]): def f(se...
Open Graph Description: Given this code: from typing import overload, TypeVar, Generic T = TypeVar("T", str, int) class A(Generic[T]): @overload def f(self: A[int]) -> int: ... @overload def f(self: A[str]) -> str: ... de...
X Description: Given this code: from typing import overload, TypeVar, Generic T = TypeVar("T", str, int) class A(Generic[T]): @overload def f(self: A[int]) -> int: ... @overload def f(self: A[str]) -...
Opengraph URL: https://github.com/python/mypy/issues/14002
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Incorrect incompatible override report with self type + overload","articleBody":"Given this code:\r\n```python\r\nfrom typing import overload, TypeVar, Generic\r\n\r\nT = TypeVar(\"T\", str, int)\r\n\r\nclass A(Generic[T]):\r\n @overload\r\n def f(self: A[int]) -> int: ...\r\n @overload\r\n def f(self: A[str]) -> str: ...\r\n def f(self): ...\r\n \r\nclass B(A[int]):\r\n def f(self) -> int: ...\r\n```\r\nhttps://mypy-play.net/?mypy=latest&python=3.10&gist=736b946030f3c52e14c712ce7e95464c\r\n\r\nmypy 0.981 reports `main.py:13: error: Signature of \"f\" incompatible with supertype \"A\"`.\r\n\r\nThis is incorrect: `B` is an `A[int]`, so it doesn't matter that it doesn't implement the second overload.","author":{"url":"https://github.com/JelleZijlstra","@type":"Person","name":"JelleZijlstra"},"datePublished":"2022-11-04T03:08:25Z","url":"https://github.com/python/mypy/issues/14002"}
| 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:2173cb0c-03a3-a5ac-a79e-533fe9dd8f27 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BD1A:115983:2CF26A:3C6415:6B0025B2 |
| html-safe-nonce | d4a931be43b2d993b0201323dadb97042c7fa877eb858325a937e7e90024131c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRDFBOjExNTk4MzoyQ0YyNkE6M0M2NDE1OjZCMDAyNUIyIiwidmlzaXRvcl9pZCI6IjM1MDc5NDU5MzcwMTQxMDU1MjIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 65e90a452800bf98eb71863041ce236ebb1745ffb41ac07d112b82ed03b92b0b |
| hovercard-subject-tag | issue:1435481101 |
| 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/14002/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1de59639aaa86bb6f0f349aec8a6c083b78ef06294fcef020b26365ef2e21634/python/mypy/issues/14002 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1de59639aaa86bb6f0f349aec8a6c083b78ef06294fcef020b26365ef2e21634/python/mypy/issues/14002 |
| og:image:alt | Given this code: from typing import overload, TypeVar, Generic T = TypeVar("T", str, int) class A(Generic[T]): @overload def f(self: A[int]) -> int: ... @overload def f(self: A[str]) -> str: ... de... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JelleZijlstra |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width