mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
[pyupgrade
] Comments within parenthesized value ranges should not affect applicability (UP040
) (#16027)
## Summary Follow-up to #16026. Previously, the fix for this would be marked as unsafe, even though all comments are preserved: ```python # .pyi T: TypeAlias = ( # Comment int | str ) ``` Now it is safe: comments within the parenthesized range no longer affect applicability. ## Test Plan `cargo nextest run` and `cargo insta test`. --------- Co-authored-by: Dylan <53534755+dylwil3@users.noreply.github.com>
This commit is contained in:
parent
19f3424a1a
commit
a29009e4ed
3 changed files with 67 additions and 22 deletions
|
@ -12,3 +12,13 @@ x: TypeAlias = tuple[
|
|||
int, # preserved
|
||||
float,
|
||||
]
|
||||
|
||||
T: TypeAlias = ( # comment0
|
||||
# comment1
|
||||
int # comment2
|
||||
# comment3
|
||||
| # comment4
|
||||
# comment5
|
||||
str # comment6
|
||||
# comment7
|
||||
) # comment8
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue