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

Proxy both parentheses in some pattern matching nodes #626

Merged
merged 1 commit into from
Jan 25, 2022

Conversation

isidentical
Copy link
Contributor

Summary

This patch adds support for proxying the right parentheses to the underlying child node, so it would be consistent with the left one. Resolves #625.

Test Plan

Added a test about a case that was broken before.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 23, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jan 23, 2022

Codecov Report

Merging #626 (9110754) into main (2b2b25b) will decrease coverage by 0.00%.
The diff coverage is 75.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #626      +/-   ##
==========================================
- Coverage   94.78%   94.77%   -0.01%     
==========================================
  Files         245      245              
  Lines       25256    25268      +12     
==========================================
+ Hits        23940    23949       +9     
- Misses       1316     1319       +3     
Impacted Files Coverage Δ
libcst/_nodes/tests/test_match.py 100.00% <ø> (ø)
libcst/_nodes/statement.py 94.99% <75.00%> (-0.16%) ⬇️
libcst/_nodes/tests/test_atom.py 97.56% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2b2b25b...9110754. Read the comment docs.

@isidentical isidentical marked this pull request as draft January 23, 2022 17:11
@isidentical isidentical marked this pull request as ready for review January 23, 2022 19:56
@stroxler
Copy link
Contributor

@zsol I've been accepting all the patches coming in that fix cut-and-dry syntax bugs.

Proxying is more of a LibCST internal thing so I'll leave this for you to review, unless you'd rather I do it.

Copy link
Member

@zsol zsol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

Comment on lines +2896 to +2899
@rpar.setter
def rpar(self, value: Sequence[RightParen]) -> None:
# pyre-fixme[41]: Cannot reassign final attribute `rpar`.
self.value.rpar = value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, in retrospect I think we don't need these setters, these dataclasses are frozen. I'll follow up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CST node validation is broken for parenthesized MatchAs objects
5 participants