-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Regression for type variables bound to literals #4457
Comments
This was an intentional change, not a regression. It was needed to fix another issue in the constraint solver. Mypy also doesn't accept the above code, so I thought it was unlikely that anyone was relying on the need to bind a type variable to a literal type. Can you explain the scenario where a type variable bound to a literal (or a union of literals) is useful? |
In my case it's used to represent the relationships between the arguments, e.g. you cannot specify a field in results = await Profile.prisma().group_by(
['country'],
order={
# city has to be included in the `by` argument to be valid
'city': 'asc',
}
) |
…expected type includes a TypeVar that is bound to a type that influences the type inference. This addresses #4457.
This will be addressed in the next release. |
Amazing, thank you so much! |
This is included in pyright 1.1.290, which I just published. It will also be included in a future release of pylance. |
Describe the bug
This snippet worked prior to
1.1.289
Pyright seems to infer the
by
andorder
arguments tolist[str]
anddict[str, str]
which is not correct.Expected behavior
The given snippet should pass type checks.
VS Code extension or command-line
Command-line
v1.1.289
The text was updated successfully, but these errors were encountered: