Skip to content

Add if as sequence pattern list terminator#10996

Merged
dhruvmanila merged 1 commit intodhruv/parserfrom
dhruv/match-seq-pattern
Apr 17, 2024
Merged

Add if as sequence pattern list terminator#10996
dhruvmanila merged 1 commit intodhruv/parserfrom
dhruv/match-seq-pattern

Conversation

@dhruvmanila
Copy link
Copy Markdown
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
@dhruvmanila dhruvmanila force-pushed the dhruv/remove-del-named-expr branch from d6c4c3a to d6b072d Compare April 17, 2024 11:57
@dhruvmanila dhruvmanila force-pushed the dhruv/match-seq-pattern branch from 07e850c to c836049 Compare April 17, 2024 11:59
@codspeed-hq
Copy link
Copy Markdown

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

@dhruvmanila dhruvmanila force-pushed the dhruv/remove-del-named-expr branch from d6b072d to 8020b40 Compare April 17, 2024 12:46
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 force-pushed the dhruv/match-seq-pattern branch from c836049 to a0799ca Compare April 17, 2024 12:47
@dhruvmanila dhruvmanila merged commit 7a2eca5 into dhruv/parser Apr 17, 2024
@dhruvmanila dhruvmanila deleted the dhruv/match-seq-pattern branch April 17, 2024 12:47
@github-actions
Copy link
Copy Markdown
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.

2 participants