Title: Seemingly correct type narrowing, but still incompatible type · Issue #13744 · python/mypy · GitHub
Open Graph Title: Seemingly correct type narrowing, but still incompatible type · Issue #13744 · python/mypy
X Title: Seemingly correct type narrowing, but still incompatible type · Issue #13744 · python/mypy
Description: Bug Report Mypy seems to type narrow correctly, but still throws an error when trying to add to a set. To Reproduce Gist URL: https://gist.github.com/c10befca044d78713b96a9706ac355b2 Playground URL: https://mypy-play.net/?mypy=master&pyt...
Open Graph Description: Bug Report Mypy seems to type narrow correctly, but still throws an error when trying to add to a set. To Reproduce Gist URL: https://gist.github.com/c10befca044d78713b96a9706ac355b2 Playground URL...
X Description: Bug Report Mypy seems to type narrow correctly, but still throws an error when trying to add to a set. To Reproduce Gist URL: https://gist.github.com/c10befca044d78713b96a9706ac355b2 Playground URL...
Opengraph URL: https://github.com/python/mypy/issues/13744
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Seemingly correct type narrowing, but still incompatible type","articleBody":"\u003c!--\r\nIf you're not sure whether what you're experiencing is a mypy bug, please see the \"Question and Help\" form instead.\r\nPlease consider:\r\n\r\n- checking our common issues page: https://mypy.readthedocs.io/en/stable/common_issues.html\r\n- searching our issue tracker: https://github.com/python/mypy/issues to see if it's already been reported\r\n- asking on gitter chat: https://gitter.im/python/typing\r\n-->\r\n\r\n**Bug Report**\r\n\r\n\u003c!--\r\nIf you're reporting a problem with a specific library function, the typeshed tracker is better suited for this report: https://github.com/python/typeshed/issues\r\n\r\nIf the project you encountered the issue in is open source, please provide a link to the project.\r\n-->\r\n\r\nMypy seems to type narrow correctly, but still throws an error when trying to add to a set.\r\n\r\n**To Reproduce**\r\n\r\nGist URL: https://gist.github.com/c10befca044d78713b96a9706ac355b2\r\nPlayground URL: https://mypy-play.net/?mypy=master&python=3.10&gist=c10befca044d78713b96a9706ac355b2\r\n\r\n**Expected Behavior**\r\n\r\n\u003c!--\r\nHow did you expect mypy to behave? It’s fine if you’re not sure your understanding is correct.\r\nWrite down what you thought would happen. If you expected no errors, delete this section.\r\n-->\r\n\r\nNo error.\r\n\r\n**Actual Behavior**\r\n\r\n```\r\nmain.py:15: error: Argument 1 to \"add\" of \"set\" has incompatible type \"Data\"; expected \"Data\"\r\nFound 1 error in 1 file (checked 1 source file)\r\n```\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: `mypy 0.990+dev.780534b13722b7b0422178c049a1cbbf4ea4255b (compiled: no)`\r\n- Mypy command-line flags: none\r\n- Mypy configuration options from `mypy.ini` (and other config files): none\r\n- Python version used: 3.10.7\r\n\r\n\u003c!-- You can freely edit this text, please remove all the lines you believe are unnecessary. -->\r\n","author":{"url":"https://github.com/hwong557","@type":"Person","name":"hwong557"},"datePublished":"2022-09-26T20:15:15Z","url":"https://github.com/python/mypy/issues/13744"}
| 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:85f1a9c3-efff-1fe1-b9f3-572c2b837ee4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DD54:3F7946:1928B67:21F3AD8:6AFFF914 |
| html-safe-nonce | 4b8390c83dfeeb58f4295edc11e2a310dd19e13c730944add0ed1d22bf58685f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERDU0OjNGNzk0NjoxOTI4QjY3OjIxRjNBRDg6NkFGRkY5MTQiLCJ2aXNpdG9yX2lkIjoiMTUwODIwMjI2MTk4NDA0OTQyOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4edcff26c55657c33df5b3ff7ca3c7dc8ccace36ff01c5e5fe5f36f69baafc81 |
| hovercard-subject-tag | issue:1386662076 |
| 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/13744/issue_layout |
| twitter:image | https://opengraph.githubassets.com/35d7d8b0d545c4f5a529b6044048f9ebe091089d96b556a3ffed9bb9e35532d5/python/mypy/issues/13744 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/35d7d8b0d545c4f5a529b6044048f9ebe091089d96b556a3ffed9bb9e35532d5/python/mypy/issues/13744 |
| og:image:alt | Bug Report Mypy seems to type narrow correctly, but still throws an error when trying to add to a set. To Reproduce Gist URL: https://gist.github.com/c10befca044d78713b96a9706ac355b2 Playground URL... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hwong557 |
| 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