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

Function call with walrus loses colon in roundtrip #416

Closed
thatch opened this issue Nov 11, 2020 · 0 comments · Fixed by #417
Closed

Function call with walrus loses colon in roundtrip #416

thatch opened this issue Nov 11, 2020 · 0 comments · Fixed by #417

Comments

@thatch
Copy link
Contributor

thatch commented Nov 11, 2020

This input

f(x:=1)

is roundtripped as

f(x=1)

due to a parse error.

I'm fairly certain the problem is the grammar on https://github.com/Instagram/LibCST/blob/master/libcst/_parser/conversions/expression.py#L1430 not matching namedexpr_test nor doing anything but AssignEqual in the else case. I tried to alter the grammar there to use namedexpr_test, but that caused ambiguity.

Going the other route to fix, we'll need another case to fix because this is the first positional arg, not a kwarg.

thatch added a commit to thatch/LibCST that referenced this issue Nov 11, 2020
Previous behavior treated it as identical to equal, making a kwarg; it should
instead be a positional arg.  Includes several tests to make sure that
whitespace handling is correct.

Fixes Instagram#416
thatch added a commit to thatch/LibCST that referenced this issue Nov 11, 2020
Previous behavior treated it as identical to equal, making a kwarg; it should
instead be a positional arg.  Includes several tests to make sure that
whitespace handling is correct.

Fixes Instagram#416
thatch added a commit to thatch/LibCST that referenced this issue Nov 13, 2020
Previous behavior treated it as identical to equal, making a kwarg; it should
instead be a positional arg.  Includes several tests to make sure that
whitespace handling is correct.

Fixes Instagram#416
jimmylai pushed a commit that referenced this issue Nov 13, 2020
Previous behavior treated it as identical to equal, making a kwarg; it should
instead be a positional arg.  Includes several tests to make sure that
whitespace handling is correct.

Fixes #416
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant