We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug Report
mypy doesn't seem to like it when a type argument has a default value. I'm not sure how to explain this, so better see below.
To Reproduce
from typing import TypeVar T = TypeVar("T", bound="Foo") class Foo: pass class SubFoo(Foo): pass def factory(class_type: type[T]) -> T: return class_type() factory(Foo) factory(SubFoo) def alt_factory(class_type: type[T] = Foo) -> T: # ⚠️ Incompatible default for argument return class_type() alt_factory() alt_factory(Foo) alt_factory(SubFoo)
https://mypy-play.net/?mypy=1.8.0&python=3.12&gist=804d71b3f77280d09347b352f535def4
Expected Behavior
I'd expect it to report no issues.
Actual Behavior
Incompatible default for argument "class_type" (default has type "type[Foo]", argument has type "type[T]")
Your Environment
mypy 1.8.0 on Python 3.12
The text was updated successfully, but these errors were encountered:
Duplicate of #3737
Sorry, something went wrong.
No branches or pull requests
Bug Report
mypy doesn't seem to like it when a type argument has a default value. I'm not sure how to explain this, so better see below.
To Reproduce
https://mypy-play.net/?mypy=1.8.0&python=3.12&gist=804d71b3f77280d09347b352f535def4
Expected Behavior
I'd expect it to report no issues.
Actual Behavior
Your Environment
mypy 1.8.0 on Python 3.12
The text was updated successfully, but these errors were encountered: