[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:
InSync 2025-02-08 03:44:33 +07:00 committed by GitHub
parent 19f3424a1a
commit a29009e4ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 67 additions and 22 deletions

View file

@ -12,3 +12,13 @@ x: TypeAlias = tuple[
int, # preserved
float,
]
T: TypeAlias = ( # comment0
# comment1
int # comment2
# comment3
| # comment4
# comment5
str # comment6
# comment7
) # comment8