Title: overload with tuples of different arity · Issue #5302 · python/mypy · GitHub
Open Graph Title: overload with tuples of different arity · Issue #5302 · python/mypy
X Title: overload with tuples of different arity · Issue #5302 · python/mypy
Description: When using overload, I realized that it wrongly does not complain about type mismatches as soon as one defines overloaded versions with Tuple of different arites. Here comes a minimal example: from typing import Tuple, TypeVar, overload,...
Open Graph Description: When using overload, I realized that it wrongly does not complain about type mismatches as soon as one defines overloaded versions with Tuple of different arites. Here comes a minimal example: from...
X Description: When using overload, I realized that it wrongly does not complain about type mismatches as soon as one defines overloaded versions with Tuple of different arites. Here comes a minimal example: from...
Opengraph URL: https://github.com/python/mypy/issues/5302
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"overload with tuples of different arity","articleBody":"When using `overload`, I realized that it wrongly does not complain about type mismatches as soon as one defines overloaded versions with Tuple of different arites. Here comes a minimal example:\r\n\r\n```\r\nfrom typing import Tuple, TypeVar, overload, List, Any\r\n\r\nT = TypeVar('T')\r\n_1 = TypeVar('_1')\r\n_2 = TypeVar('_2')\r\n_3 = TypeVar('_3')\r\n\r\n@overload\r\ndef foo(bar: List[T], baz: List[T]) -> List[T]:\r\n pass\r\n\r\n@overload\r\ndef foo(bar: Tuple[_1, _2], baz: Tuple[_1, _2]) -> Tuple[_1, _2]:\r\n pass\r\n\r\n@overload\r\ndef foo(bar: Tuple[_1, _2, _3], baz: Tuple[_1, _2, _3]) -> Tuple[_1, _3]:\r\n pass\r\n\r\ndef foo(bar: Any, baz: Any) -> Any:\r\n return (bar[0], baz[-1])\r\n\r\n# good call to foo\r\nd: Tuple[int, str] = foo((1, 'a'), (2, 'a'))\r\n\r\n# should fails, but currently only fails if Tuple[_1, _2, _3] overload is removed\r\ne: Tuple[int, str] = foo((1, 'a'), (2, 3)) \r\n```\r\n\r\n* mypy 0.610\r\n* Python 3.6.5","author":{"url":"https://github.com/wabu","@type":"Person","name":"wabu"},"datePublished":"2018-06-30T14:04:01Z","url":"https://github.com/python/mypy/issues/5302"}
| 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:5f877c08-c55d-29d2-39eb-abc3b248c40f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8E2C:1A3D7F:310A2C8:40DD1D3:6B002949 |
| html-safe-nonce | 74aee55cd81e1c9b9af079d9e5aa2e18c93c76f19ed4729d4d9ccd8826963878 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RTJDOjFBM0Q3RjozMTBBMkM4OjQwREQxRDM6NkIwMDI5NDkiLCJ2aXNpdG9yX2lkIjoiNTMwMjIxNDc2MDI0MTA0Nzg4MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 66611e3c249bd79c4d8938cdbe999dc90961de2e00eec96840dac0991224eb83 |
| hovercard-subject-tag | issue:337217137 |
| 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/5302/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a3197ea41d98b0eb412cab5a1c06a73b7c1f2b863e0b79f0b4a5c90ac4b74b8f/python/mypy/issues/5302 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a3197ea41d98b0eb412cab5a1c06a73b7c1f2b863e0b79f0b4a5c90ac4b74b8f/python/mypy/issues/5302 |
| og:image:alt | When using overload, I realized that it wrongly does not complain about type mismatches as soon as one defines overloaded versions with Tuple of different arites. Here comes a minimal example: from... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | wabu |
| 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