Title: TypeVar bound is ignored in generic alias · Issue #10445 · python/mypy · GitHub
Open Graph Title: TypeVar bound is ignored in generic alias · Issue #10445 · python/mypy
X Title: TypeVar bound is ignored in generic alias · Issue #10445 · python/mypy
Description: Bug Report A generic alias using a TypeVar with a bound allows type arguments that don't match the bound To Reproduce % cat tvbound.py import typing FooT = typing.TypeVar("FooT", bound=str) FooIsh = typing.Union[int, FooT] bat2: FooIsh[f...
Open Graph Description: Bug Report A generic alias using a TypeVar with a bound allows type arguments that don't match the bound To Reproduce % cat tvbound.py import typing FooT = typing.TypeVar("FooT", bound=str) FooIsh ...
X Description: Bug Report A generic alias using a TypeVar with a bound allows type arguments that don't match the bound To Reproduce % cat tvbound.py import typing FooT = typing.TypeVar("FooT", boun...
Opengraph URL: https://github.com/python/mypy/issues/10445
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TypeVar bound is ignored in generic alias","articleBody":"**Bug Report**\r\n\r\nA generic alias using a TypeVar with a bound allows type arguments that don't match the bound\r\n\r\n**To Reproduce**\r\n\r\n```\r\n% cat tvbound.py \r\nimport typing\r\n\r\nFooT = typing.TypeVar(\"FooT\", bound=str)\r\nFooIsh = typing.Union[int, FooT]\r\n\r\nbat2: FooIsh[float] = 1.0\r\n\r\n% mypy tvbound.py\r\nSuccess: no issues found in 1 source file\r\n% mypy --version\r\nmypy 0.820+dev.e8afde621531880c2b9c51acba8e565a29cde0b1\r\n```\r\n\r\n**Expected Behavior**\r\n\r\nI would expect an error saying that the value of `FooT` cannot be `float`.\r\n\r\nFound this as a result of https://github.com/microsoft/pyright/issues/1839.","author":{"url":"https://github.com/JelleZijlstra","@type":"Person","name":"JelleZijlstra"},"datePublished":"2021-05-07T18:24:35Z","url":"https://github.com/python/mypy/issues/10445"}
| 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:a8bbba3b-fb4c-b45a-af70-2c56a5f19fdd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C7A0:4C4E6:2EA24F:3FF3AB:6B006A76 |
| html-safe-nonce | 57130f04a7ff3e459ff6a82c4e04da2902fb6e276971def79e59883d95928085 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDN0EwOjRDNEU2OjJFQTI0RjozRkYzQUI6NkIwMDZBNzYiLCJ2aXNpdG9yX2lkIjoiNzg5ODQxNDA1MTMzODc3NTE1OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ae5152736d33a1ceaa61e077559e4319150a818dd6bf857f8e4c14c5354ba1f5 |
| hovercard-subject-tag | issue:879494104 |
| 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/10445/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9ea05be565041e9020484da487669400af7fa26520b972f1a15d9e0eb9b80f4f/python/mypy/issues/10445 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9ea05be565041e9020484da487669400af7fa26520b972f1a15d9e0eb9b80f4f/python/mypy/issues/10445 |
| og:image:alt | Bug Report A generic alias using a TypeVar with a bound allows type arguments that don't match the bound To Reproduce % cat tvbound.py import typing FooT = typing.TypeVar("FooT", bound=str) FooIsh ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JelleZijlstra |
| 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