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

Add if as sequence pattern list terminator #10996

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

dhruvmanila
Copy link
Member

Summary

This fixes a bug for code like:

match subject:
    case a, b if expr: ...

Previously, the : was the only terminator token so the list parsing wouldn't stop after b. The if token has been added to the terminator list to fix this.

Test Plan

Add test cases and verified the snapshots.

@dhruvmanila dhruvmanila added bug Something isn't working parser Related to the parser labels Apr 17, 2024
Copy link

codspeed-hq bot commented Apr 17, 2024

CodSpeed Performance Report

Merging #10996 will not alter performance

Comparing dhruv/match-seq-pattern (a0799ca) with dhruv/parser (c30057a)

Summary

✅ 30 untouched benchmarks

Base automatically changed from dhruv/remove-del-named-expr to dhruv/parser April 17, 2024 12:46
This fixes a bug for code like:

```python
match subject:
    case a, b if expr: ...
```

Previously, the `:` was the only terminator token so the list parsing
wouldn't stop after `b`. The `if` token has been added to the terminator
list to fix this.
@dhruvmanila dhruvmanila merged commit 7a2eca5 into dhruv/parser Apr 17, 2024
5 checks passed
@dhruvmanila dhruvmanila deleted the dhruv/match-seq-pattern branch April 17, 2024 12:47
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

dhruvmanila added a commit that referenced this pull request Apr 18, 2024
## Summary

This fixes a bug for code like:

```python
match subject:
    case a, b if expr: ...
```

Previously, the `:` was the only terminator token so the list parsing
wouldn't stop after `b`. The `if` token has been added to the terminator
list to fix this.

## Test Plan

Add test cases and verified the snapshots.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parser Related to the parser
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants