Title: False negative for non-overlapping type check inside function with strict_equality flag · Issue #10055 · python/mypy · GitHub
Open Graph Title: False negative for non-overlapping type check inside function with strict_equality flag · Issue #10055 · python/mypy
X Title: False negative for non-overlapping type check inside function with strict_equality flag · Issue #10055 · python/mypy
Description: Bug Report To Reproduce Run this file to test.py: if 'red' == 5: # <-- Mypy finds error print('equal') def foo(): if 'red' == 5: # <-- Mypy does not find error print('equal') foo() then execute mypy test.py --strict-equality Expected Beh...
Open Graph Description: Bug Report To Reproduce Run this file to test.py: if 'red' == 5: # <-- Mypy finds error print('equal') def foo(): if 'red' == 5: # <-- Mypy does not find error print('equal') foo() then execute myp...
X Description: Bug Report To Reproduce Run this file to test.py: if 'red' == 5: # <-- Mypy finds error print('equal') def foo(): if 'red' == 5: # <-- Mypy does not find error print(&...
Opengraph URL: https://github.com/python/mypy/issues/10055
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"False negative for non-overlapping type check inside function with strict_equality flag","articleBody":"\u003c!--\r\n If you're new to mypy and you're not sure whether what you're experiencing is a mypy bug, please see the \"Question and Help\" form\r\n instead.\r\n-->\r\n\r\n**Bug Report**\r\n\r\n\u003c!--\r\nNote: If the problem you are reporting is about a specific library function, then the typeshed tracker is better suited\r\nfor this report: https://github.com/python/typeshed/issues\r\n-->\r\n\r\n\r\n**To Reproduce**\r\n\r\nRun this file to `test.py`:\r\n\r\n```python\r\nif 'red' == 5: # \u003c-- Mypy finds error\r\n print('equal')\r\n\r\ndef foo():\r\n if 'red' == 5: # \u003c-- Mypy does not find error\r\n print('equal')\r\n\r\nfoo()\r\n```\r\n\r\nthen execute\r\n\r\n```shell\r\nmypy test.py --strict-equality\r\n```\r\n**Expected Behavior**\r\n\r\nMypy should find 2 errors in this file.\r\n\r\n**Actual Behavior**\r\n\r\nMypy fails to find the error inside the function.\r\n\r\n**Your Environment**\r\n\r\n\u003c!-- Include as many relevant details about the environment you experienced the bug in -->\r\n\r\n- Mypy version used: 0.8000\r\n- Mypy command-line flags: `--strict-equality`\r\n- Mypy configuration options from `mypy.ini` (and other config files): None\r\n- Python version used: 3.9.1\r\n- Operating system and version: Ubuntu 18.04\r\n\r\n\r\n","author":{"url":"https://github.com/Garrett-R","@type":"Person","name":"Garrett-R"},"datePublished":"2021-02-09T23:20:31Z","url":"https://github.com/python/mypy/issues/10055"}
| 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:356748b2-6194-e7d4-dec5-8083cfa3e148 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9556:609A0:2BA6F58:3900281:6B000A61 |
| html-safe-nonce | 7bf09d1758599ddab84c825c0baee5846941ad932115c7837c585b43712c52de |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NTU2OjYwOUEwOjJCQTZGNTg6MzkwMDI4MTo2QjAwMEE2MSIsInZpc2l0b3JfaWQiOiIyODAxOTk5MzY4MjA5NTY2MzA1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f76b330bdf3bdd7687bf6d06cb7c0fa174bef4c74195201614a1f20b6f2d992f |
| hovercard-subject-tag | issue:805007989 |
| 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/10055/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6f865184d464095950099d4ea5fd0a4bbc15c3749bb20f933fca7bab5e5e9fb0/python/mypy/issues/10055 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6f865184d464095950099d4ea5fd0a4bbc15c3749bb20f933fca7bab5e5e9fb0/python/mypy/issues/10055 |
| og:image:alt | Bug Report To Reproduce Run this file to test.py: if 'red' == 5: # <-- Mypy finds error print('equal') def foo(): if 'red' == 5: # <-- Mypy does not find error print('equal') foo() then execute myp... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Garrett-R |
| 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