ruff/crates/ruff_python_parser/resources/inline/ok
Brent Westbrook 42cbce538b
[syntax-errors] Fix star annotation before Python 3.11 (#16878)
Summary
--

Fixes #16874. I previously emitted a syntax error when starred
annotations were _allowed_ rather than when they were actually used.
This caused false positives for any starred parameter name because these
are allowed to have starred annotations but not required to. The fix is
to check if the annotation is actually starred after parsing it.

Test Plan
--

New inline parser tests derived from the initial report and more
examples from the comments, although I think the first case should cover
them all.
2025-03-20 17:44:52 -04:00
..
ambiguous_lpar_with_items_binary_expr.py
ambiguous_lpar_with_items_if_expr.py
ann_assign_stmt_simple_target.py
args_unparenthesized_generator.py
assign_targets_terminator.py
async_for_statement.py
async_function_definition.py
async_with_statement.py
class_def_arguments.py
class_type_params_py312.py [syntax-errors] Type parameter lists before Python 3.12 (#16479) 2025-03-05 13:19:09 +00:00
comma_separated_regular_list_terminator.py
decorator_async_function.py
decorator_await_expression_py39.py [syntax-errors] Improve error message and range for pre-PEP-614 decorator syntax errors (#16581) 2025-03-17 11:17:27 +00:00
decorator_expression_dotted_ident_py38.py [syntax-errors] Named expressions in decorators before Python 3.9 (#16386) 2025-03-05 17:08:18 +00:00
decorator_expression_eval_hack_py38.py [syntax-errors] Named expressions in decorators before Python 3.9 (#16386) 2025-03-05 17:08:18 +00:00
decorator_expression_identity_hack_py38.py [syntax-errors] Named expressions in decorators before Python 3.9 (#16386) 2025-03-05 17:08:18 +00:00
decorator_expression_py39.py [syntax-errors] Named expressions in decorators before Python 3.9 (#16386) 2025-03-05 17:08:18 +00:00
del_targets_terminator.py
dotted_name_normalized_spaces.py
except_star_py311.py [syntax-errors] except* before Python 3.11 (#16446) 2025-03-02 18:20:18 +00:00
except_stmt_as_name_soft_keyword.py
for_in_target_valid_expr.py
for_iter_unpack_py38.py [syntax-errors] Tuple unpacking in for statement iterator clause before Python 3.9 (#16558) 2025-03-13 15:55:17 -04:00
for_iter_unpack_py39.py [syntax-errors] Tuple unpacking in for statement iterator clause before Python 3.9 (#16558) 2025-03-13 15:55:17 -04:00
from_import_no_space.py
from_import_soft_keyword_module_name.py
from_import_stmt_terminator.py
fstring_format_spec_terminator.py
function_def_parameter_range.py
function_def_parenthesized_return_types.py
function_def_valid_return_expr.py
function_type_params_py312.py [syntax-errors] Type parameter lists before Python 3.12 (#16479) 2025-03-05 13:19:09 +00:00
global_stmt.py
import_as_name_soft_keyword.py
import_stmt_terminator.py
iter_unpack_return_py37.py [syntax-errors] Tuple unpacking in return and yield before Python 3.8 (#16485) 2025-03-06 11:57:20 -05:00
iter_unpack_return_py38.py [syntax-errors] Tuple unpacking in return and yield before Python 3.8 (#16485) 2025-03-06 11:57:20 -05:00
iter_unpack_yield_py37.py [syntax-errors] Tuple unpacking in return and yield before Python 3.8 (#16485) 2025-03-06 11:57:20 -05:00
iter_unpack_yield_py38.py [syntax-errors] Tuple unpacking in return and yield before Python 3.8 (#16485) 2025-03-06 11:57:20 -05:00
lambda_with_no_parameters.py
lambda_with_valid_body.py
match_after_py310.py
match_as_pattern.py
match_as_pattern_soft_keyword.py
match_attr_pattern_soft_keyword.py
match_classify_as_identifier_1.py
match_classify_as_identifier_2.py
match_classify_as_keyword_1.py
match_classify_as_keyword_2.py
match_classify_as_keyword_or_identifier.py
match_sequence_pattern_parentheses_terminator.py
match_sequence_pattern_terminator.py
match_stmt_subject_expr.py
match_stmt_valid_guard_expr.py
nonlocal_stmt.py
param_with_annotation.py
param_with_default.py
param_with_star_annotation.py
param_with_star_annotation_py310.py [syntax-errors] Fix star annotation before Python 3.11 (#16878) 2025-03-20 17:44:52 -04:00
param_with_star_annotation_py311.py [syntax-errors] Star annotations before Python 3.11 (#16545) 2025-03-14 15:20:44 +00:00
params_non_default_after_star.py
params_seen_keyword_only_param_after_star.py
parenthesized_context_manager_py39.py [syntax-errors] Parenthesized context managers before Python 3.9 (#16523) 2025-03-17 08:54:55 -04:00
parenthesized_kwarg_py37.py [syntax-errors] Parenthesized keyword argument names after Python 3.8 (#16482) 2025-03-06 12:18:13 -05:00
parenthesized_named_expr_index_py38.py [syntax-errors] Unparenthesized assignment expressions in sets and indexes (#16404) 2025-03-14 15:06:42 -04:00
parenthesized_named_expr_py38.py [syntax-errors] Unparenthesized assignment expressions in sets and indexes (#16404) 2025-03-14 15:06:42 -04:00
pep701_f_string_py311.py [syntax-errors] PEP 701 f-strings before Python 3.12 (#16543) 2025-03-18 11:12:15 -04:00
pep701_f_string_py312.py [syntax-errors] PEP 701 f-strings before Python 3.12 (#16543) 2025-03-18 11:12:15 -04:00
pos_only_py38.py [syntax-errors] Positional-only parameters before Python 3.8 (#16481) 2025-03-05 13:46:43 +00:00
simple_stmts_in_block.py
simple_stmts_with_semicolons.py
star_index_py311.py [syntax-errors] Star expression in index before Python 3.11 (#16544) 2025-03-14 14:51:34 +00:00
tuple_context_manager_py38.py [syntax-errors] Parenthesized context managers before Python 3.9 (#16523) 2025-03-17 08:54:55 -04:00
type_param_default_py313.py [syntax-errors] Type parameter defaults before Python 3.13 (#16447) 2025-03-04 16:53:38 +00:00
type_param_param_spec.py
type_param_type_var.py
type_param_type_var_tuple.py
type_stmt_py312.py [syntax-errors] type alias statements before Python 3.12 (#16478) 2025-03-04 17:20:10 +00:00
unparenthesized_named_expr_index_py39.py [syntax-errors] Unparenthesized assignment expressions in sets and indexes (#16404) 2025-03-14 15:06:42 -04:00
unparenthesized_named_expr_py39.py [syntax-errors] Unparenthesized assignment expressions in sets and indexes (#16404) 2025-03-14 15:06:42 -04:00
walrus_py38.py