dataclasses: optional generic fields with non-None defaults #15887
Labels
bug
mypy got something wrong
topic-dataclasses
topic-type-context
Type context / bidirectional inference
To Reproduce
https://mypy-play.net/?mypy=latest&python=3.11&gist=bcf4de945268517a0cd8b6b9835e852f
Expected Behavior
This should produce no errors.
Actual Behavior
If I remove
| None
, mypy works as expected. However, AFAICT, outside of dataclasses such assignments are accepted.Your Environment
The text was updated successfully, but these errors were encountered: