-
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
Python: Add support for type parameter defaults #17688
Conversation
cdd7e2d
to
f2d2411
Compare
58a4698
to
8d41922
Compare
fe15ce6
to
ba03d92
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Also fixes an oversight in the grammar: starred expressions should be allowed inside the subscript of an `Index` expression.
Two new files -- alloc.h and array.h -- suddenly appeared. Presumably they are used by the somewhat newer version of tree-sitter. To be safe, I included them in this commit.
There was an errant `ql` in the relevant paths, a leftover from the move from the internal repo. Also, we can no longer rely on an intree version of the CodeQL CLI, so from now on we'll just assume it's present in the path. (On Codespaces, `gh codeql` is a decent replacement, especially if using the `install-stub` functionality.
Note that this still includes the somewhat puzzling parsing of `Spam[**P2]` as an exponentiation with an empty left hand side. When we fix that bug, we should also update this test to contain actually valid syntax.
Adds up- and downgrade scripts for the support for type parameter defaults. In the upgrade direction we do nothing, matching the behaviour of `getDefault` not having a result for old databases. In the downgrade direction, we explicitly remove the relevant child (via the `py_exprs` database relation) for `TypeVar`, `TypeVarTuple`, and `ParamSpec` parameters.
ba03d92
to
417e60a
Compare
Had to fix up the commit message for the upgrade scripts (as it was now misleading) and rebase so that I could update the extractor version, hence the need to re-review. Apart from that, there are no changes compared to what was reviewed previously. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Adds support for the new syntax for default values for type parameters, as documented in PEP-696.
Pull Request checklist
All query authors
.qhelp
. See the documentation in this repository.Internal query authors only
.ql
,.qll
, or.qhelp
files. See the documentation (internal access required).