-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
Description
Bug Report
this is the sameish as #12962 however now that PEP 696 exists I expect this to work
To Reproduce
from typing import Literal
from dataclasses import dataclass
@dataclass
class D[TBool: (Literal[True], Literal[False]) = Literal[True]]:
val: TBool = True
reveal_type(D())
reveal_type(D(True))
reveal_type(D(False))Expected Behavior
I expect no errors however
Actual Behavior
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
Reactions are currently unavailable