Title: Incorrect error in factory function on a dataclass · Issue #5263 · python/mypy · GitHub
Open Graph Title: Incorrect error in factory function on a dataclass · Issue #5263 · python/mypy
X Title: Incorrect error in factory function on a dataclass · Issue #5263 · python/mypy
Description: In Python 3.7.0rc1 and mypy 0.620+dev-5dc7454b1acb47dcbb3361c849e6113efcdbaaf2, if I save the following code to dc_test.py from typing import Type, TypeVar from dataclasses import dataclass T = TypeVar('T', bound='A') @dataclass class A:...
Open Graph Description: In Python 3.7.0rc1 and mypy 0.620+dev-5dc7454b1acb47dcbb3361c849e6113efcdbaaf2, if I save the following code to dc_test.py from typing import Type, TypeVar from dataclasses import dataclass T = Typ...
X Description: In Python 3.7.0rc1 and mypy 0.620+dev-5dc7454b1acb47dcbb3361c849e6113efcdbaaf2, if I save the following code to dc_test.py from typing import Type, TypeVar from dataclasses import dataclass T = Typ...
Opengraph URL: https://github.com/python/mypy/issues/5263
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Incorrect error in factory function on a dataclass","articleBody":"In Python `3.7.0rc1` and mypy `0.620+dev-5dc7454b1acb47dcbb3361c849e6113efcdbaaf2`, if I save the following code to `dc_test.py`\r\n\r\n```python\r\nfrom typing import Type, TypeVar\r\nfrom dataclasses import dataclass\r\n\r\nT = TypeVar('T', bound='A')\r\n\r\n@dataclass\r\nclass A:\r\n\t@classmethod\r\n\tdef make(cls: Type[T]) -> T:\r\n\t\treturn cls()\r\n```\r\n\r\nI get the following mypy output\r\n\r\n```\r\n$ mypy dc_test.py \r\ndc_test.py:10: error: Incompatible return value type (got \"A\", expected \"T\")\r\n```\r\n\r\nIf I comment out the `@dataclass` line, I get no error. I would expect to get no error with or without the `@dataclass` line.","author":{"url":"https://github.com/wkschwartz","@type":"Person","name":"wkschwartz"},"datePublished":"2018-06-21T23:58:43Z","url":"https://github.com/python/mypy/issues/5263"}
| 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:e78f394f-193a-6571-2349-d4e72e45579a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 87EC:26B9F0:410A6E:5AEB1B:6B007013 |
| html-safe-nonce | eab452ca26c94125e0cc70193c99c0b451171cb96374e2871089458130cb6557 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4N0VDOjI2QjlGMDo0MTBBNkU6NUFFQjFCOjZCMDA3MDEzIiwidmlzaXRvcl9pZCI6IjgyMDI3MDczMjE3MDk2ODY4MDMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 1c5adbbbffa8aa8faef8f88f31e15453646f42d556dcad3f9b0dc106e989ad08 |
| hovercard-subject-tag | issue:334699488 |
| 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/5263/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a3233059afc6573b2873efabac3aa712a765765f1512b320761b0e801a8bf735/python/mypy/issues/5263 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a3233059afc6573b2873efabac3aa712a765765f1512b320761b0e801a8bf735/python/mypy/issues/5263 |
| og:image:alt | In Python 3.7.0rc1 and mypy 0.620+dev-5dc7454b1acb47dcbb3361c849e6113efcdbaaf2, if I save the following code to dc_test.py from typing import Type, TypeVar from dataclasses import dataclass T = Typ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | wkschwartz |
| 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