Title: Union subtyping doesn't work with covariant type constructors Tuple and Callable · Issue #7187 · python/mypy · GitHub
Open Graph Title: Union subtyping doesn't work with covariant type constructors Tuple and Callable · Issue #7187 · python/mypy
X Title: Union subtyping doesn't work with covariant type constructors Tuple and Callable · Issue #7187 · python/mypy
Description: Both calls in this code fail, but I think they should be allowed: from typing import Callable, Union, Tuple def f(x: Union[Callable[..., int], Callable[..., str]]) -> None: ... x: Callable[..., Union[int, str]] f(x) def g(y: Union[Tuple[...
Open Graph Description: Both calls in this code fail, but I think they should be allowed: from typing import Callable, Union, Tuple def f(x: Union[Callable[..., int], Callable[..., str]]) -> None: ... x: Callable[..., Uni...
X Description: Both calls in this code fail, but I think they should be allowed: from typing import Callable, Union, Tuple def f(x: Union[Callable[..., int], Callable[..., str]]) -> None: ... x: Callable[..., ...
Opengraph URL: https://github.com/python/mypy/issues/7187
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Union subtyping doesn't work with covariant type constructors Tuple and Callable","articleBody":"Both calls in this code fail, but I think they should be allowed:\r\n```python\r\nfrom typing import Callable, Union, Tuple\r\n\r\ndef f(x: Union[Callable[..., int], Callable[..., str]]) -> None: ...\r\nx: Callable[..., Union[int, str]]\r\nf(x)\r\n\r\ndef g(y: Union[Tuple[int], Tuple[str]]) -> None: ...\r\ny: Tuple[Union[int, str]]\r\ng(y)\r\n```\r\nMoreover, I would say types in each pair are actually equivalent.","author":{"url":"https://github.com/ilevkivskyi","@type":"Person","name":"ilevkivskyi"},"datePublished":"2019-07-09T21:08:20Z","url":"https://github.com/python/mypy/issues/7187"}
| 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:7e481872-8813-0f15-d100-8b907f39d110 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C0DC:106F5D:C5700B:108BAE5:6B005086 |
| html-safe-nonce | 1e00abf1e6d0251e9e4a8626b4406af4cdfed100f89da39ec32678444c3e06b5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMERDOjEwNkY1RDpDNTcwMEI6MTA4QkFFNTo2QjAwNTA4NiIsInZpc2l0b3JfaWQiOiIxMjcxMDIzMjgwMTU2ODU2NDU0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 0aaf74ae6cb9879ec0eb692e0804ddc0fdacb1a8a4e0cc96bd1c7bb0ebe84821 |
| hovercard-subject-tag | issue:465985584 |
| 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/7187/issue_layout |
| twitter:image | https://opengraph.githubassets.com/971f7145b9e5087b81c0fea3e148902c4b1fcb952dce0efbb5ab496f0b2a6565/python/mypy/issues/7187 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/971f7145b9e5087b81c0fea3e148902c4b1fcb952dce0efbb5ab496f0b2a6565/python/mypy/issues/7187 |
| og:image:alt | Both calls in this code fail, but I think they should be allowed: from typing import Callable, Union, Tuple def f(x: Union[Callable[..., int], Callable[..., str]]) -> None: ... x: Callable[..., Uni... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ilevkivskyi |
| hostname | github.com |
| expected-hostname | github.com |
| None | f420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb |
| 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 | 26e00df917aba0f128135dc073ea0c5e33a70d40 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width