Title: meet.is_overlapping_types should be more relaxed for isinstance checks · Issue #5529 · python/mypy · GitHub
Open Graph Title: meet.is_overlapping_types should be more relaxed for isinstance checks · Issue #5529 · python/mypy
X Title: meet.is_overlapping_types should be more relaxed for isinstance checks · Issue #5529 · python/mypy
Description: Currently, the implementation of meet.is_overlapping_types(...) defaults to returning False when it encounters two unexpected types, and doesn't attempt to handle multiple inheritance at all. The current implementation also considers two...
Open Graph Description: Currently, the implementation of meet.is_overlapping_types(...) defaults to returning False when it encounters two unexpected types, and doesn't attempt to handle multiple inheritance at all. The c...
X Description: Currently, the implementation of meet.is_overlapping_types(...) defaults to returning False when it encounters two unexpected types, and doesn't attempt to handle multiple inheritance at all. T...
Opengraph URL: https://github.com/python/mypy/issues/5529
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"meet.is_overlapping_types should be more relaxed for isinstance checks","articleBody":"Currently, the implementation of `meet.is_overlapping_types(...)` defaults to returning False when it encounters two unexpected types, and doesn't attempt to handle multiple inheritance at all. The current implementation also considers two types like `List[A]` and `List[B]` to be non-overlapping, even though they may overlap when both lists are empty.\r\n\r\nThis behavior makes sense when `is_overlapping_types` is used to detect unsafe overload variants, but may be too restrictive/cause branches to be unexpectedly unreachable when used for isinstance checks and `if x is None` checks and the like.\r\n\r\nFor more context, see https://github.com/python/mypy/pull/5476#discussion_r211030040 and https://github.com/python/mypy/issues/3603.\r\n\r\nSome possible solutions include:\r\n\r\n1. Add a flag that makes `is_overlapping_types` default to returning True, not False. The main disadvantage here is that this would then make `is_overlapping_types` consider two unrelated types like `Type[A]` and `TypedDict[...]` to be overlapping, which seems wrong.\r\n2. Add a flag named `allow_multiple_inheritance` which makes the \"if left and right are Instances\" case just always return True. The main disadvantage here is that this may not capture every edge case we want to relax.\r\n\r\nIt may also be the case that neither solutions work and a more careful rearrangement of `is_overlapping_types` is necessary. The existing implementation of `is_overlapping_types` is designed to rule out bad combinations/normalize all types to `Instance` whenever possible, which may or may not be the correct thing to do for reachability checks.","author":{"url":"https://github.com/Michael0x2a","@type":"Person","name":"Michael0x2a"},"datePublished":"2018-08-27T15:51:42Z","url":"https://github.com/python/mypy/issues/5529"}
| 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:5bd0b410-f8c4-be0f-0c49-2b73bc6e0e85 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8BB8:2AD163:1BE86CC:25B33BA:6B000547 |
| html-safe-nonce | 82af947e2c939f1d0989c5d4de6c7c956ff2c090f62c9d151f91ba720fe341eb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QkI4OjJBRDE2MzoxQkU4NkNDOjI1QjMzQkE6NkIwMDA1NDciLCJ2aXNpdG9yX2lkIjoiNTUzOTg2MTI1Nzg0ODM1ODIxNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 57a29c9277be913c1356ef775c46c9d9264c1a2e3f77a940707f5f9f58b8f917 |
| hovercard-subject-tag | issue:354374532 |
| 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/5529/issue_layout |
| twitter:image | https://opengraph.githubassets.com/91786eccebf9c54f7b1330f44f1c83f13478fb76216ddef0a3f017723aca9c42/python/mypy/issues/5529 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/91786eccebf9c54f7b1330f44f1c83f13478fb76216ddef0a3f017723aca9c42/python/mypy/issues/5529 |
| og:image:alt | Currently, the implementation of meet.is_overlapping_types(...) defaults to returning False when it encounters two unexpected types, and doesn't attempt to handle multiple inheritance at all. The c... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Michael0x2a |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729 |
| 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 | 16a11879678aaf97e2a42c33ee70830aa084fa37 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width