Title: PEP 647 support mishandles higher-order functions · Issue #9927 · python/mypy · GitHub
Open Graph Title: PEP 647 support mishandles higher-order functions · Issue #9927 · python/mypy
X Title: PEP 647 support mishandles higher-order functions · Issue #9927 · python/mypy
Description: See #9865 for the initial PEP 647 support (type guards). I did not manage to get this to work right for higher-order functions, notably combined with overloads. There's a test that fails: testTypeGuardOverload in check-typeguard.test. Th...
Open Graph Description: See #9865 for the initial PEP 647 support (type guards). I did not manage to get this to work right for higher-order functions, notably combined with overloads. There's a test that fails: testTypeG...
X Description: See #9865 for the initial PEP 647 support (type guards). I did not manage to get this to work right for higher-order functions, notably combined with overloads. There's a test that fails: testT...
Opengraph URL: https://github.com/python/mypy/issues/9927
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"PEP 647 support mishandles higher-order functions","articleBody":"See #9865 for the initial PEP 647 support (type guards).\r\n\r\nI did not manage to get this to work right for higher-order functions, notably combined with overloads.\r\n\r\nThere's a test that fails: [testTypeGuardOverload](https://github.com/python/mypy/blob/fffbe88fc54807c8b10ac40456522ad2faf8d350/test-data/unit/check-typeguard.test#L248-L275) in check-typeguard.test. The crux is\r\n```py\r\n@overload\r\ndef filter(f: Callable[[T], TypeGuard[R]], it: Iterable[T]) -> Iterator[R]: ...\r\n@overload\r\ndef filter(f: Callable[[T], bool], it: Iterable[T]) -> Iterator[T]: ...\r\ndef filter(*args): pass\r\n```","author":{"url":"https://github.com/gvanrossum","@type":"Person","name":"gvanrossum"},"datePublished":"2021-01-18T17:57:33Z","url":"https://github.com/python/mypy/issues/9927"}
| 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:68ed9d48-5dc0-96d9-e52e-3479fd1d2d8b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CCDE:31F9AC:4FF406:6FD6B0:6B00743D |
| html-safe-nonce | ae7a78789c9550a4e227dea4d914798ec751af42fb8283ae45445d0771684097 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQ0RFOjMxRjlBQzo0RkY0MDY6NkZENkIwOjZCMDA3NDNEIiwidmlzaXRvcl9pZCI6IjcyMTMwMjg5NTQ1NDA5MDMwMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 124b6eb1e0d76f91bf0ce0e5e443dcfc7d6f899e1dd6f36f8b5510912a7fa660 |
| hovercard-subject-tag | issue:788456057 |
| 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/9927/issue_layout |
| twitter:image | https://opengraph.githubassets.com/95bf8d5ad0991f3ed5f9519341962b12b6be95fa2743c08a70eb46d0680ac3a2/python/mypy/issues/9927 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/95bf8d5ad0991f3ed5f9519341962b12b6be95fa2743c08a70eb46d0680ac3a2/python/mypy/issues/9927 |
| og:image:alt | See #9865 for the initial PEP 647 support (type guards). I did not manage to get this to work right for higher-order functions, notably combined with overloads. There's a test that fails: testTypeG... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gvanrossum |
| 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