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

Fix parsing list matchers without explicit brackets #1097

Merged
merged 1 commit into from
Feb 2, 2024
Merged

Fix parsing list matchers without explicit brackets #1097

merged 1 commit into from
Feb 2, 2024

Conversation

zsol
Copy link
Member

@zsol zsol commented Feb 2, 2024

Fix parsing list matchers without explicit brackets

match a:
  case 1, 2: pass

This is parsed correctly by the grammar, but the default values of MatchList.lbracket and MatchList.rbracket are inconsistent between Python and Rust, causing the above snippet to round-trip (from Python) to:

match a:
  case [1, 2]: pass

Fixes #1096.


Stack created with Sapling. Best reviewed with ReviewStack.

@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 Feb 2, 2024
```
match a:
  case 1, 2: pass
```

This is parsed correctly by the grammar, but the default values of `MatchList.lbracket` and `MatchList.rbracket` are inconsistent between Python and Rust, causing the above snippet to round-trip (from Python) to:
```
match a:
  case [1, 2]: pass
```

Fixes #1096.
@zsol zsol marked this pull request as ready for review February 2, 2024 19:55
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a2a60c1) 91.09% compared to head (ee806cd) 91.09%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1097   +/-   ##
=======================================
  Coverage   91.09%   91.09%           
=======================================
  Files         255      255           
  Lines       26561    26561           
=======================================
  Hits        24195    24195           
  Misses       2366     2366           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zsol zsol merged commit c854c98 into main Feb 2, 2024
39 of 42 checks passed
@zsol zsol deleted the pr1097 branch February 3, 2024 09:40
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.

Empty brackets around the case of a match-case are incorrectly parsed as a pair of square brackets
3 participants