Title: attrs plugin error: "The erased type of self '...*' is not a supertype of its class" on class definition with a generic using a constrained type variable, but then seems to work fine after definition · Issue #5542 · python/mypy · GitHub
Open Graph Title: attrs plugin error: "The erased type of self '...*' is not a supertype of its class" on class definition with a generic using a constrained type variable, but then seems to work fine after definition · Issue #5542 · python/mypy
X Title: attrs plugin error: "The erased type of self '...*' is not a supertype of its class" on class definition with a generic using a constrained type variable, but then seems to work fine after definition · Issue #5542 · python/mypy
Description: Consider the following example: from typing import TypeVar, Generic import attr class V: pass class W: pass T = TypeVar("T", V, W) @attr.s(auto_attribs=True) class A(Generic[T]): v: T reveal_type(A(W())) My expectation here would be a re...
Open Graph Description: Consider the following example: from typing import TypeVar, Generic import attr class V: pass class W: pass T = TypeVar("T", V, W) @attr.s(auto_attribs=True) class A(Generic[T]): v: T reveal_type(A...
X Description: Consider the following example: from typing import TypeVar, Generic import attr class V: pass class W: pass T = TypeVar("T", V, W) @attr.s(auto_attribs=True) class A(Generic[T]): v: T rev...
Opengraph URL: https://github.com/python/mypy/issues/5542
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"attrs plugin error: \"The erased type of self '...*' is not a supertype of its class\" on class definition with a generic using a constrained type variable, but then seems to work fine after definition","articleBody":"Consider the following example:\r\n\r\n```python3\r\nfrom typing import TypeVar, Generic\r\nimport attr\r\n\r\nclass V:\r\n pass\r\n\r\nclass W:\r\n pass\r\n\r\nT = TypeVar(\"T\", V, W)\r\n\r\n@attr.s(auto_attribs=True)\r\nclass A(Generic[T]):\r\n v: T\r\n\r\nreveal_type(A(W()))\r\n```\r\n\r\nMy expectation here would be a revealed type of `A[W*]`, which I *do* get.\r\n\r\nBut I also get an error on the `@attr.s` definition:\r\n```\r\nThe erased type of self 'V*' is not a supertype of its class 'A[T`1]'\r\nThe erased type of self 'W*' is not a supertype of its class 'A[T`1]'\r\n```\r\n\r\nif I remove the constraints on `T`, (i.e. `T = TypeVar(\"T\")`) then the errors go away.","author":{"url":"https://github.com/glyph","@type":"Person","name":"glyph"},"datePublished":"2018-08-30T20:45:03Z","url":"https://github.com/python/mypy/issues/5542"}
| 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:414ccb04-4006-56c0-f4fe-42780730ba2c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9D70:54428:2D11D1:3DB4EB:6B006A70 |
| html-safe-nonce | eeed151f13c3e3c0991dd16f339564cfb2d627edb674dd7e60554cb928f9aca9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RDcwOjU0NDI4OjJEMTFEMTozREI0RUI6NkIwMDZBNzAiLCJ2aXNpdG9yX2lkIjoiNTkyMDU5NDY4MTExNjI1Njg4MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | db5d99518eea635dfa9534fa3ad5af9ae49694a696f0a1172da663b9349159d3 |
| hovercard-subject-tag | issue:355747096 |
| 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/5542/issue_layout |
| twitter:image | https://opengraph.githubassets.com/58c6a9822ac91e498a09b5ea43e3a0657a467250c1fc3ea257255973accd6ab9/python/mypy/issues/5542 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/58c6a9822ac91e498a09b5ea43e3a0657a467250c1fc3ea257255973accd6ab9/python/mypy/issues/5542 |
| og:image:alt | Consider the following example: from typing import TypeVar, Generic import attr class V: pass class W: pass T = TypeVar("T", V, W) @attr.s(auto_attribs=True) class A(Generic[T]): v: T reveal_type(A... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | glyph |
| 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