Skip to content
New issue

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

MyPy doesn't report any errors when using TypeVars within TypeVar constraints #17136

Open
dadus33 opened this issue Apr 17, 2024 · 1 comment
Labels
bug mypy got something wrong topic-type-variables

Comments

@dadus33
Copy link

dadus33 commented Apr 17, 2024

Bug Report

According to this, using TypeVars to constraint other TypeVars is not possible. However, MyPy doesn't report any errors in such cases.

To Reproduce

https://mypy-play.net/?mypy=latest&python=3.11&gist=e4febb3ef7aeaa11ea0aaabd4a068739

Expected Behavior

Some error should be reported

Actual Behavior

No error is reported

Your Environment

  • Mypy version used: 1.9.0
  • Mypy command-line flags: N/A
  • Mypy configuration options from mypy.ini (and other config files): N/A
  • Python version used: 3.11
@dadus33 dadus33 added the bug mypy got something wrong label Apr 17, 2024
@erictraut
Copy link

FWIW, I just updated the typing spec conformance tests to validate this part of the spec. Previously, the tests were attempting to validate this, but they were written in a way that masked the false negative in mypy. The updated tests correctly identify this conformance failure, and this is reflected in the latest conformance results summary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-type-variables
Projects
None yet
Development

No branches or pull requests

3 participants