Parenthesize breaking named expressions in match guards (#9396)

## Summary

This is an attempt to solve
https://github.com/astral-sh/ruff/issues/9394 by avoiding breaks in
named expressions when invalid.
This commit is contained in:
Charlie Marsh 2024-01-08 09:47:01 -05:00 committed by GitHub
parent b1a5df8694
commit ba71772d93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 2 deletions

View file

@ -115,6 +115,11 @@ match long_lines:
): # another comment
pass
case {
"long_long_long_key": str(long_long_long_key)
} if value := "long long long long long long long long long long long value":
pass
match pattern_comments:
case (
@ -696,6 +701,11 @@ match long_lines:
): # another comment
pass
case {
"long_long_long_key": str(long_long_long_key)
} if value := "long long long long long long long long long long long value":
pass
match pattern_comments:
case (