You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
t3.py:6: error: Incompatible types in assignment (expression has type "Literal[True]", variable has type "TBool") [assignment]
t3.py:9: note: Revealed type is "t3.D[Literal[True]]"
t3.py:10: note: Revealed type is "t3.D[Literal[True]]"
t3.py:11: note: Revealed type is "t3.D[Literal[False]]"
Found 1 error in 1 file (checked 1 source file)
(the reveal types are all correct -- mostly just to demonstrate that the idea works)
Your Environment
Mypy version used: 1.15.0
Mypy command-line flags: n/a
Mypy configuration options from mypy.ini (and other config files): n/a
Python version used: 3.13.0
The text was updated successfully, but these errors were encountered:
This is very similar to #3737 but is even more complex (substituting in one signature vs checking the whole class for conformance). As of now, mypy does not support any variables/parameters with concrete defaults annotated with a TypeVar (maybe except for a few local narrowing cases, but those are irrelevant here). You can overcome this with __init__ overloads similar to the function example in #3737, but that would probably defeat the benefits of using a dataclass.
Bug Report
this is the sameish as #12962 however now that PEP 696 exists I expect this to work
To Reproduce
Expected Behavior
I expect no errors however
Actual Behavior
(the reveal types are all correct -- mostly just to demonstrate that the idea works)
Your Environment
mypy.ini
(and other config files): n/aThe text was updated successfully, but these errors were encountered: