Title: Inconsistency in Union/promotion interactions · Issue #6168 · python/mypy · GitHub
Open Graph Title: Inconsistency in Union/promotion interactions · Issue #6168 · python/mypy
X Title: Inconsistency in Union/promotion interactions · Issue #6168 · python/mypy
Description: In the following test from typing import Union class A: x: Union[int, float] def foo(x: Union[int, float], y: A) -> None: reveal_type(x) reveal_type(y.x) we emit: lol.py:8: error: Revealed type is 'Union[builtins.int, builtins.float]' lo...
Open Graph Description: In the following test from typing import Union class A: x: Union[int, float] def foo(x: Union[int, float], y: A) -> None: reveal_type(x) reveal_type(y.x) we emit: lol.py:8: error: Revealed type is ...
X Description: In the following test from typing import Union class A: x: Union[int, float] def foo(x: Union[int, float], y: A) -> None: reveal_type(x) reveal_type(y.x) we emit: lol.py:8: error: Revealed type ...
Opengraph URL: https://github.com/python/mypy/issues/6168
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Inconsistency in Union/promotion interactions","articleBody":"In the following test\r\n```\r\nfrom typing import Union\r\n\r\nclass A:\r\n x: Union[int, float]\r\n\r\ndef foo(x: Union[int, float], y: A) -> None:\r\n reveal_type(x)\r\n reveal_type(y.x)\r\n```\r\nwe emit:\r\n```\r\nlol.py:8: error: Revealed type is 'Union[builtins.int, builtins.float]'\r\nlol.py:9: error: Revealed type is 'builtins.float'\r\n```\r\n\r\nThat is to say, class attributes have unions simplified using promotions while arguments (and locals) do not.\r\n\r\nProbably they ought to have the same behavior?\r\n(And probably the behavior ought to be to *not* simplify, especially because of #6114)","author":{"url":"https://github.com/msullivan","@type":"Person","name":"msullivan"},"datePublished":"2019-01-08T23:32:21Z","url":"https://github.com/python/mypy/issues/6168"}
| 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:3e88c49f-91d7-6992-2fb9-9fc46f02fdc9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BE04:D33AC:C02BED:100C8E4:6B004E82 |
| html-safe-nonce | 58aa9ccd5fe5b4ab96071683e1b99e8d52c3bf60eb4edb2e3fb984db04d7a227 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRTA0OkQzM0FDOkMwMkJFRDoxMDBDOEU0OjZCMDA0RTgyIiwidmlzaXRvcl9pZCI6IjE0ODY3MjczOTExNDQzMzI5MzAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a2f8a4549b4ad377cdd3f3ca3bc5bf46ed042eecbf0797c8f94e1c8f6ecfecdb |
| hovercard-subject-tag | issue:397140285 |
| 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/6168/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1c8259918eaa2472c1aefe5527d7ed4acd3550917aa5d48963c0f372882a67c3/python/mypy/issues/6168 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1c8259918eaa2472c1aefe5527d7ed4acd3550917aa5d48963c0f372882a67c3/python/mypy/issues/6168 |
| og:image:alt | In the following test from typing import Union class A: x: Union[int, float] def foo(x: Union[int, float], y: A) -> None: reveal_type(x) reveal_type(y.x) we emit: lol.py:8: error: Revealed type is ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | msullivan |
| hostname | github.com |
| expected-hostname | github.com |
| None | f9517bf360d46638a1e5e7daee7158842fe5ef43c9000afa0e127564a7c2f39b |
| 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 | b27c5dde30676028abd5c5fc53ce5c9b625f8281 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width