Bug Report
When defining a frozen data class with a covariant attribute using TypeVar syntax, mypy says I cannot use a covariant type variable as a parameter.
To Reproduce
https://gist.github.com/mypy-play/b0220af57a90126d77c4cdf83726e75d
Expected Behavior
mypy does not report any errors.
Actual Behavior
main.py:8: error: Cannot use a covariant type variable as a parameter [misc]
Found 1 error in 1 file (checked 1 source file)
Your Environment
- Mypy version used: 2.3.0
- Mypy command-line flags: none
- Mypy configuration options from
mypy.ini (and other config files): none
- Python version used: 3.13
Side Note
When using type parameter syntax, mypy infers frozen data class attributes as covariant since #21694:
https://gist.github.com/mypy-play/9fc4154d2c63f64c8a0ddbe85c2ac660
Bug Report
When defining a frozen data class with a covariant attribute using
TypeVarsyntax,mypysays I cannot use a covariant type variable as a parameter.To Reproduce
https://gist.github.com/mypy-play/b0220af57a90126d77c4cdf83726e75d
Expected Behavior
mypydoes not report any errors.Actual Behavior
Your Environment
mypy.ini(and other config files): noneSide Note
When using type parameter syntax,
mypyinfers frozen data class attributes as covariant since #21694:https://gist.github.com/mypy-play/9fc4154d2c63f64c8a0ddbe85c2ac660