René's URL Explorer Experiment


Title: mypy incorrectly complains about incompatible type error · Issue #18267 · python/mypy · GitHub

Open Graph Title: mypy incorrectly complains about incompatible type error · Issue #18267 · python/mypy

X Title: mypy incorrectly complains about incompatible type error · Issue #18267 · python/mypy

Description: Bug Report mypy is incorrectly complaining that the arguments to a function have an incompatible type, when used in the context of a class attribute. In the example below, we are creating a library of fields (StringField, IntegerField, e...

Open Graph Description: Bug Report mypy is incorrectly complaining that the arguments to a function have an incompatible type, when used in the context of a class attribute. In the example below, we are creating a library...

X Description: Bug Report mypy is incorrectly complaining that the arguments to a function have an incompatible type, when used in the context of a class attribute. In the example below, we are creating a library...

Opengraph URL: https://github.com/python/mypy/issues/18267

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"mypy incorrectly complains about incompatible type error","articleBody":"**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 is incorrectly complaining that the arguments to a function have an incompatible type, when used in the context of a class attribute.\r\n\r\nIn the example below, we are creating a library of fields (`StringField`, `IntegerField`, etc.), to be used in a runtime schema validation library. In addition, we create a `OneOfField` that takes a list of sub-fields via the `with_` function. Creating a `OneOfField` works fine by itself, but when assigned to a class attribute, mypy incorrectly complains about a type error. \r\n\r\n```python\r\nfrom typing import Generic, TypeVar, Union, assert_type, cast, overload, Self\r\n\r\nInputType = TypeVar(\"InputType\")\r\nOutputType = TypeVar(\"OutputType\")\r\n\r\n\r\nclass Field(Generic[InputType, OutputType]):\r\n    # We want both InputType and OutputType to be used in functions like the\r\n    # ones below, so they can't be marked covariant or contravariant.\r\n    def validate(self, input: Any) -> InputType:\r\n        return cast(InputType, input)\r\n    \r\n    def render(self, input: InputType) -> OutputType:\r\n        return cast(OutputType, input)\r\n    \r\n    def serialize(self, output: OutputType) -> str:\r\n        return \"\"\r\n\r\n\r\nclass StringField(Field[str, str]):\r\n    pass\r\n\r\n\r\nclass IntegerField(Field[int, int]):\r\n    pass\r\n\r\n\r\nclass BooleanField(Field[bool, bool]):\r\n    pass\r\n\r\n\r\ndef input_type(field: Field[InputType, OutputType]) -> InputType:\r\n    return cast(InputType, field)\r\n\r\n\r\nOneOfInputType = TypeVar(\"OneOfInputType\")\r\nOneOfOutputType = TypeVar(\"OneOfOutputType\")\r\n\r\nAInputType = TypeVar(\"AInputType\")\r\nAOutputType = TypeVar(\"AOutputType\")\r\n\r\nBInputType = TypeVar(\"BInputType\")\r\nBOutputType = TypeVar(\"BOutputType\")\r\n\r\nCInputType = TypeVar(\"CInputType\")\r\nCOutputType = TypeVar(\"COutputType\")\r\n\r\n\r\nclass OneOfField(\r\n    Generic[OneOfInputType, OneOfOutputType],\r\n    Field[OneOfInputType, OneOfOutputType],\r\n):\r\n    fields: list[Field]\r\n\r\n    def __init__(self) -> None:\r\n        super().__init__()\r\n        self.fields = []\r\n\r\n    @overload\r\n    def with_(\r\n        self,\r\n        a: Field[AInputType, AOutputType],\r\n        b: Field[BInputType, BOutputType],\r\n    ) -> \"OneOfField[Union[AInputType, BInputType], Union[AOutputType, BOutputType]]\": ...\r\n\r\n    @overload\r\n    def with_(\r\n        self,\r\n        a: Field[AInputType, AOutputType],\r\n        b: Field[BInputType, BOutputType],\r\n        c: Field[CInputType, COutputType],\r\n    ) -> \"OneOfField[Union[AInputType, BInputType, CInputType], Union[AOutputType, BOutputType, COutputType]]\": ...\r\n\r\n    def with_(\r\n        self,\r\n        a: Field[AInputType, AOutputType],\r\n        b: Field[BInputType, BOutputType],\r\n        c: Field[CInputType, COutputType] | None = None,\r\n    ) -> \"OneOfField\":\r\n        if c is None:\r\n            self.fields = [a, b]\r\n        else:\r\n            self.fields = [a, b, c]\r\n        return self\r\n\r\n    def return_self(self) -> Self:\r\n        return self\r\n\r\n# This works:\r\nfield = OneOfField().with_(StringField(), IntegerField())\r\nassert_type(field, OneOfField[Union[str, int], Union[str, int]])\r\nassert_type(input_type(field), Union[str, int])\r\n\r\n\r\n# This doesn't work:\r\nclass MyModel:\r\n    # error: Argument 1 to \"with_\" of \"OneOfField\" has incompatible type \"StringField\"; expected \"Field[str | int, str | int]\"  [arg-type]\r\n    # error: Argument 2 to \"with_\" of \"OneOfField\" has incompatible type \"IntegerField\"; expected \"Field[str | int, str | int]\"  [arg-type]\r\n    foo: str | int = input_type(OneOfField().with_(StringField(), IntegerField()))\r\n    \r\n# This works?\r\nclass MyModel2:\r\n    foo: str | int = input_type(OneOfField().with_(StringField(), IntegerField()).return_self())\r\n\r\n```\r\n\r\n**To Reproduce**\r\n\r\nhttps://gist.github.com/mypy-play/4619ce6d001d7c7c6994d2b6c912424a\r\n\r\nThis does not repro in Pyright: [link](https://pyright-play.net/?code=GYJw9gtgBALgngBwJYDsDmUkQWEMoDiApikSEgMYA0UAKokQGoCGINAqikmCjcwM78yMAPrwERGhQEwaYAG5kANmGYATGgGUiS4ACg9ASRQIArjHoSoAXjoMWIABQAiY2YsNnASj0B5c%2B6WRDZ2Eg4u-jCBnj4GFEoC-FAAYkg6ao7EpOQUANpu5kE0kdESALpeAFx6ULVQAMRQAOrBAO7MKPgARmAwABZQBR5WHWpQJYUMsGBQXcGmQmOoUMCmKBQw3ChJSkgA1sH9RDV1jTxESXMqrTT8M0dwUNIoAOTdwRCsB2MUCqxIHXwuCePBgIGY8n%2BgIAdCdamoiMAoJDdmpmDAiI4hLoaKh3JUoABBFBwLxQAC0AD5BiZJhJqnVGVAQEQYKYQCgnjJHEMiphaTAfIy4VAEUiWSgEU5scBcQKCbyGGSqeMAnSiAymbUWWyOVz%2BDBHBNhpJ%2Be4hXURWKoEJyMxdgAvTEyuRqmAE41BZXUg0gTVanXsznOZwGPTxRJQTRg1BoVLpRzxpRqXK%2B25gir%2BqAIRJhiOCGkYtBkJMZUu5VCyfkwTMinOCPMJAsAITAYCURA6pcTaWTuR67ZoA6UtcZ9f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WCKBnQIG8JrDAxWK8EEMCQSsNsBJQHs0rCEOumdMSkOTGHfeUcYyxxTgnToTDk4JlTsFKAehO7ezSn7fgAB%2BcMvEoATynjPHBWZgCSJtDwmRnQ5ECgUUafmejw4YzUTHOMmjCw6JYSnXyltrapz0EAA)\r\n\r\n**Expected Behavior**\r\n\r\nNo errors.\r\n\r\n**Actual Behavior**\r\n\r\nmypy raises an invalid error saying the argument to `with_` is invalid.\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: 1.13.0\r\n- Mypy command-line flags: N/A\r\n- Mypy configuration options from `mypy.ini` (and other config files): N/A\r\n- Python version used: 3.13\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/athyuttamre","@type":"Person","name":"athyuttamre"},"datePublished":"2024-12-08T04:53:04Z","url":"https://github.com/python/mypy/issues/18267"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:b4946dc0-e209-18f2-376d-a7e4fb547e3d
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idEB60:3204C8:2940931:35FF856:6B000A7A
html-safe-nonce4c849f2dd509c77cc53be6e9c9235cf7693b7d2e75897f62343c6927e71d850a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQjYwOjMyMDRDODoyOTQwOTMxOjM1RkY4NTY6NkIwMDBBN0EiLCJ2aXNpdG9yX2lkIjoiMTA3NDE3MTY1MzIzNzI0NjU4NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac62b4d769a6f74a36fca979723b8e09fed4fd1b5db19916cfae7031d74206c212
hovercard-subject-tagissue:2724953723
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/mypy/18267/issue_layout
twitter:imagehttps://opengraph.githubassets.com/9cb4e331238c5d697ac36cb987ae336134c85fe264b7ba1b19bf40267c3c3a57/python/mypy/issues/18267
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/9cb4e331238c5d697ac36cb987ae336134c85fe264b7ba1b19bf40267c3c3a57/python/mypy/issues/18267
og:image:altBug Report mypy is incorrectly complaining that the arguments to a function have an incompatible type, when used in the context of a class attribute. In the example below, we are creating a library...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameathyuttamre
hostnamegithub.com
expected-hostnamegithub.com
None0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729
turbo-cache-controlno-preview
go-importgithub.com/python/mypy git https://github.com/python/mypy.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id7053637
octolytics-dimension-repository_nwopython/mypy
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id7053637
octolytics-dimension-repository_network_root_nwopython/mypy
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release16a11879678aaf97e2a42c33ee70830aa084fa37
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/mypy/issues/18267#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fissues%2F18267
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fissues%2F18267
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fmypy
Reloadhttps://github.com/python/mypy/issues/18267
Reloadhttps://github.com/python/mypy/issues/18267
Reloadhttps://github.com/python/mypy/issues/18267
pythonhttps://github.com/python
mypyhttps://github.com/python/mypy
Codehttps://github.com/python/mypy
Issues2.7k (2.7k)https://github.com/python/mypy/issues
Pull requests547 (547)https://github.com/python/mypy/pulls
Actionshttps://github.com/python/mypy/actions
Projectshttps://github.com/python/mypy/projects
Wikihttps://github.com/python/mypy/wiki
Security and qualityhttps://github.com/python/mypy/security
Insightshttps://github.com/python/mypy/insights
https://github.com/python/mypy
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/18267
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/18267
#22286https://github.com/python/mypy/pull/22286
mypy incorrectly complains about incompatible type errorhttps://github.com/python/mypy/issues/18267#top
#22286https://github.com/python/mypy/pull/22286
bugmypy got something wronghttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22bug%22
topic-type-contextType context / bidirectional inferencehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-type-context%22
https://github.com/athyuttamre
athyuttamrehttps://github.com/athyuttamre
on Dec 8, 2024https://github.com/python/mypy/issues/18267#issue-2724953723
https://gist.github.com/mypy-play/4619ce6d001d7c7c6994d2b6c912424ahttps://gist.github.com/mypy-play/4619ce6d001d7c7c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qWUZTOAS0ILWZdTxYoIAqOoKVIul-RZTVLrZXUhUpMVpXquVGl5flXR1X2jVnc1F0HbUFA3SmTFNaxsntbUnXKT1XBjadJqTQN71VRwAMoONsmTRNUCfa1m6zfNi2bWlGW7fl%2B01Ud5ZA3yFXTZdWrXcd9V3cDD1fcTTIvWTfZg5TCPTVAAA%2BLnnCErmkDTv3dYuc1PZgSIUJgSTc3uNU5boYWLpFUC5MwQ6mTVOhCO5WMObL6Ty4rQ5SCr%2BUHpyMpLfCqXGyIMr2boTnaLoGvaqyQY2g5BiNLQfRIEkrS4Hs%2Bl6OFIR-YuQXQttmWONG5DoN2Xg0MYRYlqHXg%2BIkwizhI86LtJAn-X1abVsNo1Q4XlYzWnggZ%2BImLTqINfZxeEMF2Cco1peHte0kahgBcrz4L7IB7NU%2BZJAAsnAY9gAiShZo0ZDgH6RIgGgpgQCQ%2BAAIzTFAzgRyIzhQGASJdXnAtQH0Aj8r82DokgXQdrAUzONHsals4ADcUBEAAHhIGxEDGM4csvo2bVnTCAMB5dD4K1YGgckNdDa1HniAReBJCQrzXhvKAAAmHee8MaH2PrvEO6RD6XySKgG%2BOZNgP0OM-RORBiwgHfl-X%2B-8MRAJAWCKBnQIG8JrDAxWK8EEMCQSsNsBJQHs0rCEOumdMSkOTGHfeUcYyxxTgnToTDk4JlTsFKAehO7ezSn7fgAB%2BcMvEoATynjPHBWZgCSJtDwmRnQ5ECgUUafmejw4YzUTHOMmjCw6JYSnXyltrapz0EAA
athyuttamrehttps://github.com/athyuttamre
bugmypy got something wronghttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22bug%22
on Dec 8, 2024https://github.com/python/mypy/issues/18267#event-15571265377
brianschuberthttps://github.com/brianschubert
topic-type-contextType context / bidirectional inferencehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-type-context%22
on Dec 8, 2024https://github.com/python/mypy/issues/18267#event-15572769415
https://github.com/sterliakov
sterliakovhttps://github.com/sterliakov
on Dec 8, 2024https://github.com/python/mypy/issues/18267#issuecomment-2526364126
playgroundhttps://mypy-play.net/?mypy=master&python=3.12&flags=strict&gist=a855d1d6c45862687ef3c5c9113fdd4e
https://github.com/athyuttamre
athyuttamrehttps://github.com/athyuttamre
on Dec 8, 2024https://github.com/python/mypy/issues/18267#issuecomment-2526364651
ilevkivskyihttps://github.com/ilevkivskyi
completedhttps://github.com/python/mypy/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#22286https://github.com/python/mypy/pull/22286
on Nov 4, 2026https://github.com/python/mypy/issues/18267#event-35119033410
ilevkivskyihttps://github.com/ilevkivskyi
on Nov 4, 2026https://github.com/python/mypy/issues/18267#event-35120080906
Use both sides of type context for generic type inference (part 1) (p…https://github.com/ilevkivskyi/mypy/commit/902ebb2a29df611e642e28b39bd8cbeb4eb1c876
p…https://github.com/python/mypy/pull/22286
902ebb2https://github.com/ilevkivskyi/mypy/commit/902ebb2a29df611e642e28b39bd8cbeb4eb1c876
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/mypy/issues/18267
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/mypy/issues/18267
bugmypy got something wronghttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22bug%22
topic-type-contextType context / bidirectional inferencehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-type-context%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.