Title: `Literal`s overlap when defaults given · Issue #6580 · python/mypy · GitHub
Open Graph Title: `Literal`s overlap when defaults given · Issue #6580 · python/mypy
X Title: `Literal`s overlap when defaults given · Issue #6580 · python/mypy
Description: It appears that Literals with default values lead to overlapping signatures. In the following example, the defaults are necessary since this argument follows another defaulted argument. Are you reporting a bug, or opening a feature reque...
Open Graph Description: It appears that Literals with default values lead to overlapping signatures. In the following example, the defaults are necessary since this argument follows another defaulted argument. Are you rep...
X Description: It appears that Literals with default values lead to overlapping signatures. In the following example, the defaults are necessary since this argument follows another defaulted argument. Are you rep...
Opengraph URL: https://github.com/python/mypy/issues/6580
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`Literal`s overlap when defaults given","articleBody":"It appears that `Literal`s with default values lead to overlapping signatures. In the following example, the defaults are necessary since this argument follows another defaulted argument.\r\n\r\n* Are you reporting a bug, or opening a feature request? bug\r\n* Please insert below the code you are checking with mypy.\r\n ```python\r\n @overload\r\n def foo(x: int = 0, y: Literal[False] = False) -> int: ...\r\n @overload\r\n def foo(x: int = 0, y: Literal[True] = True) -> str: ...\r\n @overload\r\n def foo(x: int = 0, y: bool = False) -> Union[int, str]: ...\r\n ```\r\n* What is the actual behavior/output?\r\n ```\r\n Overloaded function signatures 1 and 2 overlap with incompatible return types\r\n ```\r\n* What is the behavior/output you expect?\r\n No error\r\n* What are the versions of mypy and Python you are using?\r\n mypy 0.680+dev.4e0a1583aeb00b248e187054980771f1897a1d31 (current master)\r\n CPython 3.7.1\r\n","author":{"url":"https://github.com/llchan","@type":"Person","name":"llchan"},"datePublished":"2019-03-21T16:58:36Z","url":"https://github.com/python/mypy/issues/6580"}
| 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:46e8073b-999f-0e68-84b1-94b7247a1342 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E554:2E6021:2F1DCEE:3E61E08:6B002943 |
| html-safe-nonce | 17cbbc69beea259a61d92ebcc8aa5eee65c6bc9326fb5001b3592be9941138fa |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNTU0OjJFNjAyMToyRjFEQ0VFOjNFNjFFMDg6NkIwMDI5NDMiLCJ2aXNpdG9yX2lkIjoiNDE0NDY4MjI2ODkzOTUyODUxNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 1a1fec842a46e0d434a942b54e7b09c1c9b4f2915c4cf7f8d336e151c90fc680 |
| hovercard-subject-tag | issue:423839433 |
| 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/6580/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4e67dc6f0b8b984e42621305b53373587722f432aa628568dbb27606a0af3d2a/python/mypy/issues/6580 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4e67dc6f0b8b984e42621305b53373587722f432aa628568dbb27606a0af3d2a/python/mypy/issues/6580 |
| og:image:alt | It appears that Literals with default values lead to overlapping signatures. In the following example, the defaults are necessary since this argument follows another defaulted argument. Are you rep... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | llchan |
| 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