Title: Support basic union math for overloaded functions · Issue #4576 · python/mypy · GitHub
Open Graph Title: Support basic union math for overloaded functions · Issue #4576 · python/mypy
X Title: Support basic union math for overloaded functions · Issue #4576 · python/mypy
Description: I think this idea appeared in context of other issues (mostly related to strict optional), but I hit this few times in another context. Consider this example: Dictable = Union[Dict[str, str], Iterable[Tuple[str, str]]] def do(arg: Dictab...
Open Graph Description: I think this idea appeared in context of other issues (mostly related to strict optional), but I hit this few times in another context. Consider this example: Dictable = Union[Dict[str, str], Itera...
X Description: I think this idea appeared in context of other issues (mostly related to strict optional), but I hit this few times in another context. Consider this example: Dictable = Union[Dict[str, str], Itera...
Opengraph URL: https://github.com/python/mypy/issues/4576
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support basic union math for overloaded functions","articleBody":"I think this idea appeared in context of other issues (mostly related to strict optional), but I hit this few times in another context. Consider this example:\r\n```python\r\nDictable = Union[Dict[str, str], Iterable[Tuple[str, str]]]\r\ndef do(arg: Dictable) -> None:\r\n converted = dict(arg) # mypy errors here, although this is valid\r\n```\r\nThe problem is that `dict.__init__` is defined as an overload. I think we should at least support matching simple cases like:\r\n```python\r\n@overload\r\ndef fun(x: A) -> B: ...\r\n@overload\r\ndef fun(x: C) -> D: ...\r\n\r\narg: Union[A, C]\r\n\r\nfun(arg) # we infer Union[B, D]\r\n```","author":{"url":"https://github.com/ilevkivskyi","@type":"Person","name":"ilevkivskyi"},"datePublished":"2018-02-15T14:55:42Z","url":"https://github.com/python/mypy/issues/4576"}
| 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:2dd4c93e-b59b-c4a9-a3c1-935b88cf1a4f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8046:36D598:6DC1E:94506:6B001B08 |
| html-safe-nonce | 4dc98d6526bf0b88ede74b74c46e8b57f038e3d8dfff5f98377082d33594fbdb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MDQ2OjM2RDU5ODo2REMxRTo5NDUwNjo2QjAwMUIwOCIsInZpc2l0b3JfaWQiOiI5MTg3Njk3MTI5NzU2MzAyMDg4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | c6b789929d237595c4ba11ca191063c263b9ad551efda357e7c88347208d20d7 |
| hovercard-subject-tag | issue:297474629 |
| 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/4576/issue_layout |
| twitter:image | https://opengraph.githubassets.com/76ff1b55b69797898b509a53ddaf8556fef44d20b0efae33057883c012c9e70c/python/mypy/issues/4576 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/76ff1b55b69797898b509a53ddaf8556fef44d20b0efae33057883c012c9e70c/python/mypy/issues/4576 |
| og:image:alt | I think this idea appeared in context of other issues (mostly related to strict optional), but I hit this few times in another context. Consider this example: Dictable = Union[Dict[str, str], Itera... |
| 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 | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width