Title: Generic class atributes aren't fully instantiated · Issue #2878 · python/mypy · GitHub
Open Graph Title: Generic class atributes aren't fully instantiated · Issue #2878 · python/mypy
X Title: Generic class atributes aren't fully instantiated · Issue #2878 · python/mypy
Description: T = TypeVar('T') class A(Generic[T]): def f(self, x: T) -> None: ... class B(Generic[T]): x = None # type: A[T] B[int].x.f(0) # E: Argument 1 to "f" of "A" has incompatible type "int"; expected "T" Discovered while reviewing #2873.
Open Graph Description: T = TypeVar('T') class A(Generic[T]): def f(self, x: T) -> None: ... class B(Generic[T]): x = None # type: A[T] B[int].x.f(0) # E: Argument 1 to "f" of "A" has incompatible type "int"; expected "T"...
X Description: T = TypeVar('T') class A(Generic[T]): def f(self, x: T) -> None: ... class B(Generic[T]): x = None # type: A[T] B[int].x.f(0) # E: Argument 1 to "f" of "A" has incomp...
Opengraph URL: https://github.com/python/mypy/issues/2878
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Generic class atributes aren't fully instantiated","articleBody":"```\r\nT = TypeVar('T')\r\nclass A(Generic[T]):\r\n def f(self, x: T) -> None: ...\r\nclass B(Generic[T]):\r\n x = None # type: A[T]\r\n\r\nB[int].x.f(0) # E: Argument 1 to \"f\" of \"A\" has incompatible type \"int\"; expected \"T\"\r\n```\r\n\r\nDiscovered while reviewing #2873.","author":{"url":"https://github.com/miedzinski","@type":"Person","name":"miedzinski"},"datePublished":"2017-02-17T20:08:36Z","url":"https://github.com/python/mypy/issues/2878"}
| 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:8852c75a-2f48-cfdc-c7bf-1cc2560c2acc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E272:2B41BC:FE7D44:1563A77:6B005D96 |
| html-safe-nonce | ab7598498735f8d6350979b7551a7927c68fe7837f4767d07c53b58d07e241a9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMjcyOjJCNDFCQzpGRTdENDQ6MTU2M0E3Nzo2QjAwNUQ5NiIsInZpc2l0b3JfaWQiOiIxMjE0MTE3MjYxMjkyMzYzMTU4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 44a8e70498dde0d4054e66d0310a7fab2bad425e70b8636def606efc51b8b189 |
| hovercard-subject-tag | issue:208542932 |
| 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/2878/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3ca3014498cfff3556943b8c0806c5c6986b708f7e43b5641a99b728a0073e1b/python/mypy/issues/2878 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3ca3014498cfff3556943b8c0806c5c6986b708f7e43b5641a99b728a0073e1b/python/mypy/issues/2878 |
| og:image:alt | T = TypeVar('T') class A(Generic[T]): def f(self, x: T) -> None: ... class B(Generic[T]): x = None # type: A[T] B[int].x.f(0) # E: Argument 1 to "f" of "A" has incompatible type "int"; expected "T"... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | miedzinski |
| hostname | github.com |
| expected-hostname | github.com |
| None | 29be975efff6507a5d135de9c7d634cf7ff8f0c55222a64386ab3202209aaf73 |
| 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 | eacd927ba6112e3b01ba99c762bd699a4a4f5df7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width