Title: Failing to concatenate fix lengths tuples if the tuple depends on a variable · Issue #8416 · python/mypy · GitHub
Open Graph Title: Failing to concatenate fix lengths tuples if the tuple depends on a variable · Issue #8416 · python/mypy
X Title: Failing to concatenate fix lengths tuples if the tuple depends on a variable · Issue #8416 · python/mypy
Description: I believe this is a bug. Reproduced with mypy 0.761 on Ubuntu 18.04. In this code: def breaks(self) -> None: var = True t = ("a","b") + (("c","d") if var else tuple()) def works(self) -> None: t = ("a","b") + (("c","d") if True else tupl...
Open Graph Description: I believe this is a bug. Reproduced with mypy 0.761 on Ubuntu 18.04. In this code: def breaks(self) -> None: var = True t = ("a","b") + (("c","d") if var else tuple()) def works(self) -> None: t = ...
X Description: I believe this is a bug. Reproduced with mypy 0.761 on Ubuntu 18.04. In this code: def breaks(self) -> None: var = True t = ("a","b") + (("c","d") if var ...
Opengraph URL: https://github.com/python/mypy/issues/8416
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Failing to concatenate fix lengths tuples if the tuple depends on a variable","articleBody":"I believe this is a bug. Reproduced with mypy 0.761 on Ubuntu 18.04.\r\n\r\nIn this code:\r\n```python\r\ndef breaks(self) -> None:\r\n var = True\r\n t = (\"a\",\"b\") + ((\"c\",\"d\") if var else tuple())\r\n\r\ndef works(self) -> None:\r\n t = (\"a\",\"b\") + ((\"c\",\"d\") if True else tuple())\r\n```\r\n\r\nThe `works` function works fine, but the `breaks` function breaks with the following error:\r\n\r\n```\r\n$ mypy tuple_if.py \r\ntuple_if.py:3: error: No overload variant of \"__add__\" of \"tuple\" matches argument type \"object\"\r\ntuple_if.py:3: note: Possible overload variants:\r\ntuple_if.py:3: note: def __add__(self, Tuple[str, ...]) -> Tuple[str, ...]\r\ntuple_if.py:3: note: def __add__(self, Tuple[Any, ...]) -> Tuple[Any, ...]\r\nFound 1 error in 1 file (checked 1 source file)\r\n```\r\n\r\nI would expect the behaviour to be the same in both functions.\r\n","author":{"url":"https://github.com/knatten","@type":"Person","name":"knatten"},"datePublished":"2020-02-18T13:33:56Z","url":"https://github.com/python/mypy/issues/8416"}
| 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:49950055-335c-02b6-2b59-df9512d691b6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9288:39E772:5C7CD9:7DC7C6:6B00744D |
| html-safe-nonce | 95dc0f7a03a8c4ad5d88d5290d03d392913e2400c2cc2646ebbb4cd56e102d76 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Mjg4OjM5RTc3Mjo1QzdDRDk6N0RDN0M2OjZCMDA3NDREIiwidmlzaXRvcl9pZCI6IjE1NDU4MjQ0NjA3ODE5NDc2NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8efe21ef22c94567a8829fb835093bc454dc89df1a8e0d1ad0d2f92071a0fe2c |
| hovercard-subject-tag | issue:566896193 |
| 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/8416/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cf2750d626fb1f6544cbae95ea7bd14ba813c8067a4c5b6fdbbc79d1839d734b/python/mypy/issues/8416 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cf2750d626fb1f6544cbae95ea7bd14ba813c8067a4c5b6fdbbc79d1839d734b/python/mypy/issues/8416 |
| og:image:alt | I believe this is a bug. Reproduced with mypy 0.761 on Ubuntu 18.04. In this code: def breaks(self) -> None: var = True t = ("a","b") + (("c","d") if var else tuple()) def works(self) -> None: t = ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | knatten |
| hostname | github.com |
| expected-hostname | github.com |
| None | 75c2b65dd205f26961d0c29afed1a8d0bb7cca9f05780571dfd1ef93eb539d16 |
| 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 | 84e563eb4b55f8fa102f325f117533cee9e3df4a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width