Title: Inconsistent types for variable with partial type · Issue #4484 · python/mypy · GitHub
Open Graph Title: Inconsistent types for variable with partial type · Issue #4484 · python/mypy
X Title: Inconsistent types for variable with partial type · Issue #4484 · python/mypy
Description: In the example below the variable seemingly has two types (None and x) which is wrong. This also results in an inconsistency with fine-grained incremental mode. x = None def f() -> None: reveal_type(x) # None if x: 1() # No error, consid...
Open Graph Description: In the example below the variable seemingly has two types (None and x) which is wrong. This also results in an inconsistency with fine-grained incremental mode. x = None def f() -> None: reveal_typ...
X Description: In the example below the variable seemingly has two types (None and x) which is wrong. This also results in an inconsistency with fine-grained incremental mode. x = None def f() -> None: reveal_...
Opengraph URL: https://github.com/python/mypy/issues/4484
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Inconsistent types for variable with partial type","articleBody":"In the example below the variable seemingly has two types (`None` and `x`) which is wrong. This also results in an inconsistency with fine-grained incremental mode.\r\n\r\n```py\r\nx = None\r\n\r\ndef f() -> None:\r\n reveal_type(x) # None\r\n if x:\r\n 1() # No error, considered as not reachable\r\n y = 1\r\n else:\r\n y = '' # No error\r\n\r\nx = 1\r\nreveal_type(x) # int\r\n```\r\n\r\nThe expected behavior is for `x` to always have the type `int` and for every line in the example to be considered reachable.","author":{"url":"https://github.com/JukkaL","@type":"Person","name":"JukkaL"},"datePublished":"2018-01-18T11:00:09Z","url":"https://github.com/python/mypy/issues/4484"}
| 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:454f1fe9-185b-aac1-c152-921de7982d3b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 87C8:5537E:26361C2:32AA954:6B005704 |
| html-safe-nonce | 5f623a130be90393ac3b8bf826f3f8412a8dc48a2cbc9eb607d04f63ad0c8763 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4N0M4OjU1MzdFOjI2MzYxQzI6MzJBQTk1NDo2QjAwNTcwNCIsInZpc2l0b3JfaWQiOiI3MjE0MzkzMjMwNDUwNzc1ODEyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | cadb80fbf29b0c58a57bef71471c33b5f96a3ddd8840684acaef170a863f84ee |
| hovercard-subject-tag | issue:289587495 |
| 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/4484/issue_layout |
| twitter:image | https://opengraph.githubassets.com/da88d0519e2de6cae5fcb105311cfb84a65b5784a13ca8075d55e6735c4af055/python/mypy/issues/4484 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/da88d0519e2de6cae5fcb105311cfb84a65b5784a13ca8075d55e6735c4af055/python/mypy/issues/4484 |
| og:image:alt | In the example below the variable seemingly has two types (None and x) which is wrong. This also results in an inconsistency with fine-grained incremental mode. x = None def f() -> None: reveal_typ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JukkaL |
| hostname | github.com |
| expected-hostname | github.com |
| None | f420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb |
| 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 | 26e00df917aba0f128135dc073ea0c5e33a70d40 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width