Title: Generic inner classes sees type variable from outer class · Issue #3144 · python/mypy · GitHub
Open Graph Title: Generic inner classes sees type variable from outer class · Issue #3144 · python/mypy
X Title: Generic inner classes sees type variable from outer class · Issue #3144 · python/mypy
Description: T = TypeVar('T') class Outer(Generic[T]): class Inner: x: T # E: Invalid type "test.T" (correct) def f(self, x: T) -> T: ... # ok (incorrect) def g(self) -> None: y: T # E: Invalid type "test.T" (correct) Source
Open Graph Description: T = TypeVar('T') class Outer(Generic[T]): class Inner: x: T # E: Invalid type "test.T" (correct) def f(self, x: T) -> T: ... # ok (incorrect) def g(self) -> None: y: T # E: Invalid type "test.T" (c...
X Description: T = TypeVar('T') class Outer(Generic[T]): class Inner: x: T # E: Invalid type "test.T" (correct) def f(self, x: T) -> T: ... # ok (incorrect) def g(self) -> None: y: T # E: ...
Opengraph URL: https://github.com/python/mypy/issues/3144
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Generic inner classes sees type variable from outer class","articleBody":"```\r\nT = TypeVar('T')\r\nclass Outer(Generic[T]):\r\n class Inner:\r\n x: T # E: Invalid type \"test.T\" (correct)\r\n def f(self, x: T) -> T: ... # ok (incorrect)\r\n def g(self) -> None:\r\n y: T # E: Invalid type \"test.T\" (correct)\r\n```\r\n\r\n[Source](https://www.python.org/dev/peps/pep-0484/#scoping-rules-for-type-variables)","author":{"url":"https://github.com/pkch","@type":"Person","name":"pkch"},"datePublished":"2017-04-08T05:21:49Z","url":"https://github.com/python/mypy/issues/3144"}
| 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:8fae9a6e-4454-c410-6e55-3addbbee8dbf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B918:29923:244D99:330EF2:6B0069BE |
| html-safe-nonce | b6aa1483bd1594d32d8d6edfeb5b7dd8803bee97f9c8a90ea337cbf9ba8ebc6b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOTE4OjI5OTIzOjI0NEQ5OTozMzBFRjI6NkIwMDY5QkUiLCJ2aXNpdG9yX2lkIjoiNTY1ODczMDIzMzAyMTM2MDU3NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d631912498ac0aaa3bfeedc168ee0c1ac2e1bdc6d9971a366f526640e670560d |
| hovercard-subject-tag | issue:220376961 |
| 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/3144/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d19b111e9efc79db88ec60613ae35a43d631b6fcf6dee47f3419c6b838ead16c/python/mypy/issues/3144 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d19b111e9efc79db88ec60613ae35a43d631b6fcf6dee47f3419c6b838ead16c/python/mypy/issues/3144 |
| og:image:alt | T = TypeVar('T') class Outer(Generic[T]): class Inner: x: T # E: Invalid type "test.T" (correct) def f(self, x: T) -> T: ... # ok (incorrect) def g(self) -> None: y: T # E: Invalid type "test.T" (c... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pkch |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6527e91c60c0b29d16606ff32ac5df8ecdc37a2a62205ea057a14d7762c870fa |
| 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 | 46f1cd2ae3cd8ae1a81019b5d619742e76f13bbd |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width