mirror of https://github.com/astral-sh/ruff
## Summary
<!-- What's the purpose of the change? What does it do, and why? -->
This PR implements a new semantic syntax error where annotated name
can't be global
example
```
x: int = 1
def f():
global x
x: str = "foo" # SyntaxError: annotated name 'x' can't be global
```
## Test Plan
<!-- How was it tested? -->
I have written tests as directed in #17412
---------
Signed-off-by: 11happy <soni5happy@gmail.com>
Signed-off-by: 11happy <bhuminjaysoni@gmail.com>
Co-authored-by: Brent Westbrook <brentrwestbrook@gmail.com>
|
||
|---|---|---|
| .. | ||
| annotated_global.py | ||
| async_comprehension_outside_async_function.py | ||
| duplicate_match_class_attribute.py | ||
| duplicate_match_key.py | ||
| duplicate_type_parameter.py | ||
| global_parameter.py | ||
| invalid_expression.py | ||
| invalid_star_expression.py | ||
| irrefutable_case_pattern.py | ||
| multiple_case_assignment.py | ||
| rebound_comprehension.py | ||
| single_starred_assignment.py | ||
| write_to_debug.py | ||