-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Incorrect "TypeVar bound type cannot be generic" in class definition #3497
Labels
as designed
Not a bug, working as intended
Comments
The error is correct. Bound types cannot be generic. They must be concrete. There has been talk of supporting "higher-kinded types" (HKTs) within the Python type system, which would add support for this. But so far, these discussions have not led to any proposals among the type community. |
Okay, I was just confused because mypy does not report this as an error. |
19 tasks
gotmax23
added a commit
to gotmax23/fedrq-mirror
that referenced
this issue
Sep 20, 2024
See microsoft/pyright#3497. We cannot use a _QueryT TypeVar, as PackageQueryCompat itself is a generic.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Creating a type variable that uses another type variable in its bound type creates an error even if the bound type is not generic within the scope of the type variable.
Sidenote: Not sure if this is another bug but I have set
typeCheckingMode
to"off"
and I am still seeing this error.To Reproduce
I get an error saying "TypeVar bound type cannot be generic" when defining
T
even thoughAbstractUnitOfWork[R]
is not a generic type in this context.Expected behavior
No error.
VS Code extension or command-line
I am running Pyright within Neovim. The version is
1.1.248
The text was updated successfully, but these errors were encountered: