Repository navigation
fix: parse splats in return expression lists - #354
Open
JarvisDing-sdu wants to merge 1 commit into
Open
JarvisDing-sdu wants to merge 1 commit into
JarvisDing-sdu wants to merge 1 commit into
Conversation
Contributor
|
I wonder if there is anything special about such expressions appearing in a return statement? x = 1, *([None] * 5)
print(x)Note: I'm not a maintainer here, and this grammar seems to be mostly unmaintained (as many other grammars in this organizations), but we are maintaining a fork tree-sitter-python-orchard, where I would integrate your contribution. |
Contributor
|
After reviewing the other PRs in this repo, I found #320 which seems to address the problem I mentioned above, so I'd recommend just using that PR instead. I have integrated it in our fork, so feel free to switch to that (if you can't for one reason or another, I'm interested to hear what is blocking you). |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix parsing of valid starred expressions in return expression lists.
Previously, return values such as
return 1, *[None]andreturn 1, *([None] * 5)produced anERRORnode instead of areturn_statement.Add a return-specific expression-list rule that accepts
list_splat, while preserving the public CST node nameexpression_listand leaving the general expression-list grammar unchanged.Add corpus coverage for simple, parenthesized/binary, and multiple starred return values.
Tests:
npx tree-sitter testnpm run lintnpm testgo test ./bindings/gopython -m pytest bindings/python/testsRust binding tests were not run because
cargois unavailable in the test environment.