Title: (馃悶) generics not resolving correctly when multiple `TypeVar`s don't meet the expected type 路 Issue #17553 路 python/mypy 路 GitHub
Open Graph Title: (馃悶) generics not resolving correctly when multiple `TypeVar`s don't meet the expected type 路 Issue #17553 路 python/mypy
X Title: (馃悶) generics not resolving correctly when multiple `TypeVar`s don't meet the expected type 路 Issue #17553 路 python/mypy
Description: from typing import TypeVar T1 = TypeVar("T1") T2 = TypeVar("T2") def f(t1: T1, t2: T2) -> T1 | T2: return t1 a: int = f(1, None) or 1 # error: Argument 2 to "f" has incompatible type "None"; expected "int" [arg-type] def f1(t1: T1, t2: T...
Open Graph Description: from typing import TypeVar T1 = TypeVar("T1") T2 = TypeVar("T2") def f(t1: T1, t2: T2) -> T1 | T2: return t1 a: int = f(1, None) or 1 # error: Argument 2 to "f" has incompatible type "None"; expect...
X Description: from typing import TypeVar T1 = TypeVar("T1") T2 = TypeVar("T2") def f(t1: T1, t2: T2) -> T1 | T2: return t1 a: int = f(1, None) or 1 # error: Argument 2 to "f" has...
Opengraph URL: https://github.com/python/mypy/issues/17553
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"(馃悶) generics not resolving correctly when multiple `TypeVar`s don't meet the expected type","articleBody":"```py\r\nfrom typing import TypeVar\r\n\r\nT1 = TypeVar(\"T1\")\r\nT2 = TypeVar(\"T2\")\r\n\r\n\r\ndef f(t1: T1, t2: T2) -\u003e T1 | T2:\r\n return t1\r\n\r\n\r\na: int = f(1, None) or 1 # error: Argument 2 to \"f\" has incompatible type \"None\"; expected \"int\" [arg-type]\r\n\r\ndef f1(t1: T1, t2: T1) -\u003e T1:\r\n return t1\r\n\r\nb: int = f1(1, None) or 1 # no error\r\n```","author":{"url":"https://github.com/KotlinIsland","@type":"Person","name":"KotlinIsland"},"datePublished":"2024-07-22T01:13:16.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/17553/mypy/issues/17553"}
| 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:56dd0da7-5414-cf8b-fff5-c8f80ee8c9c1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ABBC:1B5602:85907EC:B4D1776:6A5E678A |
| html-safe-nonce | 3baf1ff5133fc16912a8be475a1c1e33b5dba4f812f24fd508afd689f3a0f058 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQkJDOjFCNTYwMjo4NTkwN0VDOkI0RDE3NzY6NkE1RTY3OEEiLCJ2aXNpdG9yX2lkIjoiNzExMTYwOTE0Mjg5NTE4NDc0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4e30c97f7a6f6a444417f4661358ffef373690a5aed4b7a47df6a575fb574b75 |
| hovercard-subject-tag | issue:2421708091 |
| 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/17553/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fb598105a32f3d4d97bd8f8aacd3bd280e14b078bee17178f3575d1261f0a3a7/python/mypy/issues/17553 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fb598105a32f3d4d97bd8f8aacd3bd280e14b078bee17178f3575d1261f0a3a7/python/mypy/issues/17553 |
| og:image:alt | from typing import TypeVar T1 = TypeVar("T1") T2 = TypeVar("T2") def f(t1: T1, t2: T2) -> T1 | T2: return t1 a: int = f(1, None) or 1 # error: Argument 2 to "f" has incompatible type "None"; expect... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | KotlinIsland |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0e33eedeef87e76d6b013d348ad423a9e503a88efa7080eec1ed2ddba90606bd |
| 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 | 15c56e0437fea28b3adfecf1764d0b42db481e03 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width