Title: Unsoundness from unbound type variables in attributes · Issue #6520 · python/mypy · GitHub
Open Graph Title: Unsoundness from unbound type variables in attributes · Issue #6520 · python/mypy
X Title: Unsoundness from unbound type variables in attributes · Issue #6520 · python/mypy
Description: Optional static typing for Python. Contribute to python/mypy development by creating an account on GitHub.
Open Graph Description: Optional static typing for Python. Contribute to python/mypy development by creating an account on GitHub.
X Description: Optional static typing for Python. Contribute to python/mypy development by creating an account on GitHub.
Opengraph URL: https://github.com/python/mypy
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unsoundness from unbound type variables in attributes","articleBody":"Minimized from some real code at dropbox exhibiting this failure in a nasty way.\r\n\r\nThe following code typechecks:\r\n```\r\nfrom typing import TypeVar, Generic\r\n\r\nT = TypeVar('T')\r\nclass A:\r\n def __init__(self, x: T) -> None:\r\n self.x = x\r\n def get(self) -> T:\r\n return self.x\r\n\r\nx: int = A('lol').get()\r\n```\r\nHere, `T` is not bound in the class but ends up in the attribute, where it is then matched with the unbound return type variable in get.\r\n(Interestingly, it also works if `get` returns a different unbound type variable) \r\n\r\nA reveal type reports: ``Revealed type is 'T`-1'``","author":{"url":"https://github.com/msullivan","@type":"Person","name":"msullivan"},"datePublished":"2019-03-06T19:45:22Z","url":"https://github.com/python/mypy/issues/6520"}
| 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 | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:9e8f5445-0d82-a1d3-6fca-02a028dcc575 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BF10:34D604:2047067:2AA15F8:6B00477C |
| html-safe-nonce | 73a001366a5433772db57ca0c80de07e0417e583b7d5449df1f8cc3c88020e71 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRjEwOjM0RDYwNDoyMDQ3MDY3OjJBQTE1Rjg6NkIwMDQ3N0MiLCJ2aXNpdG9yX2lkIjoiMTk3MTA1NDk5OTM2NjcxNjEyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 68155511831804ed49f611aa813b1e6f6738e7b5566848371033a27bf177d977 |
| hovercard-subject-tag | repository:7053637 |
| 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/python/mypy/issues/6520 |
| twitter:image | https://opengraph.githubassets.com/f79ae5636353a0db17350af0a02700f2e9c3bbcf096f9450bf0c369c77cd1022/python/mypy |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f79ae5636353a0db17350af0a02700f2e9c3bbcf096f9450bf0c369c77cd1022/python/mypy |
| og:image:alt | Optional static typing for Python. Contribute to python/mypy development by creating an account on GitHub. |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| turbo-cache-control | no-cache |
| 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 | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width