From 31c6c03ee69f0f99de15e4c07179e664f2cc46d2 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Sat, 29 Jun 2024 11:16:39 +0200 Subject: [PATCH] Use `smol_str` for Identifier --- Cargo.lock | 5 + crates/red_knot_python_semantic/src/lib.rs | 1 - crates/red_knot_python_semantic/src/name.rs | 56 -- .../src/semantic_index/builder.rs | 2 +- .../src/semantic_index/symbol.rs | 7 +- crates/red_knot_python_semantic/src/types.rs | 11 +- .../src/types/infer.rs | 13 +- crates/ruff_linter/src/fix/edits.rs | 2 +- crates/ruff_linter/src/importer/mod.rs | 10 +- .../rules/airflow/rules/task_variable_name.rs | 2 +- .../src/rules/flake8_annotations/helpers.rs | 7 +- .../src/rules/flake8_gettext/mod.rs | 3 +- .../src/rules/flake8_gettext/settings.rs | 11 +- .../rules/unnecessary_type_union.rs | 9 +- .../ruff_linter/src/rules/flake8_self/mod.rs | 8 +- .../rules/private_member_access.rs | 7 +- .../src/rules/flake8_self/settings.rs | 5 +- .../ruff_linter/src/rules/pyflakes/format.rs | 10 +- .../src/rules/pyflakes/rules/strings.rs | 22 +- .../pylint/rules/modified_iterating_set.rs | 3 +- .../rules/pylint/rules/no_method_decorator.rs | 5 +- .../pylint/rules/redeclared_assigned_name.rs | 7 +- .../pyupgrade/rules/use_pep695_type_alias.rs | 11 +- .../ruff_linter/src/rules/refurb/helpers.rs | 19 +- .../rules/refurb/rules/delete_full_slice.rs | 2 +- .../refurb/rules/isinstance_type_none.rs | 2 +- .../refurb/rules/reimplemented_starmap.rs | 26 +- .../src/rules/refurb/rules/slice_copy.rs | 5 +- .../refurb/rules/type_none_comparison.rs | 9 +- .../refurb/rules/unnecessary_enumerate.rs | 11 +- .../src/rules/ruff/rules/implicit_optional.rs | 3 +- .../ruff/rules/mutable_fromkeys_value.rs | 3 +- crates/ruff_python_ast/Cargo.toml | 6 +- crates/ruff_python_ast/src/helpers.rs | 8 +- crates/ruff_python_ast/src/name.rs | 158 ++- crates/ruff_python_ast/src/nodes.rs | 24 +- crates/ruff_python_literal/Cargo.toml | 1 + crates/ruff_python_parser/src/lexer.rs | 5 +- .../src/parser/expression.rs | 18 +- .../ruff_python_parser/src/parser/pattern.rs | 7 +- .../ruff_python_parser/src/parser/recovery.rs | 7 +- ...parser__tests__expr_mode_valid_syntax.snap | 6 +- ...arser__tests__ipython_escape_commands.snap | 50 +- ...arser__parser__tests__unicode_aliases.snap | 6 +- .../src/parser/statement.rs | 5 +- ...thon_parser__lexer__tests__assignment.snap | 4 +- ...ruff_python_parser__lexer__tests__bom.snap | 4 +- ...parser__lexer__tests__bom_with_offset.snap | 8 +- ...r__lexer__tests__bom_with_offset_edge.snap | 4 +- ...lexer__tests__dedent_after_whitespace.snap | 12 +- ...er__tests__double_dedent_with_mac_eol.snap | 8 +- ...ests__double_dedent_with_tabs_mac_eol.snap | 8 +- ...sts__double_dedent_with_tabs_unix_eol.snap | 8 +- ...__double_dedent_with_tabs_windows_eol.snap | 8 +- ...r__tests__double_dedent_with_unix_eol.snap | 8 +- ...tests__double_dedent_with_windows_eol.snap | 8 +- ..._python_parser__lexer__tests__fstring.snap | 12 +- ...arser__lexer__tests__fstring_comments.snap | 4 +- ...ser__lexer__tests__fstring_conversion.snap | 20 +- ..._parser__lexer__tests__fstring_escape.snap | 8 +- ...__lexer__tests__fstring_escape_braces.snap | 8 +- ...ser__lexer__tests__fstring_escape_raw.snap | 8 +- ...__tests__fstring_expression_multiline.snap | 8 +- ...rser__lexer__tests__fstring_multiline.snap | 4 +- ...xer__tests__fstring_named_unicode_raw.snap | 4 +- ..._parser__lexer__tests__fstring_nested.snap | 8 +- ...exer__tests__fstring_with_format_spec.snap | 28 +- ...ests__fstring_with_ipy_escape_command.snap | 4 +- ...tests__fstring_with_lambda_expression.snap | 16 +- ...s__fstring_with_multiline_format_spec.snap | 20 +- ..._tests__fstring_with_named_expression.snap | 20 +- ...exer__tests__indentation_with_mac_eol.snap | 4 +- ...xer__tests__indentation_with_unix_eol.snap | 4 +- ...__tests__indentation_with_windows_eol.snap | 4 +- ...ts__ipython_escape_command_assignment.snap | 16 +- ..._tests__match_softkeyword_in_notebook.snap | 8 +- ...r__tests__newline_in_brackets_mac_eol.snap | 4 +- ...__tests__newline_in_brackets_unix_eol.snap | 4 +- ...ests__newline_in_brackets_windows_eol.snap | 4 +- ...ests__dont_panic_on_8_in_octal_escape.snap | 6 +- ...string__tests__fstring_constant_range.snap | 10 +- ...ing__tests__fstring_escaped_character.snap | 6 +- ...tring__tests__fstring_escaped_newline.snap | 6 +- ...ing__tests__fstring_line_continuation.snap | 6 +- ...__fstring_parse_self_documenting_base.snap | 6 +- ...ring_parse_self_documenting_base_more.snap | 10 +- ...fstring_parse_self_documenting_format.snap | 6 +- ...ing__tests__fstring_unescaped_newline.snap | 6 +- ..._parser__string__tests__parse_fstring.snap | 10 +- ...ring_nested_concatenation_string_spec.snap | 6 +- ...ing__tests__parse_fstring_nested_spec.snap | 10 +- ...sts__parse_fstring_nested_string_spec.snap | 6 +- ..._tests__parse_fstring_not_nested_spec.snap | 6 +- ...ts__parse_fstring_self_doc_prec_space.snap | 6 +- ...parse_fstring_self_doc_trailing_space.snap | 6 +- ...on_parser__string__tests__raw_fstring.snap | 6 +- ...ing__tests__triple_quoted_raw_fstring.snap | 6 +- crates/ruff_python_parser/src/token.rs | 3 +- ...ann_assign_stmt_invalid_annotation.py.snap | 36 +- ...tax@ann_assign_stmt_invalid_target.py.snap | 72 +- ...ntax@ann_assign_stmt_invalid_value.py.snap | 56 +- ...syntax@ann_assign_stmt_missing_rhs.py.snap | 8 +- ..._assign_stmt_type_alias_annotation.py.snap | 28 +- .../invalid_syntax@assert_empty_msg.py.snap | 4 +- .../invalid_syntax@assert_empty_test.py.snap | 4 +- ...lid_syntax@assert_invalid_msg_expr.py.snap | 16 +- ...id_syntax@assert_invalid_test_expr.py.snap | 20 +- ..._syntax@assign_stmt_invalid_target.py.snap | 16 +- ...tax@assign_stmt_invalid_value_expr.py.snap | 48 +- ..._syntax@assign_stmt_keyword_target.py.snap | 44 +- ...lid_syntax@assign_stmt_missing_rhs.py.snap | 32 +- ...alid_syntax@async_unexpected_token.py.snap | 20 +- ...tax@aug_assign_stmt_invalid_target.py.snap | 20 +- ...ntax@aug_assign_stmt_invalid_value.py.snap | 48 +- ...syntax@aug_assign_stmt_missing_rhs.py.snap | 16 +- ..._syntax@case_expect_indented_block.py.snap | 4 +- ...nvalid_syntax@class_def_empty_body.py.snap | 12 +- ...alid_syntax@class_def_missing_name.py.snap | 20 +- ...class_def_unclosed_type_param_list.py.snap | 24 +- ...ntax@comma_separated_missing_comma.py.snap | 8 +- ...ma_separated_missing_first_element.py.snap | 4 +- ...prehension_missing_for_after_async.py.snap | 16 +- ...yntax@decorator_invalid_expression.py.snap | 24 +- ...yntax@decorator_missing_expression.py.snap | 24 +- ...d_syntax@decorator_missing_newline.py.snap | 24 +- ..._syntax@decorator_unexpected_token.py.snap | 8 +- ...valid_syntax@del_incomplete_target.py.snap | 32 +- ...d_syntax@dotted_name_multiple_dots.py.snap | 12 +- ...tax@except_stmt_invalid_expression.py.snap | 8 +- ...syntax@except_stmt_missing_as_name.py.snap | 8 +- ...ntax@except_stmt_missing_exception.py.snap | 8 +- ...@except_stmt_unparenthesized_tuple.py.snap | 40 +- ...essions__arguments__double_starred.py.snap | 32 +- ...ments__duplicate_keyword_arguments.py.snap | 24 +- ...ons__arguments__invalid_expression.py.snap | 32 +- ...uments__invalid_keyword_expression.py.snap | 48 +- ...ressions__arguments__invalid_order.py.snap | 64 +- ...sions__arguments__missing_argument.py.snap | 12 +- ...ressions__arguments__missing_comma.py.snap | 12 +- ...ons__arguments__missing_expression.py.snap | 32 +- ...ax@expressions__arguments__starred.py.snap | 32 +- ...expressions__arguments__unclosed_0.py.snap | 8 +- ...expressions__arguments__unclosed_1.py.snap | 12 +- ...expressions__arguments__unclosed_2.py.snap | 12 +- ...essions__attribute__invalid_member.py.snap | 16 +- ...ressions__attribute__multiple_dots.py.snap | 32 +- ...@expressions__attribute__no_member.py.snap | 20 +- ...xpressions__await__no_expression_0.py.snap | 12 +- ...xpressions__await__no_expression_1.py.snap | 8 +- ...syntax@expressions__await__recover.py.snap | 40 +- ...ns__bin_op__invalid_rhs_expression.py.snap | 20 +- ...x@expressions__bin_op__missing_lhs.py.snap | 4 +- ...expressions__bin_op__missing_rhs_0.py.snap | 4 +- ...expressions__bin_op__missing_rhs_1.py.snap | 4 +- ...@expressions__bin_op__multiple_ops.py.snap | 16 +- ...ressions__bin_op__named_expression.py.snap | 16 +- ...ssions__bin_op__starred_expression.py.snap | 16 +- ...s__bool_op__invalid_rhs_expression.py.snap | 20 +- ...@expressions__bool_op__missing_lhs.py.snap | 4 +- ...@expressions__bool_op__missing_rhs.py.snap | 8 +- ...essions__bool_op__named_expression.py.snap | 24 +- ...sions__bool_op__starred_expression.py.snap | 16 +- ...xpressions__compare__invalid_order.py.snap | 32 +- ...s__compare__invalid_rhs_expression.py.snap | 20 +- ...@expressions__compare__missing_lhs.py.snap | 4 +- ...xpressions__compare__missing_rhs_0.py.snap | 8 +- ...xpressions__compare__missing_rhs_1.py.snap | 8 +- ...xpressions__compare__missing_rhs_2.py.snap | 8 +- ...ressions__compare__multiple_equals.py.snap | 24 +- ...essions__compare__named_expression.py.snap | 16 +- ...sions__compare__starred_expression.py.snap | 32 +- ...x@expressions__dict__comprehension.py.snap | 212 +++- ...tax@expressions__dict__double_star.py.snap | 92 +- ...s__dict__double_star_comprehension.py.snap | 32 +- ...ons__dict__missing_closing_brace_0.py.snap | 16 +- ...ons__dict__missing_closing_brace_1.py.snap | 4 +- ...ons__dict__missing_closing_brace_2.py.snap | 8 +- ...ressions__dict__named_expression_0.py.snap | 28 +- ...ressions__dict__named_expression_1.py.snap | 32 +- ..._syntax@expressions__dict__recover.py.snap | 72 +- ...tax@expressions__emoji_identifiers.py.snap | 20 +- ...essions__if__missing_orelse_expr_0.py.snap | 16 +- ...essions__if__missing_orelse_expr_1.py.snap | 12 +- ...pressions__if__missing_test_expr_0.py.snap | 16 +- ...pressions__if__missing_test_expr_1.py.snap | 12 +- ...id_syntax@expressions__if__recover.py.snap | 88 +- ...essions__lambda_default_parameters.py.snap | 12 +- ...sions__lambda_duplicate_parameters.py.snap | 40 +- ...x@expressions__list__comprehension.py.snap | 176 +++- ...s__list__missing_closing_bracket_0.py.snap | 4 +- ...s__list__missing_closing_bracket_1.py.snap | 8 +- ...s__list__missing_closing_bracket_2.py.snap | 8 +- ...s__list__missing_closing_bracket_3.py.snap | 4 +- ..._syntax@expressions__list__recover.py.snap | 16 +- ...__list__star_expression_precedence.py.snap | 84 +- ...expressions__named__invalid_target.py.snap | 28 +- ...sions__named__missing_expression_0.py.snap | 4 +- ...sions__named__missing_expression_1.py.snap | 8 +- ...sions__named__missing_expression_2.py.snap | 16 +- ...sions__named__missing_expression_3.py.snap | 12 +- ...sions__named__missing_expression_4.py.snap | 16 +- ...ressions__parenthesized__generator.py.snap | 24 +- ...nthesized__missing_closing_paren_0.py.snap | 4 +- ...nthesized__missing_closing_paren_1.py.snap | 8 +- ...nthesized__missing_closing_paren_2.py.snap | 8 +- ...nthesized__missing_closing_paren_3.py.snap | 4 +- ...ions__parenthesized__parenthesized.py.snap | 8 +- ...@expressions__parenthesized__tuple.py.snap | 24 +- ..._parenthesized__tuple_starred_expr.py.snap | 248 +++-- ...ax@expressions__set__comprehension.py.snap | 176 +++- ...set__missing_closing_curly_brace_0.py.snap | 4 +- ...set__missing_closing_curly_brace_1.py.snap | 8 +- ...set__missing_closing_curly_brace_2.py.snap | 8 +- ...set__missing_closing_curly_brace_3.py.snap | 4 +- ...d_syntax@expressions__set__recover.py.snap | 16 +- ...s__set__star_expression_precedence.py.snap | 84 +- ...__subscript__invalid_slice_element.py.snap | 48 +- ...sions__subscript__unclosed_slice_0.py.snap | 12 +- ...sions__subscript__unclosed_slice_1.py.snap | 16 +- .../invalid_syntax@expressions__unary.py.snap | 4 +- ...pressions__unary__named_expression.py.snap | 8 +- ...xpressions__unary__no_expression_0.py.snap | 12 +- ...xpressions__unary__no_expression_1.py.snap | 12 +- ...pressions__yield__named_expression.py.snap | 8 +- ...xpressions__yield__star_expression.py.snap | 16 +- ...ns__yield_from__starred_expression.py.snap | 12 +- ...sions__yield_from__unparenthesized.py.snap | 24 +- ...d_syntax@f_string_empty_expression.py.snap | 8 +- ...g_invalid_conversion_flag_name_tok.py.snap | 4 +- ..._invalid_conversion_flag_other_tok.py.snap | 8 +- ...ntax@f_string_invalid_starred_expr.py.snap | 16 +- ..._string_lambda_without_parentheses.py.snap | 8 +- ...id_syntax@f_string_unclosed_lbrace.py.snap | 20 +- ...ing_unclosed_lbrace_in_format_spec.py.snap | 8 +- ..._syntax@for_stmt_invalid_iter_expr.py.snap | 28 +- ...lid_syntax@for_stmt_invalid_target.py.snap | 64 +- ...or_stmt_invalid_target_binary_expr.py.snap | 64 +- ...for_stmt_invalid_target_in_keyword.py.snap | 88 +- ...syntax@for_stmt_missing_in_keyword.py.snap | 16 +- ...valid_syntax@for_stmt_missing_iter.py.snap | 12 +- ...lid_syntax@for_stmt_missing_target.py.snap | 8 +- ...id_syntax@from_import_dotted_names.py.snap | 52 +- ...lid_syntax@from_import_empty_names.py.snap | 12 +- ..._syntax@from_import_missing_module.py.snap | 4 +- ...id_syntax@from_import_missing_rpar.py.snap | 24 +- ...@from_import_star_with_other_names.py.snap | 60 +- ...ort_unparenthesized_trailing_comma.py.snap | 32 +- ...lid_syntax@function_def_empty_body.py.snap | 16 +- ...x@function_def_invalid_return_expr.py.snap | 24 +- ...ax@function_def_missing_identifier.py.snap | 12 +- ...x@function_def_missing_return_type.py.snap | 4 +- ...nction_def_unclosed_parameter_list.py.snap | 44 +- ...ction_def_unclosed_type_param_list.py.snap | 32 +- ...n_def_unparenthesized_return_types.py.snap | 20 +- ...alid_syntax@global_stmt_expression.py.snap | 4 +- ..._syntax@global_stmt_trailing_comma.py.snap | 12 +- ..._syntax@if_stmt_elif_missing_colon.py.snap | 8 +- ...tax@if_stmt_invalid_elif_test_expr.py.snap | 12 +- ...d_syntax@if_stmt_invalid_test_expr.py.snap | 12 +- ...valid_syntax@if_stmt_missing_colon.py.snap | 12 +- ...nvalid_syntax@if_stmt_missing_test.py.snap | 4 +- ...lid_syntax@if_stmt_misspelled_elif.py.snap | 8 +- ...y_concatenated_unterminated_string.py.snap | 4 +- ...ated_unterminated_string_multiline.py.snap | 4 +- ...syntax@import_alias_missing_asname.py.snap | 4 +- ...ax@import_stmt_parenthesized_names.py.snap | 12 +- ...lid_syntax@import_stmt_star_import.py.snap | 16 +- ..._syntax@import_stmt_trailing_comma.py.snap | 8 +- .../invalid_syntax@invalid_del_target.py.snap | 4 +- ...ntax@lambda_body_with_starred_expr.py.snap | 40 +- ...syntax@lambda_body_with_yield_expr.py.snap | 16 +- ...d_syntax@match_classify_as_keyword.py.snap | 4 +- ..._classify_as_keyword_or_identifier.py.snap | 4 +- ...x@match_stmt_expect_indented_block.py.snap | 4 +- ...tax@match_stmt_expected_case_block.py.snap | 16 +- ...ntax@match_stmt_invalid_guard_expr.py.snap | 36 +- ...ax@match_stmt_invalid_subject_expr.py.snap | 20 +- ...ntax@match_stmt_missing_guard_expr.py.snap | 8 +- ..._syntax@match_stmt_missing_pattern.py.snap | 8 +- ...@match_stmt_no_newline_before_case.py.snap | 4 +- ...@match_stmt_single_starred_subject.py.snap | 4 +- ...ntax@multiple_clauses_on_same_line.py.snap | 24 +- ...nvalid_syntax@node_range_with_gaps.py.snap | 12 +- ...id_syntax@nonlocal_stmt_expression.py.snap | 4 +- ...yntax@nonlocal_stmt_trailing_comma.py.snap | 12 +- ...id_syntax@param_missing_annotation.py.snap | 16 +- ...valid_syntax@param_missing_default.py.snap | 20 +- ...ntax@param_with_invalid_annotation.py.snap | 40 +- ..._syntax@param_with_invalid_default.py.snap | 36 +- ...param_with_invalid_star_annotation.py.snap | 56 +- ...alid_syntax@params_duplicate_names.py.snap | 32 +- ...rams_expected_after_star_separator.py.snap | 32 +- ...@params_kwarg_after_star_separator.py.snap | 8 +- ...alid_syntax@params_multiple_kwargs.py.snap | 12 +- ...ax@params_multiple_slash_separator.py.snap | 28 +- ...tax@params_multiple_star_separator.py.snap | 28 +- ...lid_syntax@params_multiple_varargs.py.snap | 52 +- ..._syntax@params_no_arg_before_slash.py.snap | 12 +- ...x@params_non_default_after_default.py.snap | 20 +- ...lid_syntax@params_star_after_slash.py.snap | 56 +- ...ms_star_separator_after_star_param.py.snap | 36 +- ...ax@params_var_keyword_with_default.py.snap | 12 +- ...params_var_positional_with_default.py.snap | 12 +- ...id_syntax@raise_stmt_invalid_cause.py.snap | 24 +- ...alid_syntax@raise_stmt_invalid_exc.py.snap | 12 +- ...e_stmt_unparenthesized_tuple_cause.py.snap | 20 +- ...ise_stmt_unparenthesized_tuple_exc.py.snap | 24 +- ...nvalid_syntax@re_lex_logical_token.py.snap | 128 ++- ...yntax@re_lex_logical_token_mac_eol.py.snap | 20 +- ...x@re_lex_logical_token_windows_eol.py.snap | 20 +- ...x@re_lexing__fstring_format_spec_1.py.snap | 16 +- ...tax@re_lexing__line_continuation_1.py.snap | 16 +- ...ing__line_continuation_windows_eol.py.snap | 16 +- ...re_lexing__triple_quoted_fstring_1.py.snap | 4 +- ...re_lexing__triple_quoted_fstring_2.py.snap | 4 +- ...re_lexing__triple_quoted_fstring_3.py.snap | 8 +- ...id_syntax@return_stmt_invalid_expr.py.snap | 24 +- ...ple_and_compound_stmt_on_same_line.py.snap | 12 +- ...d_syntax@simple_stmts_on_same_line.py.snap | 24 +- ...atements__function_type_parameters.py.snap | 52 +- ...syntax@statements__if_extra_indent.py.snap | 12 +- ...ements__invalid_assignment_targets.py.snap | 180 +++- ...nvalid_augmented_assignment_target.py.snap | 176 +++- ...ax@statements__match__as_pattern_0.py.snap | 16 +- ...ax@statements__match__as_pattern_1.py.snap | 8 +- ...ax@statements__match__as_pattern_2.py.snap | 16 +- ...ax@statements__match__as_pattern_3.py.snap | 12 +- ...ax@statements__match__as_pattern_4.py.snap | 16 +- ...ents__match__invalid_class_pattern.py.snap | 52 +- ..._match__invalid_lhs_or_rhs_pattern.py.snap | 60 +- ...ts__match__invalid_mapping_pattern.py.snap | 56 +- ...tements__match__star_pattern_usage.py.snap | 48 +- ...statements__match__unary_add_usage.py.snap | 16 +- ...s__with__ambiguous_lpar_with_items.py.snap | 264 +++-- ...statements__with__empty_with_items.py.snap | 8 +- ...nts__with__unclosed_ambiguous_lpar.py.snap | 12 +- ..._with__unclosed_ambiguous_lpar_eof.py.snap | 4 +- ...__with__unparenthesized_with_items.py.snap | 56 +- ..._syntax@try_stmt_misspelled_except.py.snap | 24 +- ..._syntax@type_alias_incomplete_stmt.py.snap | 20 +- ...ntax@type_alias_invalid_value_expr.py.snap | 32 +- ...ntax@type_param_invalid_bound_expr.py.snap | 68 +- ...id_syntax@type_param_missing_bound.py.snap | 28 +- ...syntax@type_param_param_spec_bound.py.snap | 20 +- ...am_param_spec_invalid_default_expr.py.snap | 84 +- ...e_param_param_spec_missing_default.py.snap | 28 +- ...aram_type_var_invalid_default_expr.py.snap | 104 +- ...ype_param_type_var_missing_default.py.snap | 44 +- ...ax@type_param_type_var_tuple_bound.py.snap | 20 +- ...ype_var_tuple_invalid_default_expr.py.snap | 88 +- ...ram_type_var_tuple_missing_default.py.snap | 28 +- .../invalid_syntax@type_params_empty.py.snap | 16 +- ...erminated_fstring_newline_recovery.py.snap | 12 +- ...yntax@while_stmt_invalid_test_expr.py.snap | 24 +- ...id_syntax@while_stmt_missing_colon.py.snap | 4 +- ...lid_syntax@while_stmt_missing_test.py.snap | 12 +- ..._items_parenthesized_missing_colon.py.snap | 8 +- ..._items_parenthesized_missing_comma.py.snap | 64 +- ...iguous_lpar_with_items_binary_expr.py.snap | 68 +- ...@ambiguous_lpar_with_items_if_expr.py.snap | 48 +- ...ntax@ann_assign_stmt_simple_target.py.snap | 36 +- ...d_syntax@assign_targets_terminator.py.snap | 40 +- .../valid_syntax@async_for_statement.py.snap | 8 +- ...d_syntax@async_function_definition.py.snap | 4 +- .../valid_syntax@async_with_statement.py.snap | 4 +- .../valid_syntax@class_def_arguments.py.snap | 8 +- ...id_syntax@decorator_async_function.py.snap | 8 +- ...alid_syntax@del_targets_terminator.py.snap | 32 +- ...ntax@dotted_name_normalized_spaces.py.snap | 8 +- ...x@except_stmt_as_name_soft_keyword.py.snap | 24 +- ...alid_syntax@expressions__arguments.py.snap | 400 ++++++-- ...alid_syntax@expressions__attribute.py.snap | 60 +- .../valid_syntax@expressions__await.py.snap | 56 +- .../valid_syntax@expressions__bin_op.py.snap | 8 +- .../valid_syntax@expressions__bool_op.py.snap | 116 ++- .../valid_syntax@expressions__call.py.snap | 36 +- .../valid_syntax@expressions__compare.py.snap | 208 +++- ...lid_syntax@expressions__dictionary.py.snap | 140 ++- ...ressions__dictionary_comprehension.py.snap | 288 ++++-- ...valid_syntax@expressions__f_string.py.snap | 160 ++- ...alid_syntax@expressions__generator.py.snap | 192 +++- .../valid_syntax@expressions__if.py.snap | 148 ++- .../valid_syntax@expressions__lambda.py.snap | 268 +++-- .../valid_syntax@expressions__list.py.snap | 84 +- ...ax@expressions__list_comprehension.py.snap | 356 +++++-- .../valid_syntax@expressions__name.py.snap | 36 +- .../valid_syntax@expressions__named.py.snap | 72 +- ...syntax@expressions__number_literal.py.snap | 196 +++- ..._syntax@expressions__parenthesized.py.snap | 44 +- .../valid_syntax@expressions__set.py.snap | 44 +- ...tax@expressions__set_comprehension.py.snap | 224 +++-- .../valid_syntax@expressions__slice.py.snap | 76 +- .../valid_syntax@expressions__starred.py.snap | 60 +- ...alid_syntax@expressions__subscript.py.snap | 112 ++- .../valid_syntax@expressions__tuple.py.snap | 132 ++- ...valid_syntax@expressions__unary_op.py.snap | 40 +- .../valid_syntax@expressions__yield.py.snap | 76 +- ...lid_syntax@expressions__yield_from.py.snap | 56 +- ...id_syntax@for_in_target_valid_expr.py.snap | 44 +- .../valid_syntax@from_import_no_space.py.snap | 8 +- ...om_import_soft_keyword_module_name.py.snap | 32 +- ...syntax@from_import_stmt_terminator.py.snap | 72 +- ...tax@fstring_format_spec_terminator.py.snap | 8 +- ...yntax@function_def_parameter_range.py.snap | 24 +- ...ion_def_parenthesized_return_types.py.snap | 20 +- ...tax@function_def_valid_return_expr.py.snap | 44 +- .../valid_syntax@global_stmt.py.snap | 16 +- ...syntax@import_as_name_soft_keyword.py.snap | 24 +- ...alid_syntax@import_stmt_terminator.py.snap | 32 +- ...alid_syntax@lambda_with_valid_body.py.snap | 64 +- .../valid_syntax@match_as_pattern.py.snap | 8 +- ...ntax@match_as_pattern_soft_keyword.py.snap | 16 +- ...ax@match_attr_pattern_soft_keyword.py.snap | 56 +- ...tax@match_classify_as_identifier_1.py.snap | 8 +- ...tax@match_classify_as_identifier_2.py.snap | 92 +- ...syntax@match_classify_as_keyword_1.py.snap | 28 +- ...syntax@match_classify_as_keyword_2.py.snap | 12 +- ..._classify_as_keyword_or_identifier.py.snap | 28 +- ...nce_pattern_parentheses_terminator.py.snap | 20 +- ...@match_sequence_pattern_terminator.py.snap | 36 +- ...lid_syntax@match_stmt_subject_expr.py.snap | 24 +- ...syntax@match_stmt_valid_guard_expr.py.snap | 56 +- .../valid_syntax@nonlocal_stmt.py.snap | 16 +- .../valid_syntax@other__decorator.py.snap | 148 ++- ...valid_syntax@param_with_annotation.py.snap | 56 +- .../valid_syntax@param_with_default.py.snap | 48 +- ..._syntax@param_with_star_annotation.py.snap | 32 +- ...ntax@params_non_default_after_star.py.snap | 44 +- ...seen_keyword_only_param_after_star.py.snap | 24 +- ...valid_syntax@simple_stmts_in_block.py.snap | 4 +- ...yntax@simple_stmts_with_semicolons.py.snap | 24 +- ...atement__ambiguous_lpar_with_items.py.snap | 608 ++++++++--- ...ax@statement__annotated_assignment.py.snap | 60 +- .../valid_syntax@statement__assert.py.snap | 68 +- ...valid_syntax@statement__assignment.py.snap | 128 ++- ...ax@statement__augmented_assignment.py.snap | 88 +- .../valid_syntax@statement__class.py.snap | 276 +++-- .../valid_syntax@statement__delete.py.snap | 92 +- .../valid_syntax@statement__for.py.snap | 184 +++- ...alid_syntax@statement__from_import.py.snap | 84 +- .../valid_syntax@statement__function.py.snap | 760 ++++++++++---- .../valid_syntax@statement__if.py.snap | 80 +- .../valid_syntax@statement__import.py.snap | 44 +- .../valid_syntax@statement__match.py.snap | 944 +++++++++++++----- .../valid_syntax@statement__raise.py.snap | 108 +- .../valid_syntax@statement__return.py.snap | 60 +- .../valid_syntax@statement__simple.py.snap | 40 +- .../valid_syntax@statement__try.py.snap | 192 +++- .../valid_syntax@statement__type.py.snap | 840 ++++++++++++---- .../valid_syntax@statement__while.py.snap | 64 +- .../valid_syntax@statement__with.py.snap | 76 +- ...valid_syntax@type_param_param_spec.py.snap | 64 +- .../valid_syntax@type_param_type_var.py.snap | 108 +- ...d_syntax@type_param_type_var_tuple.py.snap | 80 +- crates/ruff_python_semantic/src/model.rs | 6 +- crates/ruff_workspace/src/options.rs | 29 +- 456 files changed, 13675 insertions(+), 4689 deletions(-) delete mode 100644 crates/red_knot_python_semantic/src/name.rs diff --git a/Cargo.lock b/Cargo.lock index fc0c35f537593b..32c53e242ceb0f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2262,11 +2262,15 @@ dependencies = [ "is-macro", "itertools 0.13.0", "once_cell", + "ruff_cache", + "ruff_macros", "ruff_python_trivia", "ruff_source_file", "ruff_text_size", "rustc-hash 2.0.0", + "schemars", "serde", + "smol_str", ] [[package]] @@ -2341,6 +2345,7 @@ dependencies = [ "bitflags 2.5.0", "itertools 0.13.0", "ruff_python_ast", + "smol_str", "unic-ucd-category", ] diff --git a/crates/red_knot_python_semantic/src/lib.rs b/crates/red_knot_python_semantic/src/lib.rs index 64e73d1f291dfb..436fd07f4cff12 100644 --- a/crates/red_knot_python_semantic/src/lib.rs +++ b/crates/red_knot_python_semantic/src/lib.rs @@ -1,6 +1,5 @@ pub mod ast_node_ref; mod db; -pub mod name; mod node_key; pub mod semantic_index; pub mod types; diff --git a/crates/red_knot_python_semantic/src/name.rs b/crates/red_knot_python_semantic/src/name.rs deleted file mode 100644 index 78a9e4cfc2c402..00000000000000 --- a/crates/red_knot_python_semantic/src/name.rs +++ /dev/null @@ -1,56 +0,0 @@ -use std::ops::Deref; - -#[derive(Debug, Clone, Eq, PartialEq, Hash)] -pub struct Name(smol_str::SmolStr); - -impl Name { - #[inline] - pub fn new(name: &str) -> Self { - Self(smol_str::SmolStr::new(name)) - } - - #[inline] - pub fn new_static(name: &'static str) -> Self { - Self(smol_str::SmolStr::new_static(name)) - } - - pub fn as_str(&self) -> &str { - self.0.as_str() - } -} - -impl Deref for Name { - type Target = str; - - #[inline] - fn deref(&self) -> &Self::Target { - self.as_str() - } -} - -impl From for Name -where - T: Into, -{ - fn from(value: T) -> Self { - Self(value.into()) - } -} - -impl std::fmt::Display for Name { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl PartialEq for Name { - fn eq(&self, other: &str) -> bool { - self.as_str() == other - } -} - -impl PartialEq for str { - fn eq(&self, other: &Name) -> bool { - other == self - } -} diff --git a/crates/red_knot_python_semantic/src/semantic_index/builder.rs b/crates/red_knot_python_semantic/src/semantic_index/builder.rs index b60a008ed981c8..5d2eecf970c45b 100644 --- a/crates/red_knot_python_semantic/src/semantic_index/builder.rs +++ b/crates/red_knot_python_semantic/src/semantic_index/builder.rs @@ -5,9 +5,9 @@ use rustc_hash::FxHashMap; use ruff_db::parsed::ParsedModule; use ruff_index::IndexVec; use ruff_python_ast as ast; +use ruff_python_ast::name::Name; use ruff_python_ast::visitor::{walk_expr, walk_stmt, Visitor}; -use crate::name::Name; use crate::node_key::NodeKey; use crate::semantic_index::ast_ids::{ AstId, AstIdsBuilder, ScopeAssignmentId, ScopeClassId, ScopeFunctionId, ScopeImportFromId, diff --git a/crates/red_knot_python_semantic/src/semantic_index/symbol.rs b/crates/red_knot_python_semantic/src/semantic_index/symbol.rs index 62282a1a5f1559..ac447d3eee64a5 100644 --- a/crates/red_knot_python_semantic/src/semantic_index/symbol.rs +++ b/crates/red_knot_python_semantic/src/semantic_index/symbol.rs @@ -7,13 +7,12 @@ use rustc_hash::FxHasher; use salsa::DebugWithDb; use smallvec::SmallVec; -use ruff_db::vfs::VfsFile; -use ruff_index::{newtype_index, IndexVec}; - -use crate::name::Name; use crate::semantic_index::definition::Definition; use crate::semantic_index::{root_scope, semantic_index, symbol_table, SymbolMap}; use crate::Db; +use ruff_db::vfs::VfsFile; +use ruff_index::{newtype_index, IndexVec}; +use ruff_python_ast::name::Name; #[derive(Eq, PartialEq, Debug)] pub struct Symbol { diff --git a/crates/red_knot_python_semantic/src/types.rs b/crates/red_knot_python_semantic/src/types.rs index 54c0a92c40e07f..e47870b960e407 100644 --- a/crates/red_knot_python_semantic/src/types.rs +++ b/crates/red_knot_python_semantic/src/types.rs @@ -1,11 +1,5 @@ use salsa::DebugWithDb; -use ruff_db::parsed::parsed_module; -use ruff_db::vfs::VfsFile; -use ruff_index::newtype_index; -use ruff_python_ast as ast; - -use crate::name::Name; use crate::semantic_index::ast_ids::{AstIdNode, ScopeAstIdNode}; use crate::semantic_index::symbol::{FileScopeId, PublicSymbolId, ScopeId}; use crate::semantic_index::{ @@ -14,6 +8,11 @@ use crate::semantic_index::{ use crate::types::infer::{TypeInference, TypeInferenceBuilder}; use crate::Db; use crate::FxIndexSet; +use ruff_db::parsed::parsed_module; +use ruff_db::vfs::VfsFile; +use ruff_index::newtype_index; +use ruff_python_ast as ast; +use ruff_python_ast::name::Name; mod display; mod infer; diff --git a/crates/red_knot_python_semantic/src/types/infer.rs b/crates/red_knot_python_semantic/src/types/infer.rs index 9b1728d16c6bc3..bfdba6d606178f 100644 --- a/crates/red_knot_python_semantic/src/types/infer.rs +++ b/crates/red_knot_python_semantic/src/types/infer.rs @@ -9,7 +9,6 @@ use ruff_index::IndexVec; use ruff_python_ast as ast; use ruff_python_ast::{ExprContext, TypeParams}; -use crate::name::Name; use crate::semantic_index::ast_ids::{ScopeAstIdNode, ScopeExpressionId}; use crate::semantic_index::definition::{Definition, ImportDefinition, ImportFromDefinition}; use crate::semantic_index::symbol::{FileScopeId, ScopeId, ScopeKind, ScopedSymbolId, SymbolTable}; @@ -199,7 +198,7 @@ impl<'db> TypeInferenceBuilder<'db> { } let function_ty = self.function_ty(FunctionType { - name: Name::new(&name.id), + name: name.id.clone(), decorators: decorator_tys, }); @@ -248,7 +247,7 @@ impl<'db> TypeInferenceBuilder<'db> { assert_eq!(class_body_scope.kind(), ScopeKind::Class); let class_ty = self.class_ty(ClassType { - name: Name::new(name), + name: name.id.clone(), bases, body_scope: class_body_scope_id.to_scope_id(self.db, self.file_id), }); @@ -398,7 +397,7 @@ impl<'db> TypeInferenceBuilder<'db> { } = alias; let ty = module_ty - .member(&self.typing_context(), &Name::new(&name.id)) + .member(&self.typing_context(), &name.id) .unwrap_or(Type::Unknown); self.definition_tys.insert( @@ -557,7 +556,7 @@ impl<'db> TypeInferenceBuilder<'db> { let value_ty = self.infer_expression(value); let member_ty = value_ty - .member(&self.typing_context(), &Name::new(&attr.id)) + .member(&self.typing_context(), &attr.id) .unwrap_or(Type::Unknown); match ctx { @@ -695,9 +694,9 @@ mod tests { use ruff_db::vfs::system_path_to_file; use crate::db::tests::TestDb; - use crate::name::Name; use crate::types::{public_symbol_ty_by_name, Type, TypingContext}; use red_knot_module_resolver::{set_module_resolution_settings, ModuleResolutionSettings}; + use ruff_python_ast::name::Name; fn setup_db() -> TestDb { let mut db = TestDb::new(); @@ -791,7 +790,7 @@ class C: }; let context = TypingContext::global(&db); - let member_ty = class_id.class_member(&context, &Name::new("f")); + let member_ty = class_id.class_member(&context, &Name::new_static("f")); let Some(Type::Function(func_id)) = member_ty else { panic!("C.f is not a Function"); diff --git a/crates/ruff_linter/src/fix/edits.rs b/crates/ruff_linter/src/fix/edits.rs index 0901a9f694a2f4..7db9e0bbb042bd 100644 --- a/crates/ruff_linter/src/fix/edits.rs +++ b/crates/ruff_linter/src/fix/edits.rs @@ -140,7 +140,7 @@ pub(crate) fn make_redundant_alias<'a>( .filter_map(|name| { aliases .iter() - .find(|alias| alias.asname.is_none() && name == alias.name.id) + .find(|alias| alias.asname.is_none() && *name == alias.name.id) .map(|alias| Edit::range_replacement(format!("{name} as {name}"), alias.range)) }) .collect() diff --git a/crates/ruff_linter/src/importer/mod.rs b/crates/ruff_linter/src/importer/mod.rs index 51ada8f45d37ba..b4bb20a5dbf166 100644 --- a/crates/ruff_linter/src/importer/mod.rs +++ b/crates/ruff_linter/src/importer/mod.rs @@ -6,17 +6,17 @@ use std::error::Error; use anyhow::Result; -use libcst_native::{ImportAlias, Name, NameOrAttribute}; -use ruff_python_ast::{self as ast, ModModule, Stmt}; -use ruff_python_parser::{Parsed, Tokens}; -use ruff_text_size::{Ranged, TextSize}; +use libcst_native::{ImportAlias, Name as cstName, NameOrAttribute}; use ruff_diagnostics::Edit; use ruff_python_ast::imports::{AnyImport, Import, ImportFrom}; +use ruff_python_ast::{self as ast, ModModule, Stmt}; use ruff_python_codegen::Stylist; +use ruff_python_parser::{Parsed, Tokens}; use ruff_python_semantic::{ImportedName, SemanticModel}; use ruff_python_trivia::textwrap::indent; use ruff_source_file::Locator; +use ruff_text_size::{Ranged, TextSize}; use crate::cst::matchers::{match_aliases, match_import_from, match_statement}; use crate::fix; @@ -425,7 +425,7 @@ impl<'a> Importer<'a> { let import_from = match_import_from(&mut statement)?; let aliases = match_aliases(import_from)?; aliases.push(ImportAlias { - name: NameOrAttribute::N(Box::new(Name { + name: NameOrAttribute::N(Box::new(cstName { value: member, lpar: vec![], rpar: vec![], diff --git a/crates/ruff_linter/src/rules/airflow/rules/task_variable_name.rs b/crates/ruff_linter/src/rules/airflow/rules/task_variable_name.rs index 870525d9ad5de4..9836f230e7b9ba 100644 --- a/crates/ruff_linter/src/rules/airflow/rules/task_variable_name.rs +++ b/crates/ruff_linter/src/rules/airflow/rules/task_variable_name.rs @@ -81,7 +81,7 @@ pub(crate) fn variable_name_task_id( let ast::ExprStringLiteral { value: task_id, .. } = keyword.value.as_string_literal_expr()?; // If the target name is the same as the task_id, no violation. - if task_id == id { + if task_id == id.as_str() { return None; } diff --git a/crates/ruff_linter/src/rules/flake8_annotations/helpers.rs b/crates/ruff_linter/src/rules/flake8_annotations/helpers.rs index fd5b66cd4e288e..1cea0f61352336 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/helpers.rs +++ b/crates/ruff_linter/src/rules/flake8_annotations/helpers.rs @@ -5,6 +5,7 @@ use ruff_diagnostics::Edit; use ruff_python_ast::helpers::{ pep_604_union, typing_optional, typing_union, ReturnStatementVisitor, }; +use ruff_python_ast::name::Name; use ruff_python_ast::visitor::Visitor; use ruff_python_ast::{self as ast, Expr, ExprContext}; use ruff_python_semantic::analyze::terminal::Terminal; @@ -140,7 +141,7 @@ impl AutoPythonType { ) .ok()?; let expr = Expr::Name(ast::ExprName { - id: binding, + id: Name::from(binding), range: TextRange::default(), ctx: ExprContext::Load, }); @@ -181,7 +182,7 @@ impl AutoPythonType { semantic, ) .ok()?; - let expr = typing_optional(element, binding); + let expr = typing_optional(element, Name::from(binding)); Some((expr, vec![optional_edit])) } _ => { @@ -198,7 +199,7 @@ impl AutoPythonType { semantic, ) .ok()?; - let expr = typing_union(&elements, binding); + let expr = typing_union(&elements, Name::from(binding)); Some((expr, vec![union_edit])) } } diff --git a/crates/ruff_linter/src/rules/flake8_gettext/mod.rs b/crates/ruff_linter/src/rules/flake8_gettext/mod.rs index eec91be60eb187..09d440526eb06e 100644 --- a/crates/ruff_linter/src/rules/flake8_gettext/mod.rs +++ b/crates/ruff_linter/src/rules/flake8_gettext/mod.rs @@ -1,11 +1,12 @@ //! Rules from [flake8-gettext](https://pypi.org/project/flake8-gettext/). +use ruff_python_ast::name::Name; use ruff_python_ast::{self as ast, Expr}; pub(crate) mod rules; pub mod settings; /// Returns true if the [`Expr`] is an internationalization function call. -pub(crate) fn is_gettext_func_call(func: &Expr, functions_names: &[String]) -> bool { +pub(crate) fn is_gettext_func_call(func: &Expr, functions_names: &[Name]) -> bool { if let Expr::Name(ast::ExprName { id, .. }) = func { functions_names.contains(id) } else { diff --git a/crates/ruff_linter/src/rules/flake8_gettext/settings.rs b/crates/ruff_linter/src/rules/flake8_gettext/settings.rs index 76180b45ac59d2..491868ab997c8d 100644 --- a/crates/ruff_linter/src/rules/flake8_gettext/settings.rs +++ b/crates/ruff_linter/src/rules/flake8_gettext/settings.rs @@ -1,17 +1,18 @@ use crate::display_settings; use ruff_macros::CacheKey; +use ruff_python_ast::name::Name; use std::fmt::{Display, Formatter}; #[derive(Debug, Clone, CacheKey)] pub struct Settings { - pub functions_names: Vec, + pub functions_names: Vec, } -pub fn default_func_names() -> Vec { +pub fn default_func_names() -> Vec { vec![ - "_".to_string(), - "gettext".to_string(), - "ngettext".to_string(), + Name::new_static("_"), + Name::new_static("gettext"), + Name::new_static("ngettext"), ] } diff --git a/crates/ruff_linter/src/rules/flake8_pyi/rules/unnecessary_type_union.rs b/crates/ruff_linter/src/rules/flake8_pyi/rules/unnecessary_type_union.rs index 50f67c164be921..1b1072f5c5592b 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/rules/unnecessary_type_union.rs +++ b/crates/ruff_linter/src/rules/flake8_pyi/rules/unnecessary_type_union.rs @@ -2,6 +2,7 @@ use ast::ExprContext; use ruff_diagnostics::{Diagnostic, Edit, Fix, FixAvailability, Violation}; use ruff_macros::{derive_message_formats, violation}; use ruff_python_ast::helpers::pep_604_union; +use ruff_python_ast::name::Name; use ruff_python_ast::{self as ast, Expr}; use ruff_python_semantic::analyze::typing::traverse_union; use ruff_text_size::{Ranged, TextRange}; @@ -26,7 +27,7 @@ use crate::checkers::ast::Checker; /// ``` #[violation] pub struct UnnecessaryTypeUnion { - members: Vec, + members: Vec, is_pep604_union: bool, } @@ -83,10 +84,10 @@ pub(crate) fn unnecessary_type_union<'a>(checker: &mut Checker, union: &'a Expr) traverse_union(&mut collect_type_exprs, semantic, union); if type_exprs.len() > 1 { - let type_members: Vec = type_exprs + let type_members: Vec = type_exprs .clone() .into_iter() - .map(|type_expr| checker.locator().slice(type_expr).to_string()) + .map(|type_expr| Name::new(checker.locator().slice(type_expr))) .collect(); let mut diagnostic = Diagnostic::new( @@ -101,7 +102,7 @@ pub(crate) fn unnecessary_type_union<'a>(checker: &mut Checker, union: &'a Expr) let content = if let Some(subscript) = subscript { let types = &Expr::Subscript(ast::ExprSubscript { value: Box::new(Expr::Name(ast::ExprName { - id: "type".into(), + id: Name::new_static("type"), ctx: ExprContext::Load, range: TextRange::default(), })), diff --git a/crates/ruff_linter/src/rules/flake8_self/mod.rs b/crates/ruff_linter/src/rules/flake8_self/mod.rs index 70f1557c5ec1ae..d870d85f9fcb1c 100644 --- a/crates/ruff_linter/src/rules/flake8_self/mod.rs +++ b/crates/ruff_linter/src/rules/flake8_self/mod.rs @@ -7,13 +7,13 @@ mod tests { use std::convert::AsRef; use std::path::Path; - use anyhow::Result; - use test_case::test_case; - use crate::registry::Rule; use crate::rules::flake8_self; use crate::test::test_path; use crate::{assert_messages, settings}; + use anyhow::Result; + use ruff_python_ast::name::Name; + use test_case::test_case; #[test_case(Rule::PrivateMemberAccess, Path::new("SLF001.py"))] fn rules(rule_code: Rule, path: &Path) -> Result<()> { @@ -32,7 +32,7 @@ mod tests { Path::new("flake8_self/SLF001_extended.py"), &settings::LinterSettings { flake8_self: flake8_self::settings::Settings { - ignore_names: vec!["_meta".to_string()], + ignore_names: vec![Name::new_static("_meta")], }, ..settings::LinterSettings::for_rule(Rule::PrivateMemberAccess) }, diff --git a/crates/ruff_linter/src/rules/flake8_self/rules/private_member_access.rs b/crates/ruff_linter/src/rules/flake8_self/rules/private_member_access.rs index 0802caa578420d..aa592c828523b2 100644 --- a/crates/ruff_linter/src/rules/flake8_self/rules/private_member_access.rs +++ b/crates/ruff_linter/src/rules/flake8_self/rules/private_member_access.rs @@ -93,12 +93,7 @@ pub(crate) fn private_member_access(checker: &mut Checker, expr: &Expr) { return; } - if checker - .settings - .flake8_self - .ignore_names - .contains(attr.as_ref()) - { + if checker.settings.flake8_self.ignore_names.contains(&attr.id) { return; } diff --git a/crates/ruff_linter/src/rules/flake8_self/settings.rs b/crates/ruff_linter/src/rules/flake8_self/settings.rs index cb3027fa90c239..a6d9f1dde3c0e1 100644 --- a/crates/ruff_linter/src/rules/flake8_self/settings.rs +++ b/crates/ruff_linter/src/rules/flake8_self/settings.rs @@ -2,6 +2,7 @@ use crate::display_settings; use ruff_macros::CacheKey; +use ruff_python_ast::name::Name; use std::fmt::{Display, Formatter}; // By default, ignore the `namedtuple` methods and attributes, as well as the @@ -19,13 +20,13 @@ pub const IGNORE_NAMES: [&str; 7] = [ #[derive(Debug, Clone, CacheKey)] pub struct Settings { - pub ignore_names: Vec, + pub ignore_names: Vec, } impl Default for Settings { fn default() -> Self { Self { - ignore_names: IGNORE_NAMES.map(String::from).to_vec(), + ignore_names: IGNORE_NAMES.map(Name::new_static).to_vec(), } } } diff --git a/crates/ruff_linter/src/rules/pyflakes/format.rs b/crates/ruff_linter/src/rules/pyflakes/format.rs index bdedd043980752..f53d7acfa1b66d 100644 --- a/crates/ruff_linter/src/rules/pyflakes/format.rs +++ b/crates/ruff_linter/src/rules/pyflakes/format.rs @@ -1,9 +1,9 @@ //! Implements helper functions for using vendored/format.rs -use std::convert::TryFrom; - +use ruff_python_ast::name::Name; use ruff_python_literal::format::{ FieldName, FieldType, FormatParseError, FormatPart, FormatString, FromTemplate, }; +use std::convert::TryFrom; pub(crate) fn error_to_string(err: &FormatParseError) -> String { match err { @@ -26,7 +26,7 @@ pub(crate) fn error_to_string(err: &FormatParseError) -> String { pub(crate) struct FormatSummary { pub(crate) autos: Vec, pub(crate) indices: Vec, - pub(crate) keywords: Vec, + pub(crate) keywords: Vec, pub(crate) has_nested_parts: bool, } @@ -54,7 +54,7 @@ impl TryFrom<&str> for FormatSummary { match parsed.field_type { FieldType::Auto => autos.push(autos.len()), FieldType::Index(i) => indices.push(i), - FieldType::Keyword(k) => keywords.push(k), + FieldType::Keyword(k) => keywords.push(Name::from(k)), }; let nested = FormatString::from_str(format_spec)?; @@ -66,7 +66,7 @@ impl TryFrom<&str> for FormatSummary { match parsed.field_type { FieldType::Auto => autos.push(autos.len()), FieldType::Index(i) => indices.push(i), - FieldType::Keyword(k) => keywords.push(k), + FieldType::Keyword(k) => keywords.push(Name::from(k)), }; has_nested_parts = true; } diff --git a/crates/ruff_linter/src/rules/pyflakes/rules/strings.rs b/crates/ruff_linter/src/rules/pyflakes/rules/strings.rs index d61c501bde69f6..811bf7c26e52f7 100644 --- a/crates/ruff_linter/src/rules/pyflakes/rules/strings.rs +++ b/crates/ruff_linter/src/rules/pyflakes/rules/strings.rs @@ -4,7 +4,8 @@ use rustc_hash::FxHashSet; use ruff_diagnostics::{AlwaysFixableViolation, Diagnostic, Fix, FixAvailability, Violation}; use ruff_macros::{derive_message_formats, violation}; -use ruff_python_ast::{self as ast, Expr, Identifier, Keyword}; +use ruff_python_ast::name::Name; +use ruff_python_ast::{self as ast, Expr, Keyword}; use ruff_text_size::{Ranged, TextRange}; use crate::checkers::ast::Checker; @@ -382,7 +383,7 @@ impl Violation for StringDotFormatInvalidFormat { /// - [Python documentation: `str.format`](https://docs.python.org/3/library/stdtypes.html#str.format) #[violation] pub struct StringDotFormatExtraNamedArguments { - missing: Vec, + missing: Vec, } impl Violation for StringDotFormatExtraNamedArguments { @@ -743,13 +744,13 @@ pub(crate) fn string_dot_format_extra_named_arguments( .iter() .filter_map(|Keyword { arg, .. }| arg.as_ref()); - let missing: Vec<(usize, &str)> = keywords + let missing: Vec<(usize, &Name)> = keywords .enumerate() .filter_map(|(index, keyword)| { - if summary.keywords.contains(keyword.as_ref()) { + if summary.keywords.contains(&keyword.id) { None } else { - Some((index, keyword.as_str())) + Some((index, &keyword.id)) } }) .collect(); @@ -758,10 +759,7 @@ pub(crate) fn string_dot_format_extra_named_arguments( return; } - let names: Vec = missing - .iter() - .map(|(_, name)| (*name).to_string()) - .collect(); + let names: Vec = missing.iter().map(|(_, name)| (*name).clone()).collect(); let mut diagnostic = Diagnostic::new( StringDotFormatExtraNamedArguments { missing: names }, call.range(), @@ -865,7 +863,7 @@ pub(crate) fn string_dot_format_missing_argument( .iter() .filter_map(|k| { let Keyword { arg, .. } = &k; - arg.as_ref().map(Identifier::as_str) + arg.as_ref().map(|identifier| &identifier.id) }) .collect(); @@ -879,8 +877,8 @@ pub(crate) fn string_dot_format_missing_argument( summary .keywords .iter() - .filter(|k| !keywords.contains(k.as_str())) - .cloned(), + .filter(|k| !keywords.contains(*k)) + .map(ToString::to_string), ) .collect(); diff --git a/crates/ruff_linter/src/rules/pylint/rules/modified_iterating_set.rs b/crates/ruff_linter/src/rules/pylint/rules/modified_iterating_set.rs index efc31b4e1cf087..ad2ef7e8d9903a 100644 --- a/crates/ruff_linter/src/rules/pylint/rules/modified_iterating_set.rs +++ b/crates/ruff_linter/src/rules/pylint/rules/modified_iterating_set.rs @@ -1,6 +1,7 @@ use ruff_diagnostics::{AlwaysFixableViolation, Diagnostic, Edit, Fix}; use ruff_macros::{derive_message_formats, violation}; use ruff_python_ast::helpers::any_over_body; +use ruff_python_ast::name::Name; use ruff_python_ast::{self as ast, Expr, StmtFor}; use ruff_python_semantic::analyze::typing::is_set; use ruff_text_size::Ranged; @@ -41,7 +42,7 @@ use crate::checkers::ast::Checker; /// - [Python documentation: `set`](https://docs.python.org/3/library/stdtypes.html#set) #[violation] pub struct ModifiedIteratingSet { - name: String, + name: Name, } impl AlwaysFixableViolation for ModifiedIteratingSet { diff --git a/crates/ruff_linter/src/rules/pylint/rules/no_method_decorator.rs b/crates/ruff_linter/src/rules/pylint/rules/no_method_decorator.rs index 49d22f2fb30e7b..e6421bd2a7d499 100644 --- a/crates/ruff_linter/src/rules/pylint/rules/no_method_decorator.rs +++ b/crates/ruff_linter/src/rules/pylint/rules/no_method_decorator.rs @@ -2,6 +2,7 @@ use std::collections::HashMap; use ruff_diagnostics::{AlwaysFixableViolation, Diagnostic, DiagnosticKind, Edit, Fix}; use ruff_macros::{derive_message_formats, violation}; +use ruff_python_ast::name::Name; use ruff_python_ast::{self as ast, Expr, Stmt}; use ruff_python_trivia::indentation_at_offset; use ruff_text_size::{Ranged, TextRange}; @@ -101,7 +102,7 @@ fn get_undecorated_methods(checker: &mut Checker, class_stmt: &Stmt, method_type return; }; - let mut explicit_decorator_calls: HashMap = HashMap::default(); + let mut explicit_decorator_calls: HashMap = HashMap::default(); let (method_name, diagnostic_type): (&str, DiagnosticKind) = match method_type { MethodType::Classmethod => ("classmethod", NoClassmethodDecorator.into()), @@ -152,7 +153,7 @@ fn get_undecorated_methods(checker: &mut Checker, class_stmt: &Stmt, method_type .. }) = stmt { - let Some(decorator_call_statement) = explicit_decorator_calls.get(name.as_str()) else { + let Some(decorator_call_statement) = explicit_decorator_calls.get(&name.id) else { continue; }; diff --git a/crates/ruff_linter/src/rules/pylint/rules/redeclared_assigned_name.rs b/crates/ruff_linter/src/rules/pylint/rules/redeclared_assigned_name.rs index cb0dbc5175f2b9..5952a462695f94 100644 --- a/crates/ruff_linter/src/rules/pylint/rules/redeclared_assigned_name.rs +++ b/crates/ruff_linter/src/rules/pylint/rules/redeclared_assigned_name.rs @@ -2,6 +2,7 @@ use ruff_python_ast::{self as ast, Expr}; use ruff_diagnostics::{Diagnostic, Violation}; use ruff_macros::{derive_message_formats, violation}; +use ruff_python_ast::name::Name; use ruff_text_size::Ranged; use crate::checkers::ast::Checker; @@ -42,14 +43,14 @@ impl Violation for RedeclaredAssignedName { /// PLW0128 pub(crate) fn redeclared_assigned_name(checker: &mut Checker, targets: &Vec) { - let mut names: Vec = Vec::new(); + let mut names: Vec = Vec::new(); for target in targets { check_expr(checker, target, &mut names); } } -fn check_expr(checker: &mut Checker, expr: &Expr, names: &mut Vec) { +fn check_expr(checker: &mut Checker, expr: &Expr, names: &mut Vec) { match expr { Expr::Tuple(ast::ExprTuple { elts, .. }) => { for target in elts { @@ -69,7 +70,7 @@ fn check_expr(checker: &mut Checker, expr: &Expr, names: &mut Vec) { expr.range(), )); } - names.push(id.to_string()); + names.push(id.clone()); } _ => {} } diff --git a/crates/ruff_linter/src/rules/pyupgrade/rules/use_pep695_type_alias.rs b/crates/ruff_linter/src/rules/pyupgrade/rules/use_pep695_type_alias.rs index 670954e408f24b..dc3072ff083962 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/rules/use_pep695_type_alias.rs +++ b/crates/ruff_linter/src/rules/pyupgrade/rules/use_pep695_type_alias.rs @@ -2,6 +2,7 @@ use itertools::Itertools; use ruff_diagnostics::{Applicability, Diagnostic, Edit, Fix, FixAvailability, Violation}; use ruff_macros::{derive_message_formats, violation}; +use ruff_python_ast::name::Name; use ruff_python_ast::{ self as ast, visitor::{self, Visitor}, @@ -104,7 +105,7 @@ pub(crate) fn non_pep695_type_alias_type(checker: &mut Checker, stmt: &StmtAssig return; }; - if name.value.to_str() != target_name.id { + if &name.value != target_name.id.as_str() { return; } @@ -143,7 +144,7 @@ pub(crate) fn non_pep695_type_alias_type(checker: &mut Checker, stmt: &StmtAssig checker.diagnostics.push(create_diagnostic( checker.generator(), stmt.range(), - &target_name.id, + target_name.id.clone(), value, &vars, Applicability::Safe, @@ -199,7 +200,7 @@ pub(crate) fn non_pep695_type_alias(checker: &mut Checker, stmt: &StmtAnnAssign) checker.diagnostics.push(create_diagnostic( checker.generator(), stmt.range(), - name, + name.clone(), value, &vars, // The fix is only safe in a type stub because new-style aliases have different runtime behavior @@ -217,7 +218,7 @@ pub(crate) fn non_pep695_type_alias(checker: &mut Checker, stmt: &StmtAnnAssign) fn create_diagnostic( generator: Generator, stmt_range: TextRange, - name: &str, + name: Name, value: &Expr, vars: &[TypeVar], applicability: Applicability, @@ -270,7 +271,7 @@ fn create_diagnostic( range: TextRange::default(), name: Box::new(Expr::Name(ExprName { range: TextRange::default(), - id: name.to_string(), + id: name, ctx: ast::ExprContext::Load, })), type_params, diff --git a/crates/ruff_linter/src/rules/refurb/helpers.rs b/crates/ruff_linter/src/rules/refurb/helpers.rs index 97823d2032d25c..d82f105d9b29c1 100644 --- a/crates/ruff_linter/src/rules/refurb/helpers.rs +++ b/crates/ruff_linter/src/rules/refurb/helpers.rs @@ -1,13 +1,14 @@ +use ruff_python_ast::name::Name; use ruff_python_ast::{self as ast, Expr}; use ruff_python_codegen::Generator; use ruff_python_semantic::{BindingId, ResolvedReference, SemanticModel}; use ruff_text_size::{Ranged, TextRange}; /// Format a code snippet to call `name.method()`. -pub(super) fn generate_method_call(name: &str, method: &str, generator: Generator) -> String { +pub(super) fn generate_method_call(name: Name, method: &str, generator: Generator) -> String { // Construct `name`. let var = ast::ExprName { - id: name.to_string(), + id: name, ctx: ast::ExprContext::Load, range: TextRange::default(), }; @@ -38,13 +39,13 @@ pub(super) fn generate_method_call(name: &str, method: &str, generator: Generato /// Format a code snippet comparing `name` to `None` (e.g., `name is None`). pub(super) fn generate_none_identity_comparison( - name: &str, + name: Name, negate: bool, generator: Generator, ) -> String { // Construct `name`. let var = ast::ExprName { - id: name.to_string(), + id: name, ctx: ast::ExprContext::Load, range: TextRange::default(), }; @@ -77,12 +78,12 @@ pub(super) enum OpenMode { } impl OpenMode { - pub(super) fn pathlib_method(self) -> String { + pub(super) fn pathlib_method(self) -> Name { match self { - OpenMode::ReadText => "read_text".to_string(), - OpenMode::ReadBytes => "read_bytes".to_string(), - OpenMode::WriteText => "write_text".to_string(), - OpenMode::WriteBytes => "write_bytes".to_string(), + OpenMode::ReadText => Name::new_static("read_text"), + OpenMode::ReadBytes => Name::new_static("read_bytes"), + OpenMode::WriteText => Name::new_static("write_text"), + OpenMode::WriteBytes => Name::new_static("write_bytes"), } } } diff --git a/crates/ruff_linter/src/rules/refurb/rules/delete_full_slice.rs b/crates/ruff_linter/src/rules/refurb/rules/delete_full_slice.rs index 1b0e610bdbe54d..21c21f282192fd 100644 --- a/crates/ruff_linter/src/rules/refurb/rules/delete_full_slice.rs +++ b/crates/ruff_linter/src/rules/refurb/rules/delete_full_slice.rs @@ -70,7 +70,7 @@ pub(crate) fn delete_full_slice(checker: &mut Checker, delete: &ast::StmtDelete) // Fix is only supported for single-target deletions. if delete.targets.len() == 1 { - let replacement = generate_method_call(&name.id, "clear", checker.generator()); + let replacement = generate_method_call(name.id.clone(), "clear", checker.generator()); diagnostic.set_fix(Fix::unsafe_edit(Edit::replacement( replacement, delete.start(), diff --git a/crates/ruff_linter/src/rules/refurb/rules/isinstance_type_none.rs b/crates/ruff_linter/src/rules/refurb/rules/isinstance_type_none.rs index 6ca6446262bcbd..4692674b0327aa 100644 --- a/crates/ruff_linter/src/rules/refurb/rules/isinstance_type_none.rs +++ b/crates/ruff_linter/src/rules/refurb/rules/isinstance_type_none.rs @@ -66,7 +66,7 @@ pub(crate) fn isinstance_type_none(checker: &mut Checker, call: &ast::ExprCall) }; let mut diagnostic = Diagnostic::new(IsinstanceTypeNone, call.range()); let replacement = - generate_none_identity_comparison(object_name, false, checker.generator()); + generate_none_identity_comparison(object_name.clone(), false, checker.generator()); diagnostic.set_fix(Fix::safe_edit(Edit::range_replacement( pad(replacement, call.range(), checker.locator()), call.range(), diff --git a/crates/ruff_linter/src/rules/refurb/rules/reimplemented_starmap.rs b/crates/ruff_linter/src/rules/refurb/rules/reimplemented_starmap.rs index 4cc61ba619393c..1d47662dc3e691 100644 --- a/crates/ruff_linter/src/rules/refurb/rules/reimplemented_starmap.rs +++ b/crates/ruff_linter/src/rules/refurb/rules/reimplemented_starmap.rs @@ -3,6 +3,7 @@ use ruff_diagnostics::{Diagnostic, Edit, Fix, FixAvailability, Violation}; use ruff_macros::{derive_message_formats, violation}; use ruff_python_ast::comparable::ComparableExpr; use ruff_python_ast::helpers::any_over_expr; +use ruff_python_ast::name::Name; use ruff_python_ast::{self as ast, Expr}; use ruff_text_size::{Ranged, TextRange}; @@ -165,7 +166,12 @@ pub(crate) fn reimplemented_starmap(checker: &mut Checker, target: &StarmapCandi // - For list and set comprehensions, we'd want to wrap it with `list` and `set` // correspondingly. let main_edit = Edit::range_replacement( - target.try_make_suggestion(starmap_name, &comprehension.iter, func, checker)?, + target.try_make_suggestion( + Name::from(starmap_name), + &comprehension.iter, + func, + checker, + )?, target.range(), ); Ok(Fix::safe_edits(import_edit, [main_edit])) @@ -231,7 +237,7 @@ impl StarmapCandidate<'_> { /// Try to produce a fix suggestion transforming this node into a call to `starmap`. pub(crate) fn try_make_suggestion( &self, - name: String, + name: Name, iter: &Expr, func: &Expr, checker: &Checker, @@ -260,7 +266,7 @@ impl StarmapCandidate<'_> { // ```python // list(itertools.starmap(foo, iter)) // ``` - try_construct_call(name, iter, func, "list", checker) + try_construct_call(name, iter, func, Name::new_static("list"), checker) } Self::SetComp(_) => { // For set comprehensions, we replace: @@ -272,7 +278,7 @@ impl StarmapCandidate<'_> { // ```python // set(itertools.starmap(foo, iter)) // ``` - try_construct_call(name, iter, func, "set", checker) + try_construct_call(name, iter, func, Name::new_static("set"), checker) } } } @@ -280,15 +286,15 @@ impl StarmapCandidate<'_> { /// Try constructing the call to `itertools.starmap` and wrapping it with the given builtin. fn try_construct_call( - name: String, + name: Name, iter: &Expr, func: &Expr, - builtin: &str, + builtin: Name, checker: &Checker, ) -> Result { // We can only do our fix if `builtin` identifier is still bound to // the built-in type. - if !checker.semantic().has_builtin_binding(builtin) { + if !checker.semantic().has_builtin_binding(&builtin) { bail!("Can't use built-in `{builtin}` constructor") } @@ -308,7 +314,7 @@ fn try_construct_call( } /// Construct the call to `itertools.starmap` for suggestion. -fn construct_starmap_call(starmap_binding: String, iter: &Expr, func: &Expr) -> ast::ExprCall { +fn construct_starmap_call(starmap_binding: Name, iter: &Expr, func: &Expr) -> ast::ExprCall { let starmap = ast::ExprName { id: starmap_binding, ctx: ast::ExprContext::Load, @@ -326,9 +332,9 @@ fn construct_starmap_call(starmap_binding: String, iter: &Expr, func: &Expr) -> } /// Wrap given function call with yet another call. -fn wrap_with_call_to(call: ast::ExprCall, func_name: &str) -> ast::ExprCall { +fn wrap_with_call_to(call: ast::ExprCall, func_name: Name) -> ast::ExprCall { let name = ast::ExprName { - id: func_name.to_string(), + id: func_name, ctx: ast::ExprContext::Load, range: TextRange::default(), }; diff --git a/crates/ruff_linter/src/rules/refurb/rules/slice_copy.rs b/crates/ruff_linter/src/rules/refurb/rules/slice_copy.rs index 3d4e6a203d8a13..776623bfd293e1 100644 --- a/crates/ruff_linter/src/rules/refurb/rules/slice_copy.rs +++ b/crates/ruff_linter/src/rules/refurb/rules/slice_copy.rs @@ -1,5 +1,6 @@ use ruff_diagnostics::{Diagnostic, Edit, Fix, FixAvailability, Violation}; use ruff_macros::{derive_message_formats, violation}; +use ruff_python_ast::name::Name; use ruff_python_ast::{self as ast, Expr}; use ruff_python_semantic::analyze::typing::is_list; use ruff_python_semantic::{Binding, SemanticModel}; @@ -61,7 +62,7 @@ pub(crate) fn slice_copy(checker: &mut Checker, subscript: &ast::ExprSubscript) return; }; let mut diagnostic = Diagnostic::new(SliceCopy, subscript.range()); - let replacement = generate_method_call(name, "copy", checker.generator()); + let replacement = generate_method_call(name.clone(), "copy", checker.generator()); diagnostic.set_fix(Fix::safe_edit(Edit::replacement( replacement, subscript.start(), @@ -74,7 +75,7 @@ pub(crate) fn slice_copy(checker: &mut Checker, subscript: &ast::ExprSubscript) fn match_list_full_slice<'a>( subscript: &'a ast::ExprSubscript, semantic: &SemanticModel, -) -> Option<&'a str> { +) -> Option<&'a Name> { // Check that it is `obj[:]`. if !matches!( subscript.slice.as_ref(), diff --git a/crates/ruff_linter/src/rules/refurb/rules/type_none_comparison.rs b/crates/ruff_linter/src/rules/refurb/rules/type_none_comparison.rs index fca0a99edc8e4a..6f714b99c6f4e7 100644 --- a/crates/ruff_linter/src/rules/refurb/rules/type_none_comparison.rs +++ b/crates/ruff_linter/src/rules/refurb/rules/type_none_comparison.rs @@ -1,5 +1,6 @@ use ruff_diagnostics::{Diagnostic, Edit, Fix, FixAvailability, Violation}; use ruff_macros::{derive_message_formats, violation}; +use ruff_python_ast::name::Name; use ruff_python_ast::{self as ast, CmpOp, Expr}; use ruff_python_semantic::SemanticModel; use ruff_text_size::Ranged; @@ -33,7 +34,7 @@ use crate::rules::refurb::helpers::generate_none_identity_comparison; /// - [Python documentation: Identity comparisons](https://docs.python.org/3/reference/expressions.html#is-not) #[violation] pub struct TypeNoneComparison { - object: String, + object: Name, comparison: Comparison, } @@ -94,14 +95,14 @@ pub(crate) fn type_none_comparison(checker: &mut Checker, compare: &ast::ExprCom // Get the name of the other object (or `None` if both were `None`). let other_arg_name = match other_arg { - Expr::Name(ast::ExprName { id, .. }) => id.as_str(), - Expr::NoneLiteral { .. } => "None", + Expr::Name(ast::ExprName { id, .. }) => id.clone(), + Expr::NoneLiteral { .. } => Name::new_static("None"), _ => return, }; let mut diagnostic = Diagnostic::new( TypeNoneComparison { - object: other_arg_name.to_string(), + object: other_arg_name.clone(), comparison, }, compare.range(), diff --git a/crates/ruff_linter/src/rules/refurb/rules/unnecessary_enumerate.rs b/crates/ruff_linter/src/rules/refurb/rules/unnecessary_enumerate.rs index dc2a85a1207d33..5455233b8fec0f 100644 --- a/crates/ruff_linter/src/rules/refurb/rules/unnecessary_enumerate.rs +++ b/crates/ruff_linter/src/rules/refurb/rules/unnecessary_enumerate.rs @@ -3,6 +3,7 @@ use std::fmt; use ruff_diagnostics::{Diagnostic, Edit, Fix, FixAvailability, Violation}; use ruff_macros::{derive_message_formats, violation}; use ruff_python_ast as ast; +use ruff_python_ast::name::Name; use ruff_python_ast::{Arguments, Expr, Int}; use ruff_python_codegen::Generator; use ruff_python_semantic::analyze::typing::{is_dict, is_list, is_set, is_tuple}; @@ -189,7 +190,7 @@ pub(crate) fn unnecessary_enumerate(checker: &mut Checker, stmt_for: &ast::StmtF ) }) { let replace_iter = Edit::range_replacement( - generate_range_len_call(&sequence.id, checker.generator()), + generate_range_len_call(sequence.id.clone(), checker.generator()), stmt_for.iter.range(), ); @@ -229,10 +230,10 @@ impl fmt::Display for EnumerateSubset { /// Format a code snippet to call `range(len(name))`, where `name` is the given /// sequence name. -fn generate_range_len_call(name: &str, generator: Generator) -> String { +fn generate_range_len_call(name: Name, generator: Generator) -> String { // Construct `name`. let var = ast::ExprName { - id: name.to_string(), + id: name, ctx: ast::ExprContext::Load, range: TextRange::default(), }; @@ -240,7 +241,7 @@ fn generate_range_len_call(name: &str, generator: Generator) -> String { let len = ast::ExprCall { func: Box::new( ast::ExprName { - id: "len".to_string(), + id: Name::new_static("len"), ctx: ast::ExprContext::Load, range: TextRange::default(), } @@ -257,7 +258,7 @@ fn generate_range_len_call(name: &str, generator: Generator) -> String { let range = ast::ExprCall { func: Box::new( ast::ExprName { - id: "range".to_string(), + id: Name::new_static("range"), ctx: ast::ExprContext::Load, range: TextRange::default(), } diff --git a/crates/ruff_linter/src/rules/ruff/rules/implicit_optional.rs b/crates/ruff_linter/src/rules/ruff/rules/implicit_optional.rs index 844bc71a9c9760..8fd1769d72cd72 100644 --- a/crates/ruff_linter/src/rules/ruff/rules/implicit_optional.rs +++ b/crates/ruff_linter/src/rules/ruff/rules/implicit_optional.rs @@ -5,6 +5,7 @@ use anyhow::Result; use ruff_diagnostics::{Diagnostic, Edit, Fix, FixAvailability, Violation}; use ruff_macros::{derive_message_formats, violation}; +use ruff_python_ast::name::Name; use ruff_python_ast::{self as ast, Expr, Operator, ParameterWithDefault, Parameters}; use ruff_python_parser::typing::parse_type_annotation; use ruff_text_size::{Ranged, TextRange}; @@ -145,7 +146,7 @@ fn generate_fix(checker: &Checker, conversion_type: ConversionType, expr: &Expr) let new_expr = Expr::Subscript(ast::ExprSubscript { range: TextRange::default(), value: Box::new(Expr::Name(ast::ExprName { - id: binding, + id: Name::new(binding), ctx: ast::ExprContext::Store, range: TextRange::default(), })), diff --git a/crates/ruff_linter/src/rules/ruff/rules/mutable_fromkeys_value.rs b/crates/ruff_linter/src/rules/ruff/rules/mutable_fromkeys_value.rs index 6cea64454b89ff..2a06f9d9936912 100644 --- a/crates/ruff_linter/src/rules/ruff/rules/mutable_fromkeys_value.rs +++ b/crates/ruff_linter/src/rules/ruff/rules/mutable_fromkeys_value.rs @@ -1,5 +1,6 @@ use ruff_diagnostics::{Diagnostic, Edit, Fix, FixAvailability, Violation}; use ruff_macros::{derive_message_formats, violation}; +use ruff_python_ast::name::Name; use ruff_python_ast::{self as ast, Expr}; use ruff_python_semantic::analyze::typing::is_mutable_expr; @@ -99,7 +100,7 @@ pub(crate) fn mutable_fromkeys_value(checker: &mut Checker, call: &ast::ExprCall fn generate_dict_comprehension(keys: &Expr, value: &Expr, generator: Generator) -> String { // Construct `key`. let key = ast::ExprName { - id: "key".to_string(), + id: Name::new_static("key"), ctx: ast::ExprContext::Load, range: TextRange::default(), }; diff --git a/crates/ruff_python_ast/Cargo.toml b/crates/ruff_python_ast/Cargo.toml index f187429ab1b273..62216f9c824ac7 100644 --- a/crates/ruff_python_ast/Cargo.toml +++ b/crates/ruff_python_ast/Cargo.toml @@ -13,6 +13,8 @@ license = { workspace = true } [lib] [dependencies] +ruff_cache = { workspace = true, optional = true } +ruff_macros = { workspace = true, optional = true } ruff_python_trivia = { workspace = true } ruff_source_file = { workspace = true } ruff_text_size = { workspace = true } @@ -23,10 +25,12 @@ is-macro = { workspace = true } itertools = { workspace = true } once_cell = { workspace = true } rustc-hash = { workspace = true } +schemars = { workspace = true, optional = true } serde = { workspace = true, optional = true } +smol_str = { workspace = true } [features] -serde = ["dep:serde", "ruff_text_size/serde"] +serde = ["dep:serde", "ruff_text_size/serde", "dep:ruff_cache", "smol_str/serde", "dep:ruff_macros", "dep:schemars"] [lints] workspace = true diff --git a/crates/ruff_python_ast/src/helpers.rs b/crates/ruff_python_ast/src/helpers.rs index 86e9d8c61b8b7b..6613bd9dd0bf1b 100644 --- a/crates/ruff_python_ast/src/helpers.rs +++ b/crates/ruff_python_ast/src/helpers.rs @@ -7,7 +7,7 @@ use ruff_python_trivia::{indentation_at_offset, CommentRanges, SimpleTokenKind, use ruff_source_file::Locator; use ruff_text_size::{Ranged, TextLen, TextRange, TextSize}; -use crate::name::{QualifiedName, QualifiedNameBuilder}; +use crate::name::{Name, QualifiedName, QualifiedNameBuilder}; use crate::parenthesize::parenthesized_range; use crate::statement_visitor::StatementVisitor; use crate::visitor::Visitor; @@ -1403,7 +1403,7 @@ pub fn pep_604_union(elts: &[Expr]) -> Expr { } /// Format the expression as a `typing.Optional`-style optional. -pub fn typing_optional(elt: Expr, binding: String) -> Expr { +pub fn typing_optional(elt: Expr, binding: Name) -> Expr { Expr::Subscript(ast::ExprSubscript { value: Box::new(Expr::Name(ast::ExprName { id: binding, @@ -1417,8 +1417,8 @@ pub fn typing_optional(elt: Expr, binding: String) -> Expr { } /// Format the expressions as a `typing.Union`-style union. -pub fn typing_union(elts: &[Expr], binding: String) -> Expr { - fn tuple(elts: &[Expr], binding: String) -> Expr { +pub fn typing_union(elts: &[Expr], binding: Name) -> Expr { + fn tuple(elts: &[Expr], binding: Name) -> Expr { match elts { [] => Expr::Tuple(ast::ExprTuple { elts: vec![], diff --git a/crates/ruff_python_ast/src/name.rs b/crates/ruff_python_ast/src/name.rs index 1fee147b2872f7..714053f140ca04 100644 --- a/crates/ruff_python_ast/src/name.rs +++ b/crates/ruff_python_ast/src/name.rs @@ -1,8 +1,164 @@ +use crate::{nodes, Expr}; +use std::borrow::Borrow; use std::fmt::{Debug, Display, Formatter, Write}; use std::hash::{Hash, Hasher}; use std::ops::Deref; -use crate::{nodes, Expr}; +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[cfg_attr( + feature = "serde", + derive(serde::Serialize, serde::Deserialize, ruff_macros::CacheKey,) +)] +pub struct Name(smol_str::SmolStr); + +impl Name { + #[inline] + pub fn empty() -> Self { + Self(smol_str::SmolStr::new_inline("")) + } + + #[inline] + pub fn new(name: impl AsRef) -> Self { + Self(smol_str::SmolStr::new(name)) + } + + #[inline] + pub fn new_static(name: &'static str) -> Self { + Self(smol_str::SmolStr::new_static(name)) + } + + pub fn as_str(&self) -> &str { + self.0.as_str() + } +} + +impl AsRef for Name { + #[inline] + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl Deref for Name { + type Target = str; + + #[inline] + fn deref(&self) -> &Self::Target { + self.as_str() + } +} + +impl Borrow for Name { + #[inline(always)] + fn borrow(&self) -> &str { + self.as_str() + } +} + +impl From for Name +where + T: Into, +{ + fn from(value: T) -> Self { + Self(value.into()) + } +} + +impl FromIterator for Name { + fn from_iter>(iter: I) -> Self { + Self(iter.into_iter().collect()) + } +} + +impl std::fmt::Display for Name { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + +impl PartialEq for Name { + #[inline] + fn eq(&self, other: &str) -> bool { + self.as_str() == other + } +} + +impl PartialEq for str { + #[inline] + fn eq(&self, other: &Name) -> bool { + other == self + } +} + +impl PartialEq<&str> for Name { + #[inline] + fn eq(&self, other: &&str) -> bool { + self.as_str() == *other + } +} + +impl PartialEq for &str { + #[inline] + fn eq(&self, other: &Name) -> bool { + other == self + } +} + +impl PartialEq for Name { + fn eq(&self, other: &String) -> bool { + self == other.as_str() + } +} + +impl PartialEq for String { + #[inline] + fn eq(&self, other: &Name) -> bool { + other == self + } +} + +impl PartialEq<&String> for Name { + #[inline] + fn eq(&self, other: &&String) -> bool { + self.as_str() == *other + } +} + +impl PartialEq for &String { + #[inline] + fn eq(&self, other: &Name) -> bool { + other == self + } +} + +#[cfg(feature = "serde")] +impl schemars::JsonSchema for Name { + fn is_referenceable() -> bool { + String::is_referenceable() + } + + fn schema_name() -> String { + String::schema_name() + } + + fn schema_id() -> std::borrow::Cow<'static, str> { + String::schema_id() + } + + fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { + String::json_schema(gen) + } + + fn _schemars_private_non_optional_json_schema( + gen: &mut schemars::gen::SchemaGenerator, + ) -> schemars::schema::Schema { + String::_schemars_private_non_optional_json_schema(gen) + } + + fn _schemars_private_is_option() -> bool { + String::_schemars_private_is_option() + } +} /// A representation of a qualified name, like `typing.List`. #[derive(Debug, Clone, PartialEq, Eq, Hash)] diff --git a/crates/ruff_python_ast/src/nodes.rs b/crates/ruff_python_ast/src/nodes.rs index 294dc1186e171c..03b5e26ba7bcd5 100644 --- a/crates/ruff_python_ast/src/nodes.rs +++ b/crates/ruff_python_ast/src/nodes.rs @@ -12,6 +12,7 @@ use itertools::Itertools; use ruff_text_size::{Ranged, TextLen, TextRange, TextSize}; +use crate::name::Name; use crate::{ int, str::Quote, @@ -1762,12 +1763,6 @@ impl PartialEq for StringLiteralValue { } } -impl PartialEq for StringLiteralValue { - fn eq(&self, other: &String) -> bool { - self == other.as_str() - } -} - impl fmt::Display for StringLiteralValue { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.to_str()) @@ -2740,7 +2735,7 @@ impl From for Expr { #[derive(Clone, Debug, PartialEq)] pub struct ExprName { pub range: TextRange, - pub id: String, + pub id: Name, pub ctx: ExprContext, } @@ -3763,13 +3758,13 @@ impl IpyEscapeKind { /// ``` #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub struct Identifier { - pub id: String, + pub id: Name, pub range: TextRange, } impl Identifier { #[inline] - pub fn new(id: impl Into, range: TextRange) -> Self { + pub fn new(id: impl Into, range: TextRange) -> Self { Self { id: id.into(), range, @@ -3817,22 +3812,15 @@ impl AsRef for Identifier { } } -impl AsRef for Identifier { - #[inline] - fn as_ref(&self) -> &String { - &self.id - } -} - impl std::fmt::Display for Identifier { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(&self.id, f) } } -impl From for String { +impl From for Name { #[inline] - fn from(identifier: Identifier) -> String { + fn from(identifier: Identifier) -> Name { identifier.id } } diff --git a/crates/ruff_python_literal/Cargo.toml b/crates/ruff_python_literal/Cargo.toml index 3e2ffb09147b1f..3de88f51080bcf 100644 --- a/crates/ruff_python_literal/Cargo.toml +++ b/crates/ruff_python_literal/Cargo.toml @@ -19,6 +19,7 @@ ruff_python_ast = { workspace = true } bitflags = { workspace = true } itertools = { workspace = true } +smol_str = { workspace = true } unic-ucd-category = { workspace = true } [dev-dependencies] diff --git a/crates/ruff_python_parser/src/lexer.rs b/crates/ruff_python_parser/src/lexer.rs index 1aeafd3487923b..d407ab357e68f6 100644 --- a/crates/ruff_python_parser/src/lexer.rs +++ b/crates/ruff_python_parser/src/lexer.rs @@ -12,6 +12,7 @@ use std::str::FromStr; use unicode_ident::{is_xid_continue, is_xid_start}; use unicode_normalization::UnicodeNormalization; +use ruff_python_ast::name::Name; use ruff_python_ast::{Int, IpyEscapeKind, StringFlags}; use ruff_python_trivia::is_python_whitespace; use ruff_text_size::{TextLen, TextRange, TextSize}; @@ -643,7 +644,7 @@ impl<'src> Lexer<'src> { let text = self.token_text(); if !is_ascii { - self.current_value = TokenValue::Name(text.nfkc().collect::().into_boxed_str()); + self.current_value = TokenValue::Name(text.nfkc().collect::()); return TokenKind::Name; } @@ -687,7 +688,7 @@ impl<'src> Lexer<'src> { "with" => TokenKind::With, "yield" => TokenKind::Yield, _ => { - self.current_value = TokenValue::Name(text.to_string().into_boxed_str()); + self.current_value = TokenValue::Name(Name::new(text)); TokenKind::Name } } diff --git a/crates/ruff_python_parser/src/parser/expression.rs b/crates/ruff_python_parser/src/parser/expression.rs index 52788dd98114ad..61060f9e34ce56 100644 --- a/crates/ruff_python_parser/src/parser/expression.rs +++ b/crates/ruff_python_parser/src/parser/expression.rs @@ -4,6 +4,7 @@ use std::ops::Deref; use bitflags::bitflags; use rustc_hash::{FxBuildHasher, FxHashSet}; +use ruff_python_ast::name::Name; use ruff_python_ast::{ self as ast, BoolOp, CmpOp, ConversionFlag, Expr, ExprContext, FStringElement, FStringElements, IpyEscapeKind, Number, Operator, UnaryOp, @@ -477,14 +478,11 @@ impl<'src> Parser<'src> { let TokenValue::Name(name) = self.bump_value(TokenKind::Name) else { unreachable!(); }; - return ast::Identifier { - id: name.to_string(), - range, - }; + return ast::Identifier { id: name, range }; } if self.current_token_kind().is_soft_keyword() { - let id = self.src_text(range).to_string(); + let id = Name::new(self.src_text(range)); self.bump_soft_keyword_as_name(); return ast::Identifier { id, range }; } @@ -499,7 +497,7 @@ impl<'src> Parser<'src> { range, ); - let id = self.src_text(range).to_string(); + let id = Name::new(self.src_text(range)); self.bump_any(); ast::Identifier { id, range } } else { @@ -509,7 +507,7 @@ impl<'src> Parser<'src> { ); ast::Identifier { - id: String::new(), + id: Name::empty(), range: self.missing_node_range(), } } @@ -597,7 +595,7 @@ impl<'src> Parser<'src> { ); Expr::Name(ast::ExprName { range: self.missing_node_range(), - id: String::new(), + id: Name::empty(), ctx: ExprContext::Invalid, }) } @@ -719,7 +717,7 @@ impl<'src> Parser<'src> { &parsed_expr, ); ast::Identifier { - id: String::new(), + id: Name::empty(), range: parsed_expr.range(), } }; @@ -793,7 +791,7 @@ impl<'src> Parser<'src> { value: Box::new(value), slice: Box::new(Expr::Name(ast::ExprName { range: slice_range, - id: String::new(), + id: Name::empty(), ctx: ExprContext::Invalid, })), ctx: ExprContext::Load, diff --git a/crates/ruff_python_parser/src/parser/pattern.rs b/crates/ruff_python_parser/src/parser/pattern.rs index 88079c60ed11da..0685913e3b655a 100644 --- a/crates/ruff_python_parser/src/parser/pattern.rs +++ b/crates/ruff_python_parser/src/parser/pattern.rs @@ -1,3 +1,4 @@ +use ruff_python_ast::name::Name; use ruff_python_ast::{self as ast, Expr, ExprContext, Number, Operator, Pattern, Singleton}; use ruff_text_size::{Ranged, TextSize}; @@ -510,7 +511,7 @@ impl<'src> Parser<'src> { ); let invalid_node = Expr::Name(ast::ExprName { range: self.missing_node_range(), - id: String::new(), + id: Name::empty(), ctx: ExprContext::Invalid, }); Pattern::MatchValue(ast::PatternMatchValue { @@ -616,7 +617,7 @@ impl<'src> Parser<'src> { } else { Box::new(Expr::Name(ast::ExprName { range: ident.range(), - id: String::new(), + id: Name::empty(), ctx: ExprContext::Invalid, })) } @@ -667,7 +668,7 @@ impl<'src> Parser<'src> { &pattern, ); ast::Identifier { - id: String::new(), + id: Name::empty(), range: parser.missing_node_range(), } }; diff --git a/crates/ruff_python_parser/src/parser/recovery.rs b/crates/ruff_python_parser/src/parser/recovery.rs index 8687b8c95f5eb1..1dd4489a8c085d 100644 --- a/crates/ruff_python_parser/src/parser/recovery.rs +++ b/crates/ruff_python_parser/src/parser/recovery.rs @@ -1,3 +1,4 @@ +use ruff_python_ast::name::Name; use ruff_python_ast::{self as ast, Expr, ExprContext, Pattern}; use ruff_text_size::{Ranged, TextLen, TextRange}; @@ -110,7 +111,7 @@ pub(super) fn pattern_to_expr(pattern: Pattern) -> Expr { range, value: Box::new(Expr::Name(ast::ExprName { range: TextRange::new(range.end() - "_".text_len(), range.end()), - id: "_".to_string(), + id: Name::new_static("_"), ctx: ExprContext::Store, })), ctx: ExprContext::Store, @@ -124,7 +125,7 @@ pub(super) fn pattern_to_expr(pattern: Pattern) -> Expr { }) => match (pattern, name) { (Some(_), Some(_)) => Expr::Name(ast::ExprName { range, - id: String::new(), + id: Name::empty(), ctx: ExprContext::Invalid, }), (Some(pattern), None) => pattern_to_expr(*pattern), @@ -135,7 +136,7 @@ pub(super) fn pattern_to_expr(pattern: Pattern) -> Expr { }), (None, None) => Expr::Name(ast::ExprName { range, - id: "_".to_string(), + id: Name::new_static("_"), ctx: ExprContext::Store, }), }, diff --git a/crates/ruff_python_parser/src/parser/snapshots/ruff_python_parser__parser__tests__expr_mode_valid_syntax.snap b/crates/ruff_python_parser/src/parser/snapshots/ruff_python_parser__parser__tests__expr_mode_valid_syntax.snap index 3f8f1ed6de3fa5..c904ec641f0115 100644 --- a/crates/ruff_python_parser/src/parser/snapshots/ruff_python_parser__parser__tests__expr_mode_valid_syntax.snap +++ b/crates/ruff_python_parser/src/parser/snapshots/ruff_python_parser__parser__tests__expr_mode_valid_syntax.snap @@ -1,11 +1,13 @@ --- source: crates/ruff_python_parser/src/parser/tests.rs -expression: expr +expression: parsed.expr() --- Name( ExprName { range: 0..5, - id: "first", + id: Name( + "first", + ), ctx: Load, }, ) diff --git a/crates/ruff_python_parser/src/parser/snapshots/ruff_python_parser__parser__tests__ipython_escape_commands.snap b/crates/ruff_python_parser/src/parser/snapshots/ruff_python_parser__parser__tests__ipython_escape_commands.snap index cc658cadf8fed4..df0978a48b6344 100644 --- a/crates/ruff_python_parser/src/parser/snapshots/ruff_python_parser__parser__tests__ipython_escape_commands.snap +++ b/crates/ruff_python_parser/src/parser/snapshots/ruff_python_parser__parser__tests__ipython_escape_commands.snap @@ -1,6 +1,6 @@ --- source: crates/ruff_python_parser/src/parser/tests.rs -expression: parse_ast +expression: parsed.syntax() --- Module( ModModule { @@ -15,7 +15,9 @@ Module( left: Name( ExprName { range: 27..28, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -23,7 +25,9 @@ Module( right: Name( ExprName { range: 39..40, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -128,7 +132,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 570..573, }, type_params: None, @@ -152,7 +158,9 @@ Module( left: Name( ExprName { range: 598..599, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -163,7 +171,9 @@ Module( Name( ExprName { range: 619..620, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -204,7 +214,9 @@ Module( target: Name( ExprName { range: 715..716, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), @@ -214,7 +226,9 @@ Module( func: Name( ExprName { range: 720..725, - id: "range", + id: Name( + "range", + ), ctx: Load, }, ), @@ -253,7 +267,9 @@ Module( Name( ExprName { range: 739..741, - id: "p1", + id: Name( + "p1", + ), ctx: Store, }, ), @@ -273,14 +289,18 @@ Module( target: Name( ExprName { range: 749..751, - id: "p2", + id: Name( + "p2", + ), ctx: Store, }, ), annotation: Name( ExprName { range: 753..756, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -303,7 +323,9 @@ Module( Name( ExprName { range: 764..767, - id: "foo", + id: Name( + "foo", + ), ctx: Store, }, ), @@ -331,7 +353,9 @@ Module( Name( ExprName { range: 792..795, - id: "foo", + id: Name( + "foo", + ), ctx: Store, }, ), diff --git a/crates/ruff_python_parser/src/parser/snapshots/ruff_python_parser__parser__tests__unicode_aliases.snap b/crates/ruff_python_parser/src/parser/snapshots/ruff_python_parser__parser__tests__unicode_aliases.snap index 67b838399a31e8..10bf667213b45b 100644 --- a/crates/ruff_python_parser/src/parser/snapshots/ruff_python_parser__parser__tests__unicode_aliases.snap +++ b/crates/ruff_python_parser/src/parser/snapshots/ruff_python_parser__parser__tests__unicode_aliases.snap @@ -1,6 +1,6 @@ --- source: crates/ruff_python_parser/src/parser/tests.rs -expression: parse_ast +expression: suite --- [ Assign( @@ -10,7 +10,9 @@ expression: parse_ast Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), diff --git a/crates/ruff_python_parser/src/parser/statement.rs b/crates/ruff_python_parser/src/parser/statement.rs index 0ae5a02dce139c..d09183b8eeba23 100644 --- a/crates/ruff_python_parser/src/parser/statement.rs +++ b/crates/ruff_python_parser/src/parser/statement.rs @@ -2,6 +2,7 @@ use std::fmt::Display; use rustc_hash::{FxBuildHasher, FxHashSet}; +use ruff_python_ast::name::Name; use ruff_python_ast::{ self as ast, ExceptHandler, Expr, ExprContext, IpyEscapeKind, Operator, Stmt, WithItem, }; @@ -669,7 +670,7 @@ impl<'src> Parser<'src> { fn parse_dotted_name(&mut self) -> ast::Identifier { let start = self.node_start(); - let mut dotted_name = self.parse_identifier().id; + let mut dotted_name = self.parse_identifier().id.to_string(); let mut progress = ParserProgress::default(); while self.eat(TokenKind::Dot) { @@ -686,7 +687,7 @@ impl<'src> Parser<'src> { // import a.b.c // import a . b . c ast::Identifier { - id: dotted_name, + id: Name::new(dotted_name), range: self.node_range(start), } } diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__assignment.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__assignment.snap index 248f1eab3feb03..f8eb11d6001c74 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__assignment.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__assignment.snap @@ -7,7 +7,9 @@ expression: lex_source(source) [ ( Name( - "a_variable", + Name( + "a_variable", + ), ), 0..10, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__bom.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__bom.snap index ea400d2e3b47c0..918a4555c68e56 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__bom.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__bom.snap @@ -7,7 +7,9 @@ expression: lex_source(source) [ ( Name( - "x", + Name( + "x", + ), ), 3..4, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__bom_with_offset.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__bom_with_offset.snap index 9ae6aaa3cfa241..5bef9550c990c4 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__bom_with_offset.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__bom_with_offset.snap @@ -7,7 +7,9 @@ expression: "lex_source_with_offset(source, TextSize::new(7))" [ ( Name( - "y", + Name( + "y", + ), ), 7..8, ), @@ -17,7 +19,9 @@ expression: "lex_source_with_offset(source, TextSize::new(7))" ), ( Name( - "z", + Name( + "z", + ), ), 11..12, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__bom_with_offset_edge.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__bom_with_offset_edge.snap index a6e704c18f3fc7..36f58df19dcb73 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__bom_with_offset_edge.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__bom_with_offset_edge.snap @@ -7,7 +7,9 @@ expression: "lex_source_with_offset(source, TextSize::new(11))" [ ( Name( - "z", + Name( + "z", + ), ), 11..12, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__dedent_after_whitespace.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__dedent_after_whitespace.snap index 698e077bffe759..96fb9bfd20a3a6 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__dedent_after_whitespace.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__dedent_after_whitespace.snap @@ -11,7 +11,9 @@ expression: lex_source(source) ), ( Name( - "first", + Name( + "first", + ), ), 3..8, ), @@ -33,7 +35,9 @@ expression: lex_source(source) ), ( Name( - "second", + Name( + "second", + ), ), 17..23, ), @@ -63,7 +67,9 @@ expression: lex_source(source) ), ( Name( - "foo", + Name( + "foo", + ), ), 42..45, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_mac_eol.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_mac_eol.snap index f877c10beee725..6cf9473ec772d0 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_mac_eol.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_mac_eol.snap @@ -11,7 +11,9 @@ expression: double_dedent_with_eol(MAC_EOL) ), ( Name( - "foo", + Name( + "foo", + ), ), 4..7, ), @@ -41,7 +43,9 @@ expression: double_dedent_with_eol(MAC_EOL) ), ( Name( - "x", + Name( + "x", + ), ), 15..16, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_tabs_mac_eol.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_tabs_mac_eol.snap index 7c2082732f60dc..9e1d2fbdc66af8 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_tabs_mac_eol.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_tabs_mac_eol.snap @@ -11,7 +11,9 @@ expression: double_dedent_with_tabs_eol(MAC_EOL) ), ( Name( - "foo", + Name( + "foo", + ), ), 4..7, ), @@ -41,7 +43,9 @@ expression: double_dedent_with_tabs_eol(MAC_EOL) ), ( Name( - "x", + Name( + "x", + ), ), 15..16, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_tabs_unix_eol.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_tabs_unix_eol.snap index 214b1734108d3c..3f1d77433fc522 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_tabs_unix_eol.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_tabs_unix_eol.snap @@ -11,7 +11,9 @@ expression: double_dedent_with_tabs_eol(UNIX_EOL) ), ( Name( - "foo", + Name( + "foo", + ), ), 4..7, ), @@ -41,7 +43,9 @@ expression: double_dedent_with_tabs_eol(UNIX_EOL) ), ( Name( - "x", + Name( + "x", + ), ), 15..16, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_tabs_windows_eol.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_tabs_windows_eol.snap index 79bb8e6f48e9de..a6a73e5fcd2411 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_tabs_windows_eol.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_tabs_windows_eol.snap @@ -11,7 +11,9 @@ expression: double_dedent_with_tabs_eol(WINDOWS_EOL) ), ( Name( - "foo", + Name( + "foo", + ), ), 4..7, ), @@ -41,7 +43,9 @@ expression: double_dedent_with_tabs_eol(WINDOWS_EOL) ), ( Name( - "x", + Name( + "x", + ), ), 16..17, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_unix_eol.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_unix_eol.snap index a01a3dd2529573..650539d808b12a 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_unix_eol.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_unix_eol.snap @@ -11,7 +11,9 @@ expression: double_dedent_with_eol(UNIX_EOL) ), ( Name( - "foo", + Name( + "foo", + ), ), 4..7, ), @@ -41,7 +43,9 @@ expression: double_dedent_with_eol(UNIX_EOL) ), ( Name( - "x", + Name( + "x", + ), ), 15..16, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_windows_eol.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_windows_eol.snap index 2f84b6b91a9d23..d63280fed292c0 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_windows_eol.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__double_dedent_with_windows_eol.snap @@ -11,7 +11,9 @@ expression: double_dedent_with_eol(WINDOWS_EOL) ), ( Name( - "foo", + Name( + "foo", + ), ), 4..7, ), @@ -41,7 +43,9 @@ expression: double_dedent_with_eol(WINDOWS_EOL) ), ( Name( - "x", + Name( + "x", + ), ), 16..17, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring.snap index cd6778a73adadc..fcc9dc71264ae2 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring.snap @@ -27,7 +27,9 @@ expression: lex_source(source) ), ( Name( - "foo", + Name( + "foo", + ), ), 10..13, ), @@ -50,7 +52,9 @@ expression: lex_source(source) ), ( Name( - "bar", + Name( + "bar", + ), ), 28..31, ), @@ -73,7 +77,9 @@ expression: lex_source(source) ), ( Name( - "three", + Name( + "three", + ), ), 36..41, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_comments.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_comments.snap index 8eb4842ebb8e95..15b3ebacae6e61 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_comments.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_comments.snap @@ -35,7 +35,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 39..40, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_conversion.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_conversion.snap index bcda1c925b961f..e92a29d3769e8e 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_conversion.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_conversion.snap @@ -18,7 +18,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 3..4, ), @@ -28,7 +30,9 @@ expression: lex_source(source) ), ( Name( - "s", + Name( + "s", + ), ), 5..6, ), @@ -51,7 +55,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 9..10, ), @@ -65,7 +71,9 @@ expression: lex_source(source) ), ( Name( - "r", + Name( + "r", + ), ), 12..13, ), @@ -88,7 +96,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 16..17, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_escape.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_escape.snap index b581901ed9421c..f577f5f19b79c4 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_escape.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_escape.snap @@ -27,7 +27,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 4..5, ), @@ -50,7 +52,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 10..11, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_escape_braces.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_escape_braces.snap index d8d007d560fb1d..168833b16a7f73 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_escape_braces.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_escape_braces.snap @@ -27,7 +27,9 @@ expression: lex_source(source) ), ( Name( - "foo", + Name( + "foo", + ), ), 4..7, ), @@ -64,7 +66,9 @@ expression: lex_source(source) ), ( Name( - "foo", + Name( + "foo", + ), ), 15..18, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_escape_raw.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_escape_raw.snap index e92513e5bb5966..c8a52d0b3120f2 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_escape_raw.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_escape_raw.snap @@ -27,7 +27,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 5..6, ), @@ -50,7 +52,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 11..12, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_expression_multiline.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_expression_multiline.snap index fef1db4f33e69d..18f24acc50aabf 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_expression_multiline.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_expression_multiline.snap @@ -31,7 +31,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 14..15, ), @@ -49,7 +51,9 @@ expression: lex_source(source) ), ( Name( - "y", + Name( + "y", + ), ), 38..39, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_multiline.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_multiline.snap index 0393d768653836..f34e168bad840b 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_multiline.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_multiline.snap @@ -93,7 +93,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 81..82, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_named_unicode_raw.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_named_unicode_raw.snap index 760a7153741bbd..f9accb39531ea8 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_named_unicode_raw.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_named_unicode_raw.snap @@ -27,7 +27,9 @@ expression: lex_source(source) ), ( Name( - "BULLET", + Name( + "BULLET", + ), ), 6..12, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_nested.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_nested.snap index 3e82eadf77de64..7ed558a95e4265 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_nested.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_nested.snap @@ -47,7 +47,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 14..15, ), @@ -68,7 +70,9 @@ expression: lex_source(source) ), ( Name( - "wow", + Name( + "wow", + ), ), 21..24, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_with_format_spec.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_with_format_spec.snap index 8157de849c983d..f6e6c96d05b3ae 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_with_format_spec.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_with_format_spec.snap @@ -18,7 +18,9 @@ expression: lex_source(source) ), ( Name( - "foo", + Name( + "foo", + ), ), 3..6, ), @@ -45,7 +47,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 10..11, ), @@ -59,7 +63,9 @@ expression: lex_source(source) ), ( Name( - "s", + Name( + "s", + ), ), 13..14, ), @@ -95,7 +101,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 21..22, ), @@ -118,7 +126,9 @@ expression: lex_source(source) ), ( Name( - "y", + Name( + "y", + ), ), 25..26, ), @@ -222,7 +232,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 46..47, ), @@ -254,7 +266,9 @@ expression: lex_source(source) ), ( Name( - "pop", + Name( + "pop", + ), ), 53..56, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_with_ipy_escape_command.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_with_ipy_escape_command.snap index 7c749c92e77821..72335680e1e3f4 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_with_ipy_escape_command.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_with_ipy_escape_command.snap @@ -31,7 +31,9 @@ expression: lex_source(source) ), ( Name( - "pwd", + Name( + "pwd", + ), ), 8..11, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_with_lambda_expression.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_with_lambda_expression.snap index 5fde2adc2c307e..cdd35be3c2f251 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_with_lambda_expression.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_with_lambda_expression.snap @@ -22,7 +22,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 10..11, ), @@ -36,7 +38,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 13..14, ), @@ -80,7 +84,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 29..30, ), @@ -94,7 +100,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 32..33, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_with_multiline_format_spec.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_with_multiline_format_spec.snap index 4e46987c1242e6..d0055a4e095eed 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_with_multiline_format_spec.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_with_multiline_format_spec.snap @@ -31,7 +31,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 12..13, ), @@ -98,7 +100,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 35..36, ), @@ -165,7 +169,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 78..79, ), @@ -236,7 +242,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 97..98, ), @@ -259,7 +267,9 @@ expression: lex_source(source) ), ( Name( - "b", + Name( + "b", + ), ), 109..110, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_with_named_expression.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_with_named_expression.snap index 900373f25c231e..ceee555a15a2c1 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_with_named_expression.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_with_named_expression.snap @@ -18,7 +18,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 3..4, ), @@ -58,7 +60,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 12..13, ), @@ -95,7 +99,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 21..22, ), @@ -109,7 +115,9 @@ expression: lex_source(source) ), ( Name( - "y", + Name( + "y", + ), ), 24..25, ), @@ -150,7 +158,9 @@ expression: lex_source(source) ), ( Name( - "x", + Name( + "x", + ), ), 34..35, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__indentation_with_mac_eol.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__indentation_with_mac_eol.snap index be043b9151f15e..ebb99919032b4b 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__indentation_with_mac_eol.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__indentation_with_mac_eol.snap @@ -11,7 +11,9 @@ expression: indentation_with_eol(MAC_EOL) ), ( Name( - "foo", + Name( + "foo", + ), ), 4..7, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__indentation_with_unix_eol.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__indentation_with_unix_eol.snap index 7f92d8a8df78a3..ecaae5574432b9 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__indentation_with_unix_eol.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__indentation_with_unix_eol.snap @@ -11,7 +11,9 @@ expression: indentation_with_eol(UNIX_EOL) ), ( Name( - "foo", + Name( + "foo", + ), ), 4..7, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__indentation_with_windows_eol.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__indentation_with_windows_eol.snap index e7c4cdb3f05193..e62ee912c4d21d 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__indentation_with_windows_eol.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__indentation_with_windows_eol.snap @@ -11,7 +11,9 @@ expression: indentation_with_eol(WINDOWS_EOL) ), ( Name( - "foo", + Name( + "foo", + ), ), 4..7, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__ipython_escape_command_assignment.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__ipython_escape_command_assignment.snap index 32a7e56eea8ef0..adfa4c52b3cfb3 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__ipython_escape_command_assignment.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__ipython_escape_command_assignment.snap @@ -7,7 +7,9 @@ expression: lex_jupyter_source(source) [ ( Name( - "pwd", + Name( + "pwd", + ), ), 0..3, ), @@ -28,7 +30,9 @@ expression: lex_jupyter_source(source) ), ( Name( - "foo", + Name( + "foo", + ), ), 11..14, ), @@ -49,7 +53,9 @@ expression: lex_jupyter_source(source) ), ( Name( - "bar", + Name( + "bar", + ), ), 31..34, ), @@ -70,7 +76,9 @@ expression: lex_jupyter_source(source) ), ( Name( - "baz", + Name( + "baz", + ), ), 51..54, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__match_softkeyword_in_notebook.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__match_softkeyword_in_notebook.snap index d56f39910dcec0..2743d4f1c93a15 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__match_softkeyword_in_notebook.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__match_softkeyword_in_notebook.snap @@ -11,7 +11,9 @@ expression: lex_jupyter_source(source) ), ( Name( - "foo", + Name( + "foo", + ), ), 6..9, ), @@ -33,7 +35,9 @@ expression: lex_jupyter_source(source) ), ( Name( - "bar", + Name( + "bar", + ), ), 20..23, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__newline_in_brackets_mac_eol.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__newline_in_brackets_mac_eol.snap index d167752f78baa3..dff62056415a26 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__newline_in_brackets_mac_eol.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__newline_in_brackets_mac_eol.snap @@ -7,7 +7,9 @@ expression: newline_in_brackets_eol(MAC_EOL) [ ( Name( - "x", + Name( + "x", + ), ), 0..1, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__newline_in_brackets_unix_eol.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__newline_in_brackets_unix_eol.snap index 6355d419f262ff..2b0a7d3617a4cb 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__newline_in_brackets_unix_eol.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__newline_in_brackets_unix_eol.snap @@ -7,7 +7,9 @@ expression: newline_in_brackets_eol(UNIX_EOL) [ ( Name( - "x", + Name( + "x", + ), ), 0..1, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__newline_in_brackets_windows_eol.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__newline_in_brackets_windows_eol.snap index cfcd1f7ea18f44..2571d2c42f1b69 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__newline_in_brackets_windows_eol.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__newline_in_brackets_windows_eol.snap @@ -7,7 +7,9 @@ expression: newline_in_brackets_eol(WINDOWS_EOL) [ ( Name( - "x", + Name( + "x", + ), ), 0..1, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__dont_panic_on_8_in_octal_escape.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__dont_panic_on_8_in_octal_escape.snap index afa779ea6dbc7d..f8c27e24b4fd74 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__dont_panic_on_8_in_octal_escape.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__dont_panic_on_8_in_octal_escape.snap @@ -1,6 +1,6 @@ --- source: crates/ruff_python_parser/src/string.rs -expression: parse_ast +expression: suite --- [ Assign( @@ -10,7 +10,9 @@ expression: parse_ast Name( ExprName { range: 0..4, - id: "bold", + id: Name( + "bold", + ), ctx: Store, }, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_constant_range.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_constant_range.snap index c4c27935f6aa96..74cfb5448f4b67 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_constant_range.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_constant_range.snap @@ -1,6 +1,6 @@ --- source: crates/ruff_python_parser/src/string.rs -expression: parse_ast +expression: suite --- [ Expr( @@ -27,7 +27,9 @@ expression: parse_ast expression: Name( ExprName { range: 6..9, - id: "bbb", + id: Name( + "bbb", + ), ctx: Load, }, ), @@ -48,7 +50,9 @@ expression: parse_ast expression: Name( ExprName { range: 14..17, - id: "ddd", + id: Name( + "ddd", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_escaped_character.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_escaped_character.snap index 430790e6db4944..c33017ffea2a6a 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_escaped_character.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_escaped_character.snap @@ -1,6 +1,6 @@ --- source: crates/ruff_python_parser/src/string.rs -expression: parse_ast +expression: suite --- [ Expr( @@ -27,7 +27,9 @@ expression: parse_ast expression: Name( ExprName { range: 5..6, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_escaped_newline.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_escaped_newline.snap index 60f99a5cdf406a..6ffb249f2d399e 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_escaped_newline.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_escaped_newline.snap @@ -1,6 +1,6 @@ --- source: crates/ruff_python_parser/src/string.rs -expression: parse_ast +expression: suite --- [ Expr( @@ -27,7 +27,9 @@ expression: parse_ast expression: Name( ExprName { range: 5..6, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_line_continuation.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_line_continuation.snap index fc2a429ff0989c..4663c45b181c0a 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_line_continuation.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_line_continuation.snap @@ -1,6 +1,6 @@ --- source: crates/ruff_python_parser/src/string.rs -expression: parse_ast +expression: suite --- [ Expr( @@ -27,7 +27,9 @@ expression: parse_ast expression: Name( ExprName { range: 6..7, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_parse_self_documenting_base.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_parse_self_documenting_base.snap index e464a815eaeed7..e5de84317b2eec 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_parse_self_documenting_base.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_parse_self_documenting_base.snap @@ -1,6 +1,6 @@ --- source: crates/ruff_python_parser/src/string.rs -expression: parse_ast +expression: suite --- [ Expr( @@ -21,7 +21,9 @@ expression: parse_ast expression: Name( ExprName { range: 3..7, - id: "user", + id: Name( + "user", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_parse_self_documenting_base_more.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_parse_self_documenting_base_more.snap index 01a3d6f58a5fc2..ec49a9964f3582 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_parse_self_documenting_base_more.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_parse_self_documenting_base_more.snap @@ -1,6 +1,6 @@ --- source: crates/ruff_python_parser/src/string.rs -expression: parse_ast +expression: suite --- [ Expr( @@ -27,7 +27,9 @@ expression: parse_ast expression: Name( ExprName { range: 7..11, - id: "user", + id: Name( + "user", + ), ctx: Load, }, ), @@ -53,7 +55,9 @@ expression: parse_ast expression: Name( ExprName { range: 29..35, - id: "second", + id: Name( + "second", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_parse_self_documenting_format.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_parse_self_documenting_format.snap index 47713a069b541a..e9d849d7c11290 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_parse_self_documenting_format.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_parse_self_documenting_format.snap @@ -1,6 +1,6 @@ --- source: crates/ruff_python_parser/src/string.rs -expression: parse_ast +expression: suite --- [ Expr( @@ -21,7 +21,9 @@ expression: parse_ast expression: Name( ExprName { range: 3..7, - id: "user", + id: Name( + "user", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_unescaped_newline.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_unescaped_newline.snap index a98031a67ce511..76bae0f1becbee 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_unescaped_newline.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__fstring_unescaped_newline.snap @@ -1,6 +1,6 @@ --- source: crates/ruff_python_parser/src/string.rs -expression: parse_ast +expression: suite --- [ Expr( @@ -27,7 +27,9 @@ expression: parse_ast expression: Name( ExprName { range: 6..7, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring.snap index 92ff6491c82732..8671ada594d9f5 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring.snap @@ -1,6 +1,6 @@ --- source: crates/ruff_python_parser/src/string.rs -expression: parse_ast +expression: suite --- [ Expr( @@ -21,7 +21,9 @@ expression: parse_ast expression: Name( ExprName { range: 3..4, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -36,7 +38,9 @@ expression: parse_ast expression: Name( ExprName { range: 7..8, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_nested_concatenation_string_spec.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_nested_concatenation_string_spec.snap index 6a524b9a69c622..fd24b44f12491f 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_nested_concatenation_string_spec.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_nested_concatenation_string_spec.snap @@ -1,6 +1,6 @@ --- source: crates/ruff_python_parser/src/string.rs -expression: parse_ast +expression: suite --- [ Expr( @@ -21,7 +21,9 @@ expression: parse_ast expression: Name( ExprName { range: 3..6, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_nested_spec.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_nested_spec.snap index 90f01e11808a7e..933765f1622f9b 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_nested_spec.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_nested_spec.snap @@ -1,6 +1,6 @@ --- source: crates/ruff_python_parser/src/string.rs -expression: parse_ast +expression: suite --- [ Expr( @@ -21,7 +21,9 @@ expression: parse_ast expression: Name( ExprName { range: 3..6, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -37,7 +39,9 @@ expression: parse_ast expression: Name( ExprName { range: 8..12, - id: "spec", + id: Name( + "spec", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_nested_string_spec.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_nested_string_spec.snap index cffbb7ddc0efca..b4755f8fca6bce 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_nested_string_spec.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_nested_string_spec.snap @@ -1,6 +1,6 @@ --- source: crates/ruff_python_parser/src/string.rs -expression: parse_ast +expression: suite --- [ Expr( @@ -21,7 +21,9 @@ expression: parse_ast expression: Name( ExprName { range: 3..6, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_not_nested_spec.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_not_nested_spec.snap index 77879b89dac8f8..2076f780c61ab1 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_not_nested_spec.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_not_nested_spec.snap @@ -1,6 +1,6 @@ --- source: crates/ruff_python_parser/src/string.rs -expression: parse_ast +expression: suite --- [ Expr( @@ -21,7 +21,9 @@ expression: parse_ast expression: Name( ExprName { range: 3..6, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_self_doc_prec_space.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_self_doc_prec_space.snap index 11c92c78045c07..fbd5214fd80b8a 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_self_doc_prec_space.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_self_doc_prec_space.snap @@ -1,6 +1,6 @@ --- source: crates/ruff_python_parser/src/string.rs -expression: parse_ast +expression: suite --- [ Expr( @@ -21,7 +21,9 @@ expression: parse_ast expression: Name( ExprName { range: 3..4, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_self_doc_trailing_space.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_self_doc_trailing_space.snap index 6ea7dcb6ed3310..8ca08a019f7a2c 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_self_doc_trailing_space.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__parse_fstring_self_doc_trailing_space.snap @@ -1,6 +1,6 @@ --- source: crates/ruff_python_parser/src/string.rs -expression: parse_ast +expression: suite --- [ Expr( @@ -21,7 +21,9 @@ expression: parse_ast expression: Name( ExprName { range: 3..4, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__raw_fstring.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__raw_fstring.snap index 5349caaa761cf1..17e922e640ffc8 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__raw_fstring.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__raw_fstring.snap @@ -1,6 +1,6 @@ --- source: crates/ruff_python_parser/src/string.rs -expression: parse_ast +expression: suite --- [ Expr( @@ -21,7 +21,9 @@ expression: parse_ast expression: Name( ExprName { range: 4..5, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__triple_quoted_raw_fstring.snap b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__triple_quoted_raw_fstring.snap index 00ad084ed6c2ac..aac17cc8804515 100644 --- a/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__triple_quoted_raw_fstring.snap +++ b/crates/ruff_python_parser/src/snapshots/ruff_python_parser__string__tests__triple_quoted_raw_fstring.snap @@ -1,6 +1,6 @@ --- source: crates/ruff_python_parser/src/string.rs -expression: parse_ast +expression: suite --- [ Expr( @@ -21,7 +21,9 @@ expression: parse_ast expression: Name( ExprName { range: 6..7, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/src/token.rs b/crates/ruff_python_parser/src/token.rs index 4e6ee1bcc13fec..9c240f4964e5b9 100644 --- a/crates/ruff_python_parser/src/token.rs +++ b/crates/ruff_python_parser/src/token.rs @@ -9,6 +9,7 @@ use std::fmt; use bitflags::bitflags; +use ruff_python_ast::name::Name; use ruff_python_ast::str::Quote; use ruff_python_ast::str_prefix::{ AnyStringPrefix, ByteStringPrefix, FStringPrefix, StringLiteralPrefix, @@ -780,7 +781,7 @@ pub(crate) enum TokenValue { /// /// Unicode names are NFKC-normalized by the lexer, /// matching [the behaviour of Python's lexer](https://docs.python.org/3/reference/lexical_analysis.html#identifiers) - Name(Box), + Name(Name), /// Token value for an integer. Int(Int), /// Token value for a floating point number. diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@ann_assign_stmt_invalid_annotation.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@ann_assign_stmt_invalid_annotation.py.snap index 0b0e968b41c13d..042326658b84fb 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@ann_assign_stmt_invalid_annotation.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@ann_assign_stmt_invalid_annotation.py.snap @@ -15,7 +15,9 @@ Module( target: Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -25,7 +27,9 @@ Module( value: Name( ExprName { range: 4..7, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -51,7 +55,9 @@ Module( target: Name( ExprName { range: 12..13, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -62,7 +68,9 @@ Module( Name( ExprName { range: 21..22, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -88,7 +96,9 @@ Module( target: Name( ExprName { range: 27..28, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -98,7 +108,9 @@ Module( value: Name( ExprName { range: 41..42, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -123,14 +135,18 @@ Module( target: Name( ExprName { range: 47..48, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), annotation: Name( ExprName { range: 50..51, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -145,7 +161,9 @@ Module( Name( ExprName { range: 55..58, - id: "int", + id: Name( + "int", + ), ctx: Store, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@ann_assign_stmt_invalid_target.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@ann_assign_stmt_invalid_target.py.snap index aa00e7545ddf28..61574fa1b05536 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@ann_assign_stmt_invalid_target.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@ann_assign_stmt_invalid_target.py.snap @@ -33,7 +33,9 @@ Module( annotation: Name( ExprName { range: 7..10, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -69,7 +71,9 @@ Module( func: Name( ExprName { range: 19..23, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -83,7 +87,9 @@ Module( annotation: Name( ExprName { range: 27..30, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -119,7 +125,9 @@ Module( value: Name( ExprName { range: 39..40, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -129,7 +137,9 @@ Module( annotation: Name( ExprName { range: 42..45, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -173,7 +183,9 @@ Module( Name( ExprName { range: 72..73, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -185,7 +197,9 @@ Module( annotation: Name( ExprName { range: 76..79, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -212,14 +226,18 @@ Module( Name( ExprName { range: 84..85, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), Name( ExprName { range: 87..88, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -231,7 +249,9 @@ Module( annotation: Name( ExprName { range: 90..93, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -275,14 +295,18 @@ Module( Name( ExprName { range: 102..103, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), Name( ExprName { range: 105..106, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -294,7 +318,9 @@ Module( annotation: Name( ExprName { range: 109..112, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -338,7 +364,9 @@ Module( Name( ExprName { range: 139..140, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -349,7 +377,9 @@ Module( annotation: Name( ExprName { range: 143..146, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -376,14 +406,18 @@ Module( Name( ExprName { range: 152..153, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), Name( ExprName { range: 155..156, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -394,7 +428,9 @@ Module( annotation: Name( ExprName { range: 159..162, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@ann_assign_stmt_invalid_value.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@ann_assign_stmt_invalid_value.py.snap index 0528b96f48c781..0ec1238cfb84c5 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@ann_assign_stmt_invalid_value.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@ann_assign_stmt_invalid_value.py.snap @@ -15,14 +15,18 @@ Module( target: Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), annotation: Name( ExprName { range: 3..6, - id: "Any", + id: Name( + "Any", + ), ctx: Load, }, ), @@ -38,14 +42,18 @@ Module( Name( ExprName { range: 10..11, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 16..17, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -65,14 +73,18 @@ Module( target: Name( ExprName { range: 18..19, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), annotation: Name( ExprName { range: 21..24, - id: "Any", + id: Name( + "Any", + ), ctx: Load, }, ), @@ -80,7 +92,9 @@ Module( Name( ExprName { range: 27..28, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -107,14 +121,18 @@ Module( target: Name( ExprName { range: 34..35, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), annotation: Name( ExprName { range: 37..41, - id: "list", + id: Name( + "list", + ), ctx: Load, }, ), @@ -126,7 +144,9 @@ Module( Name( ExprName { range: 45..46, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -139,7 +159,9 @@ Module( left: Name( ExprName { range: 49..50, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -147,7 +169,9 @@ Module( right: Name( ExprName { range: 53..54, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -167,14 +191,18 @@ Module( Name( ExprName { range: 57..58, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 62..63, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@ann_assign_stmt_missing_rhs.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@ann_assign_stmt_missing_rhs.py.snap index be4a891ed03189..98908a2b0d7beb 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@ann_assign_stmt_missing_rhs.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@ann_assign_stmt_missing_rhs.py.snap @@ -15,14 +15,18 @@ Module( target: Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), annotation: Name( ExprName { range: 3..6, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@ann_assign_stmt_type_alias_annotation.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@ann_assign_stmt_type_alias_annotation.py.snap index ef88c92d751aec..b9048b093b25ef 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@ann_assign_stmt_type_alias_annotation.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@ann_assign_stmt_type_alias_annotation.py.snap @@ -15,14 +15,18 @@ Module( target: Name( ExprName { range: 0..1, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), annotation: Name( ExprName { range: 3..7, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -37,7 +41,9 @@ Module( Name( ExprName { range: 8..9, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -45,7 +51,9 @@ Module( value: Name( ExprName { range: 12..15, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -61,7 +69,9 @@ Module( body: Name( ExprName { range: 24..28, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -76,7 +86,9 @@ Module( Name( ExprName { range: 29..30, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -84,7 +96,9 @@ Module( value: Name( ExprName { range: 33..36, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assert_empty_msg.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assert_empty_msg.py.snap index 56fdd012dd6e20..a42a1651fea9b0 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assert_empty_msg.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assert_empty_msg.py.snap @@ -15,7 +15,9 @@ Module( test: Name( ExprName { range: 7..8, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assert_empty_test.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assert_empty_test.py.snap index fc5b871b2f6cd0..16a8a7c1da5b04 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assert_empty_test.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assert_empty_test.py.snap @@ -15,7 +15,9 @@ Module( test: Name( ExprName { range: 6..6, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assert_invalid_msg_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assert_invalid_msg_expr.py.snap index c2349e7019f1bf..4244e463d0eb70 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assert_invalid_msg_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assert_invalid_msg_expr.py.snap @@ -25,7 +25,9 @@ Module( value: Name( ExprName { range: 15..16, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -53,7 +55,9 @@ Module( test: Name( ExprName { range: 38..39, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -77,7 +81,9 @@ Module( Name( ExprName { range: 60..61, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -100,7 +106,9 @@ Module( Name( ExprName { range: 76..77, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assert_invalid_test_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assert_invalid_test_expr.py.snap index 238f0fe092dc13..ff654cab5380da 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assert_invalid_test_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assert_invalid_test_expr.py.snap @@ -18,7 +18,9 @@ Module( value: Name( ExprName { range: 8..9, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -34,7 +36,9 @@ Module( test: Name( ExprName { range: 17..23, - id: "assert", + id: Name( + "assert", + ), ctx: Load, }, ), @@ -47,7 +51,9 @@ Module( value: Name( ExprName { range: 24..25, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -63,7 +69,9 @@ Module( Name( ExprName { range: 39..40, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -79,7 +87,9 @@ Module( test: Name( ExprName { range: 48..49, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assign_stmt_invalid_target.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assign_stmt_invalid_target.py.snap index 252a34b009e212..8a0943fa496e0d 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assign_stmt_invalid_target.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assign_stmt_invalid_target.py.snap @@ -39,7 +39,9 @@ Module( Name( ExprName { range: 6..7, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -69,7 +71,9 @@ Module( Name( ExprName { range: 16..17, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -84,7 +88,9 @@ Module( Name( ExprName { range: 24..25, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -100,7 +106,9 @@ Module( value: Name( ExprName { range: 32..33, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assign_stmt_invalid_value_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assign_stmt_invalid_value_expr.py.snap index 2d123c3e3356e9..b3542219a7d217 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assign_stmt_invalid_value_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assign_stmt_invalid_value_expr.py.snap @@ -16,7 +16,9 @@ Module( Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -32,14 +34,18 @@ Module( Name( ExprName { range: 5..6, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 11..12, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -58,7 +64,9 @@ Module( Name( ExprName { range: 13..14, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -73,7 +81,9 @@ Module( Name( ExprName { range: 24..25, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -92,7 +102,9 @@ Module( Name( ExprName { range: 26..27, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -106,7 +118,9 @@ Module( value: Name( ExprName { range: 42..43, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -124,7 +138,9 @@ Module( Name( ExprName { range: 44..45, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -145,7 +161,9 @@ Module( parameter: Parameter { range: 56..57, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 56..57, }, annotation: None, @@ -161,7 +179,9 @@ Module( body: Name( ExprName { range: 59..60, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -179,7 +199,9 @@ Module( Name( ExprName { range: 61..62, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -187,7 +209,9 @@ Module( value: Name( ExprName { range: 65..66, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assign_stmt_keyword_target.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assign_stmt_keyword_target.py.snap index 0b79a3eee84d2b..abf888e58ef628 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assign_stmt_keyword_target.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assign_stmt_keyword_target.py.snap @@ -16,14 +16,18 @@ Module( Name( ExprName { range: 0..1, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), Name( ExprName { range: 4..8, - id: "pass", + id: Name( + "pass", + ), ctx: Store, }, ), @@ -31,7 +35,9 @@ Module( value: Name( ExprName { range: 11..12, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -46,7 +52,9 @@ Module( left: Name( ExprName { range: 13..14, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -54,7 +62,9 @@ Module( right: Name( ExprName { range: 17..18, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -69,21 +79,27 @@ Module( Name( ExprName { range: 19..20, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), Name( ExprName { range: 23..24, - id: "b", + id: Name( + "b", + ), ctx: Store, }, ), Name( ExprName { range: 27..31, - id: "pass", + id: Name( + "pass", + ), ctx: Store, }, ), @@ -91,7 +107,9 @@ Module( value: Name( ExprName { range: 34..35, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -106,7 +124,9 @@ Module( left: Name( ExprName { range: 36..37, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -114,7 +134,9 @@ Module( right: Name( ExprName { range: 40..41, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assign_stmt_missing_rhs.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assign_stmt_missing_rhs.py.snap index ad4013673216a0..11de7a216e60f1 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assign_stmt_missing_rhs.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assign_stmt_missing_rhs.py.snap @@ -16,7 +16,9 @@ Module( Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -24,7 +26,9 @@ Module( value: Name( ExprName { range: 3..3, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -64,14 +68,18 @@ Module( Name( ExprName { range: 10..11, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), Name( ExprName { range: 14..15, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -79,7 +87,9 @@ Module( value: Name( ExprName { range: 17..17, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -119,14 +129,18 @@ Module( Name( ExprName { range: 24..25, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), Name( ExprName { range: 27..27, - id: "", + id: Name( + "", + ), ctx: Store, }, ), @@ -134,7 +148,9 @@ Module( value: Name( ExprName { range: 30..31, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@async_unexpected_token.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@async_unexpected_token.py.snap index 37154ac1eedaef..0afc58cfe223db 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@async_unexpected_token.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@async_unexpected_token.py.snap @@ -14,7 +14,9 @@ Module( range: 6..20, decorator_list: [], name: Identifier { - id: "Foo", + id: Name( + "Foo", + ), range: 12..15, }, type_params: None, @@ -39,7 +41,9 @@ Module( test: Name( ExprName { range: 33..37, - id: "test", + id: Name( + "test", + ), ctx: Load, }, ), @@ -65,7 +69,9 @@ Module( Name( ExprName { range: 49..50, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -86,7 +92,9 @@ Module( is_async: true, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 71..74, }, type_params: None, @@ -119,7 +127,9 @@ Module( subject: Name( ExprName { range: 94..98, - id: "test", + id: Name( + "test", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@aug_assign_stmt_invalid_target.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@aug_assign_stmt_invalid_target.py.snap index 2b6344ab13b7ba..6aa389f684ff7b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@aug_assign_stmt_invalid_target.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@aug_assign_stmt_invalid_target.py.snap @@ -82,7 +82,9 @@ Module( value: Name( ExprName { range: 19..20, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -124,7 +126,9 @@ Module( target: Name( ExprName { range: 36..37, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -132,7 +136,9 @@ Module( value: Name( ExprName { range: 41..45, - id: "pass", + id: Name( + "pass", + ), ctx: Load, }, ), @@ -147,7 +153,9 @@ Module( left: Name( ExprName { range: 47..48, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -155,7 +163,9 @@ Module( right: Name( ExprName { range: 51..52, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@aug_assign_stmt_invalid_value.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@aug_assign_stmt_invalid_value.py.snap index 203e9e401b415d..1f788455d9e6cc 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@aug_assign_stmt_invalid_value.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@aug_assign_stmt_invalid_value.py.snap @@ -15,7 +15,9 @@ Module( target: Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -31,14 +33,18 @@ Module( Name( ExprName { range: 6..7, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 12..13, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -56,7 +62,9 @@ Module( target: Name( ExprName { range: 14..15, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -71,7 +79,9 @@ Module( Name( ExprName { range: 26..27, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -89,7 +99,9 @@ Module( target: Name( ExprName { range: 28..29, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -103,7 +115,9 @@ Module( value: Name( ExprName { range: 45..46, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -120,7 +134,9 @@ Module( target: Name( ExprName { range: 47..48, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -141,7 +157,9 @@ Module( parameter: Parameter { range: 60..61, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 60..61, }, annotation: None, @@ -157,7 +175,9 @@ Module( body: Name( ExprName { range: 63..64, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -174,7 +194,9 @@ Module( target: Name( ExprName { range: 65..66, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -182,7 +204,9 @@ Module( value: Name( ExprName { range: 70..71, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@aug_assign_stmt_missing_rhs.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@aug_assign_stmt_missing_rhs.py.snap index df5c25dc7cfe02..9100e0cf574df7 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@aug_assign_stmt_missing_rhs.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@aug_assign_stmt_missing_rhs.py.snap @@ -15,7 +15,9 @@ Module( target: Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -23,7 +25,9 @@ Module( value: Name( ExprName { range: 4..4, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -62,7 +66,9 @@ Module( target: Name( ExprName { range: 11..12, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -70,7 +76,9 @@ Module( value: Name( ExprName { range: 16..17, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@case_expect_indented_block.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@case_expect_indented_block.py.snap index a72d0cac0a9307..4ac3d62f8e71f9 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@case_expect_indented_block.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@case_expect_indented_block.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 6..13, - id: "subject", + id: Name( + "subject", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@class_def_empty_body.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@class_def_empty_body.py.snap index 1c4725aa896e18..f83736bef1b043 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@class_def_empty_body.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@class_def_empty_body.py.snap @@ -14,7 +14,9 @@ Module( range: 0..10, decorator_list: [], name: Identifier { - id: "Foo", + id: Name( + "Foo", + ), range: 6..9, }, type_params: None, @@ -27,7 +29,9 @@ Module( range: 11..23, decorator_list: [], name: Identifier { - id: "Foo", + id: Name( + "Foo", + ), range: 17..20, }, type_params: None, @@ -48,7 +52,9 @@ Module( Name( ExprName { range: 24..25, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@class_def_missing_name.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@class_def_missing_name.py.snap index e254f9523fc7f0..23ff3b194c2eab 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@class_def_missing_name.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@class_def_missing_name.py.snap @@ -14,7 +14,9 @@ Module( range: 0..11, decorator_list: [], name: Identifier { - id: "", + id: Name( + "", + ), range: 5..5, }, type_params: None, @@ -38,7 +40,9 @@ Module( range: 12..25, decorator_list: [], name: Identifier { - id: "", + id: Name( + "", + ), range: 17..17, }, type_params: None, @@ -68,7 +72,9 @@ Module( range: 26..52, decorator_list: [], name: Identifier { - id: "", + id: Name( + "", + ), range: 31..31, }, type_params: None, @@ -81,14 +87,18 @@ Module( range: 33..46, arg: Some( Identifier { - id: "metaclass", + id: Name( + "metaclass", + ), range: 33..42, }, ), value: Name( ExprName { range: 43..46, - id: "ABC", + id: Name( + "ABC", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@class_def_unclosed_type_param_list.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@class_def_unclosed_type_param_list.py.snap index ce87aec207589e..0e1a15c85c52ca 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@class_def_unclosed_type_param_list.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@class_def_unclosed_type_param_list.py.snap @@ -14,7 +14,9 @@ Module( range: 0..33, decorator_list: [], name: Identifier { - id: "Foo", + id: Name( + "Foo", + ), range: 6..9, }, type_params: Some( @@ -25,7 +27,9 @@ Module( TypeParamTypeVar { range: 10..12, name: Identifier { - id: "T1", + id: Name( + "T1", + ), range: 10..12, }, bound: None, @@ -36,7 +40,9 @@ Module( TypeParamTypeVarTuple { range: 14..17, name: Identifier { - id: "T2", + id: Name( + "T2", + ), range: 15..17, }, default: None, @@ -52,14 +58,18 @@ Module( Name( ExprName { range: 18..19, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 21..22, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -83,7 +93,9 @@ Module( Name( ExprName { range: 34..35, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comma_separated_missing_comma.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comma_separated_missing_comma.py.snap index a278a2155f32b7..925df10b38052b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comma_separated_missing_comma.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comma_separated_missing_comma.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -41,7 +43,9 @@ Module( value: Name( ExprName { range: 7..8, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comma_separated_missing_first_element.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comma_separated_missing_first_element.py.snap index 8a98ab26f50ac2..d02eb104e6aa59 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comma_separated_missing_first_element.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comma_separated_missing_first_element.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comprehension_missing_for_after_async.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comprehension_missing_for_after_async.py.snap index e506dac043a4f2..b2f14268309cbf 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comprehension_missing_for_after_async.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comprehension_missing_for_after_async.py.snap @@ -15,7 +15,9 @@ Module( value: Name( ExprName { range: 1..6, - id: "async", + id: Name( + "async", + ), ctx: Load, }, ), @@ -30,7 +32,9 @@ Module( elt: Name( ExprName { range: 9..10, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -40,14 +44,18 @@ Module( target: Name( ExprName { range: 17..18, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 22..26, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_invalid_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_invalid_expression.py.snap index 7ee0145871e06e..b148c7a890f132 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_invalid_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_invalid_expression.py.snap @@ -22,7 +22,9 @@ Module( value: Name( ExprName { range: 2..3, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -38,7 +40,9 @@ Module( value: Name( ExprName { range: 7..8, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -54,7 +58,9 @@ Module( value: Name( ExprName { range: 14..15, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -71,7 +77,9 @@ Module( Name( ExprName { range: 25..26, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -87,7 +95,9 @@ Module( value: Name( ExprName { range: 39..40, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -96,7 +106,9 @@ Module( }, ], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 45..48, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_missing_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_missing_expression.py.snap index ea01e8e07061c7..98b65c073d554c 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_missing_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_missing_expression.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 5..8, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -48,14 +50,18 @@ Module( expression: Name( ExprName { range: 17..17, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), }, ], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 22..25, }, type_params: None, @@ -95,7 +101,9 @@ Module( left: Name( ExprName { range: 34..34, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -103,7 +111,9 @@ Module( right: Name( ExprName { range: 35..35, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -112,7 +122,9 @@ Module( }, ], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 40..43, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_missing_newline.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_missing_newline.py.snap index 16e58deab9e6fd..db845f62517d2c 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_missing_newline.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_missing_newline.py.snap @@ -19,14 +19,18 @@ Module( expression: Name( ExprName { range: 1..2, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), }, ], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 7..10, }, type_params: None, @@ -63,14 +67,18 @@ Module( expression: Name( ExprName { range: 19..20, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), }, ], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 31..34, }, type_params: None, @@ -106,14 +114,18 @@ Module( expression: Name( ExprName { range: 43..44, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), }, ], name: Identifier { - id: "Foo", + id: Name( + "Foo", + ), range: 51..54, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_unexpected_token.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_unexpected_token.py.snap index c23436132148e2..1939a2a1f17a45 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_unexpected_token.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_unexpected_token.py.snap @@ -19,7 +19,9 @@ Module( context_expr: Name( ExprName { range: 16..17, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -47,7 +49,9 @@ Module( Name( ExprName { range: 28..29, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@del_incomplete_target.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@del_incomplete_target.py.snap index ac45a128e39dba..8025256aec6b29 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@del_incomplete_target.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@del_incomplete_target.py.snap @@ -16,7 +16,9 @@ Module( Name( ExprName { range: 4..5, - id: "x", + id: Name( + "x", + ), ctx: Del, }, ), @@ -26,12 +28,16 @@ Module( value: Name( ExprName { range: 7..8, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), attr: Identifier { - id: "", + id: Name( + "", + ), range: 9..9, }, ctx: Del, @@ -46,7 +52,9 @@ Module( value: Name( ExprName { range: 10..11, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -59,7 +67,9 @@ Module( Name( ExprName { range: 16..17, - id: "x", + id: Name( + "x", + ), ctx: Del, }, ), @@ -69,7 +79,9 @@ Module( value: Name( ExprName { range: 19..20, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -80,7 +92,9 @@ Module( Name( ExprName { range: 22..23, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -89,7 +103,9 @@ Module( Name( ExprName { range: 23..23, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@dotted_name_multiple_dots.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@dotted_name_multiple_dots.py.snap index f876858cc17cda..ccda109fddf71b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@dotted_name_multiple_dots.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@dotted_name_multiple_dots.py.snap @@ -16,7 +16,9 @@ Module( Alias { range: 7..11, name: Identifier { - id: "a..b", + id: Name( + "a..b", + ), range: 7..11, }, asname: None, @@ -31,7 +33,9 @@ Module( Alias { range: 19..20, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 19..20, }, asname: None, @@ -55,7 +59,9 @@ Module( value: Name( ExprName { range: 23..24, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@except_stmt_invalid_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@except_stmt_invalid_expression.py.snap index ca3cb6b784d769..aeeab8b2e6ef89 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@except_stmt_invalid_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@except_stmt_invalid_expression.py.snap @@ -31,7 +31,9 @@ Module( Name( ExprName { range: 27..28, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -76,7 +78,9 @@ Module( value: Name( ExprName { range: 62..63, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@except_stmt_missing_as_name.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@except_stmt_missing_as_name.py.snap index c9fcabbab09564..c20c74ff937a4d 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@except_stmt_missing_as_name.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@except_stmt_missing_as_name.py.snap @@ -27,7 +27,9 @@ Module( Name( ExprName { range: 21..30, - id: "Exception", + id: Name( + "Exception", + ), ctx: Load, }, ), @@ -49,7 +51,9 @@ Module( Name( ExprName { range: 51..60, - id: "Exception", + id: Name( + "Exception", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@except_stmt_missing_exception.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@except_stmt_missing_exception.py.snap index d30dbd928c71dc..e3001e637b598e 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@except_stmt_missing_exception.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@except_stmt_missing_exception.py.snap @@ -26,7 +26,9 @@ Module( type_: None, name: Some( Identifier { - id: "exc", + id: Name( + "exc", + ), range: 24..27, }, ), @@ -90,7 +92,9 @@ Module( type_: None, name: Some( Identifier { - id: "exc", + id: Name( + "exc", + ), range: 152..155, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@except_stmt_unparenthesized_tuple.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@except_stmt_unparenthesized_tuple.py.snap index 7e191318af4ab4..7bb846725055f4 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@except_stmt_unparenthesized_tuple.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@except_stmt_unparenthesized_tuple.py.snap @@ -31,14 +31,18 @@ Module( Name( ExprName { range: 21..22, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 24..25, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -69,14 +73,18 @@ Module( Name( ExprName { range: 43..44, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 46..47, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -88,7 +96,9 @@ Module( ), name: Some( Identifier { - id: "exc", + id: Name( + "exc", + ), range: 51..54, }, ), @@ -129,14 +139,18 @@ Module( Name( ExprName { range: 87..88, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 90..91, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -167,14 +181,18 @@ Module( Name( ExprName { range: 110..111, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 113..114, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -186,7 +204,9 @@ Module( ), name: Some( Identifier { - id: "eg", + id: Name( + "eg", + ), range: 118..120, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__double_starred.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__double_starred.py.snap index 2bab550c4867a4..55d3deb4d0be9d 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__double_starred.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__double_starred.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -36,7 +38,9 @@ Module( Name( ExprName { range: 13..14, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -59,7 +63,9 @@ Module( func: Name( ExprName { range: 16..20, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -76,7 +82,9 @@ Module( value: Name( ExprName { range: 25..26, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -99,7 +107,9 @@ Module( func: Name( ExprName { range: 28..32, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -116,7 +126,9 @@ Module( value: Name( ExprName { range: 36..37, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -139,7 +151,9 @@ Module( func: Name( ExprName { range: 40..44, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -162,7 +176,9 @@ Module( value: Name( ExprName { range: 47..48, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__duplicate_keyword_arguments.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__duplicate_keyword_arguments.py.snap index 9b105f6cb37403..a02990451499b3 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__duplicate_keyword_arguments.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__duplicate_keyword_arguments.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 0..3, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -30,7 +32,9 @@ Module( range: 4..7, arg: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 4..5, }, ), @@ -47,7 +51,9 @@ Module( range: 9..12, arg: Some( Identifier { - id: "b", + id: Name( + "b", + ), range: 9..10, }, ), @@ -64,7 +70,9 @@ Module( range: 14..17, arg: Some( Identifier { - id: "c", + id: Name( + "c", + ), range: 14..15, }, ), @@ -81,7 +89,9 @@ Module( range: 19..22, arg: Some( Identifier { - id: "b", + id: Name( + "b", + ), range: 19..20, }, ), @@ -98,7 +108,9 @@ Module( range: 24..27, arg: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 24..25, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__invalid_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__invalid_expression.py.snap index f904be8edbec47..09f6aa6dac86ef 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__invalid_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__invalid_expression.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -30,7 +32,9 @@ Module( range: 5..14, arg: Some( Identifier { - id: "", + id: Name( + "", + ), range: 5..10, }, ), @@ -58,7 +62,9 @@ Module( func: Name( ExprName { range: 16..20, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -70,7 +76,9 @@ Module( range: 21..31, arg: Some( Identifier { - id: "", + id: Name( + "", + ), range: 21..27, }, ), @@ -98,7 +106,9 @@ Module( func: Name( ExprName { range: 34..38, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -112,7 +122,9 @@ Module( Name( ExprName { range: 45..46, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -135,7 +147,9 @@ Module( func: Name( ExprName { range: 48..52, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -148,7 +162,9 @@ Module( value: Name( ExprName { range: 64..65, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__invalid_keyword_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__invalid_keyword_expression.py.snap index 5200967a60d431..9718bcd6517ea5 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__invalid_keyword_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__invalid_keyword_expression.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -30,7 +32,9 @@ Module( range: 5..16, arg: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 5..6, }, ), @@ -41,7 +45,9 @@ Module( Name( ExprName { range: 15..16, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -64,7 +70,9 @@ Module( func: Name( ExprName { range: 18..22, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -76,7 +84,9 @@ Module( range: 23..39, arg: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 23..24, }, ), @@ -86,7 +96,9 @@ Module( value: Name( ExprName { range: 38..39, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -108,7 +120,9 @@ Module( func: Name( ExprName { range: 41..45, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -120,7 +134,9 @@ Module( range: 46..52, arg: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 46..47, }, ), @@ -130,7 +146,9 @@ Module( value: Name( ExprName { range: 51..52, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -153,7 +171,9 @@ Module( func: Name( ExprName { range: 54..58, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -165,7 +185,9 @@ Module( range: 59..67, arg: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 59..60, }, ), @@ -175,7 +197,9 @@ Module( value: Name( ExprName { range: 65..66, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__invalid_order.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__invalid_order.py.snap index 0cf3fffafd3bee..450b9c0c7aa18b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__invalid_order.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__invalid_order.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -28,7 +30,9 @@ Module( Name( ExprName { range: 15..16, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -40,7 +44,9 @@ Module( value: Name( ExprName { range: 7..13, - id: "kwargs", + id: Name( + "kwargs", + ), ctx: Load, }, ), @@ -60,7 +66,9 @@ Module( func: Name( ExprName { range: 18..22, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -70,7 +78,9 @@ Module( Name( ExprName { range: 28..29, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -80,7 +90,9 @@ Module( range: 23..26, arg: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 23..24, }, ), @@ -108,7 +120,9 @@ Module( func: Name( ExprName { range: 31..35, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -118,7 +132,9 @@ Module( Name( ExprName { range: 51..52, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -128,7 +144,9 @@ Module( range: 36..39, arg: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 36..37, }, ), @@ -147,7 +165,9 @@ Module( value: Name( ExprName { range: 43..49, - id: "kwargs", + id: Name( + "kwargs", + ), ctx: Load, }, ), @@ -167,7 +187,9 @@ Module( func: Name( ExprName { range: 54..58, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -180,7 +202,9 @@ Module( value: Name( ExprName { range: 70..74, - id: "args", + id: Name( + "args", + ), ctx: Load, }, ), @@ -195,7 +219,9 @@ Module( value: Name( ExprName { range: 61..67, - id: "kwargs", + id: Name( + "kwargs", + ), ctx: Load, }, ), @@ -215,7 +241,9 @@ Module( func: Name( ExprName { range: 76..80, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -228,7 +256,9 @@ Module( value: Name( ExprName { range: 93..97, - id: "args", + id: Name( + "args", + ), ctx: Load, }, ), @@ -243,7 +273,9 @@ Module( value: Name( ExprName { range: 83..89, - id: "kwargs", + id: Name( + "kwargs", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__missing_argument.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__missing_argument.py.snap index f2749b81a555c0..7ee6c4feef5a84 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__missing_argument.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__missing_argument.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -28,14 +30,18 @@ Module( Name( ExprName { range: 5..6, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 8..9, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__missing_comma.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__missing_comma.py.snap index d3c83e68ecd143..30a27ca3d859aa 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__missing_comma.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__missing_comma.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -28,14 +30,18 @@ Module( Name( ExprName { range: 5..6, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 7..8, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__missing_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__missing_expression.py.snap index 03fd0e76b98d6d..c3b43d300f4db2 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__missing_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__missing_expression.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -49,7 +51,9 @@ Module( func: Name( ExprName { range: 11..15, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -61,14 +65,18 @@ Module( range: 16..19, arg: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 16..17, }, ), value: Name( ExprName { range: 19..19, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -88,7 +96,9 @@ Module( func: Name( ExprName { range: 22..26, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -101,7 +111,9 @@ Module( value: Name( ExprName { range: 28..28, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -111,7 +123,9 @@ Module( Name( ExprName { range: 30..31, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -128,7 +142,9 @@ Module( value: Name( ExprName { range: 34..37, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__starred.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__starred.py.snap index b8e9b4363e0582..bd7fdec34f9b1d 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__starred.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__starred.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -34,7 +36,9 @@ Module( value: Name( ExprName { range: 6..10, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -47,14 +51,18 @@ Module( target: Name( ExprName { range: 15..19, - id: "data", + id: Name( + "data", + ), ctx: Store, }, ), iter: Name( ExprName { range: 23..27, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), @@ -81,7 +89,9 @@ Module( func: Name( ExprName { range: 29..33, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -98,7 +108,9 @@ Module( Name( ExprName { range: 41..42, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -124,7 +136,9 @@ Module( func: Name( ExprName { range: 44..48, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -140,7 +154,9 @@ Module( value: Name( ExprName { range: 61..62, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_0.py.snap index d4b6d03e5d9a6f..d61be72c0fa12e 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_0.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -37,7 +39,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 11..14, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_1.py.snap index bcb536b75bd5dc..4eb98ed8ba8860 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_1.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -28,7 +30,9 @@ Module( Name( ExprName { range: 5..6, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -45,7 +49,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 12..15, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_2.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_2.py.snap index 131bfd6e2b377a..bbc9b80646daf0 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_2.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_2.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -28,7 +30,9 @@ Module( Name( ExprName { range: 5..6, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -45,7 +49,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 13..16, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__attribute__invalid_member.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__attribute__invalid_member.py.snap index 346e2bebcc6fb0..5d4984c27cd68c 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__attribute__invalid_member.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__attribute__invalid_member.py.snap @@ -15,7 +15,9 @@ Module( value: Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -40,7 +42,9 @@ Module( value: Name( ExprName { range: 4..5, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -84,12 +88,16 @@ Module( value: Name( ExprName { range: 10..11, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), attr: Identifier { - id: "", + id: Name( + "", + ), range: 12..12, }, ctx: Load, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__attribute__multiple_dots.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__attribute__multiple_dots.py.snap index 269efc26dcc8bd..bbd7553dff2d00 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__attribute__multiple_dots.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__attribute__multiple_dots.py.snap @@ -21,19 +21,25 @@ Module( value: Name( ExprName { range: 0..5, - id: "extra", + id: Name( + "extra", + ), ctx: Load, }, ), attr: Identifier { - id: "", + id: Name( + "", + ), range: 6..6, }, ctx: Load, }, ), attr: Identifier { - id: "dot", + id: Name( + "dot", + ), range: 7..10, }, ctx: Load, @@ -47,7 +53,9 @@ Module( value: Name( ExprName { range: 11..19, - id: "multiple", + id: Name( + "multiple", + ), ctx: Load, }, ), @@ -65,7 +73,9 @@ Module( }, ), attr: Identifier { - id: "dots", + id: Name( + "dots", + ), range: 23..27, }, ctx: Load, @@ -79,7 +89,9 @@ Module( value: Name( ExprName { range: 28..36, - id: "multiple", + id: Name( + "multiple", + ), ctx: Load, }, ), @@ -100,14 +112,18 @@ Module( }, ), attr: Identifier { - id: "", + id: Name( + "", + ), range: 40..40, }, ctx: Load, }, ), attr: Identifier { - id: "dots", + id: Name( + "dots", + ), range: 41..45, }, ctx: Load, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__attribute__no_member.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__attribute__no_member.py.snap index e7f213367fb2e0..edcf61d545b4f1 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__attribute__no_member.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__attribute__no_member.py.snap @@ -18,12 +18,16 @@ Module( value: Name( ExprName { range: 87..92, - id: "first", + id: Name( + "first", + ), ctx: Load, }, ), attr: Identifier { - id: "", + id: Name( + "", + ), range: 93..93, }, ctx: Load, @@ -37,7 +41,9 @@ Module( value: Name( ExprName { range: 94..100, - id: "second", + id: Name( + "second", + ), ctx: Load, }, ), @@ -52,12 +58,16 @@ Module( value: Name( ExprName { range: 136..140, - id: "last", + id: Name( + "last", + ), ctx: Load, }, ), attr: Identifier { - id: "", + id: Name( + "", + ), range: 141..141, }, ctx: Load, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__no_expression_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__no_expression_0.py.snap index 31b383038a064e..bc2c9fe8046578 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__no_expression_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__no_expression_0.py.snap @@ -18,7 +18,9 @@ Module( value: Name( ExprName { range: 66..66, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -35,7 +37,9 @@ Module( left: Name( ExprName { range: 68..69, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -43,7 +47,9 @@ Module( right: Name( ExprName { range: 72..73, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__no_expression_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__no_expression_1.py.snap index 54bda080762d1c..4cdcd7626f918c 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__no_expression_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__no_expression_1.py.snap @@ -18,7 +18,9 @@ Module( value: Name( ExprName { range: 64..64, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -32,7 +34,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 70..73, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__recover.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__recover.py.snap index 416c0b1ddd8848..6e7b025e5fe8b2 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__recover.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__await__recover.py.snap @@ -21,7 +21,9 @@ Module( value: Name( ExprName { range: 129..130, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -43,7 +45,9 @@ Module( value: Name( ExprName { range: 161..162, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -66,7 +70,9 @@ Module( value: Name( ExprName { range: 171..172, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -90,7 +96,9 @@ Module( Name( ExprName { range: 226..227, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -120,7 +128,9 @@ Module( parameter: Parameter { range: 241..242, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 241..242, }, annotation: None, @@ -136,7 +146,9 @@ Module( body: Name( ExprName { range: 244..245, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -159,7 +171,9 @@ Module( operand: Name( ExprName { range: 253..254, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -182,7 +196,9 @@ Module( operand: Name( ExprName { range: 262..263, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -205,7 +221,9 @@ Module( operand: Name( ExprName { range: 271..272, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -228,7 +246,9 @@ Module( operand: Name( ExprName { range: 283..284, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__invalid_rhs_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__invalid_rhs_expression.py.snap index cd588a4f704694..2a4434957b3221 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__invalid_rhs_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__invalid_rhs_expression.py.snap @@ -18,7 +18,9 @@ Module( left: Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -36,7 +38,9 @@ Module( parameter: Parameter { range: 11..12, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 11..12, }, annotation: None, @@ -52,7 +56,9 @@ Module( body: Name( ExprName { range: 14..15, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -71,7 +77,9 @@ Module( left: Name( ExprName { range: 17..18, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -83,7 +91,9 @@ Module( Name( ExprName { range: 27..28, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_lhs.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_lhs.py.snap index 605a1de3711788..31c39597c6c85a 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_lhs.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_lhs.py.snap @@ -15,7 +15,9 @@ Module( value: Name( ExprName { range: 2..3, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_rhs_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_rhs_0.py.snap index 4b265c72baf3e4..b4e443c89669bb 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_rhs_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_rhs_0.py.snap @@ -27,7 +27,9 @@ Module( right: Name( ExprName { range: 3..3, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_rhs_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_rhs_1.py.snap index aff9c7fff9317d..d415acf29f9e02 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_rhs_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__missing_rhs_1.py.snap @@ -53,7 +53,9 @@ Module( right: Name( ExprName { range: 11..11, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__multiple_ops.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__multiple_ops.py.snap index d1e939fd39cb70..65eb33f6fb0a9b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__multiple_ops.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__multiple_ops.py.snap @@ -18,7 +18,9 @@ Module( left: Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -30,7 +32,9 @@ Module( operand: Name( ExprName { range: 3..3, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -76,7 +80,9 @@ Module( left: Name( ExprName { range: 10..11, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -88,7 +94,9 @@ Module( operand: Name( ExprName { range: 13..13, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__named_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__named_expression.py.snap index b14cee55b84e56..ad819fd62d90d6 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__named_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__named_expression.py.snap @@ -18,7 +18,9 @@ Module( left: Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -26,7 +28,9 @@ Module( right: Name( ExprName { range: 4..5, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -73,7 +77,9 @@ Module( left: Name( ExprName { range: 16..17, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -81,7 +87,9 @@ Module( right: Name( ExprName { range: 20..21, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__starred_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__starred_expression.py.snap index 477d4cac078986..7a27ca322ce6ce 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__starred_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bin_op__starred_expression.py.snap @@ -18,7 +18,9 @@ Module( left: Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -29,7 +31,9 @@ Module( value: Name( ExprName { range: 5..6, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -49,7 +53,9 @@ Module( left: Name( ExprName { range: 7..8, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -60,7 +66,9 @@ Module( value: Name( ExprName { range: 13..14, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__invalid_rhs_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__invalid_rhs_expression.py.snap index a7b60a2d3a1f7b..07e16b49c2a645 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__invalid_rhs_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__invalid_rhs_expression.py.snap @@ -20,7 +20,9 @@ Module( Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -37,7 +39,9 @@ Module( parameter: Parameter { range: 13..14, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 13..14, }, annotation: None, @@ -53,7 +57,9 @@ Module( body: Name( ExprName { range: 16..17, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -75,7 +81,9 @@ Module( Name( ExprName { range: 19..20, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -86,7 +94,9 @@ Module( Name( ExprName { range: 30..31, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__missing_lhs.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__missing_lhs.py.snap index 6441ac2035b5d5..4043afcc9e92f7 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__missing_lhs.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__missing_lhs.py.snap @@ -15,7 +15,9 @@ Module( value: Name( ExprName { range: 4..5, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__missing_rhs.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__missing_rhs.py.snap index a954ccf5c6c0a5..73aec642a271f9 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__missing_rhs.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__missing_rhs.py.snap @@ -20,14 +20,18 @@ Module( Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 5..5, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__named_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__named_expression.py.snap index 55689d68dff19a..237137538c7726 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__named_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__named_expression.py.snap @@ -20,14 +20,18 @@ Module( Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 6..7, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -42,7 +46,9 @@ Module( value: Name( ExprName { range: 11..12, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -59,14 +65,18 @@ Module( Name( ExprName { range: 13..14, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 18..19, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -81,7 +91,9 @@ Module( value: Name( ExprName { range: 23..24, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__starred_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__starred_expression.py.snap index 7883b0548065b3..16eaa865aa8bb6 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__starred_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__bool_op__starred_expression.py.snap @@ -20,7 +20,9 @@ Module( Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -30,7 +32,9 @@ Module( value: Name( ExprName { range: 7..8, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -53,7 +57,9 @@ Module( Name( ExprName { range: 9..10, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -63,7 +69,9 @@ Module( value: Name( ExprName { range: 15..16, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__invalid_order.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__invalid_order.py.snap index cebbe6465c64dc..ec1515de073689 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__invalid_order.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__invalid_order.py.snap @@ -18,7 +18,9 @@ Module( left: Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -33,7 +35,9 @@ Module( operand: Name( ExprName { range: 9..10, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -51,7 +55,9 @@ Module( Name( ExprName { range: 35..36, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -62,7 +68,9 @@ Module( left: Name( ExprName { range: 38..38, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -73,7 +81,9 @@ Module( Name( ExprName { range: 40..41, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -88,7 +98,9 @@ Module( value: Name( ExprName { range: 120..121, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -104,7 +116,9 @@ Module( operand: Name( ExprName { range: 126..128, - id: "is", + id: Name( + "is", + ), ctx: Load, }, ), @@ -118,7 +132,9 @@ Module( value: Name( ExprName { range: 129..130, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__invalid_rhs_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__invalid_rhs_expression.py.snap index 401865d0592c0b..e95a6b9680f88d 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__invalid_rhs_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__invalid_rhs_expression.py.snap @@ -18,7 +18,9 @@ Module( left: Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -39,7 +41,9 @@ Module( parameter: Parameter { range: 16..17, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 16..17, }, annotation: None, @@ -55,7 +59,9 @@ Module( body: Name( ExprName { range: 19..20, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -75,7 +81,9 @@ Module( left: Name( ExprName { range: 22..23, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -90,7 +98,9 @@ Module( Name( ExprName { range: 33..34, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_lhs.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_lhs.py.snap index 31007185b95db6..2658f800551d69 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_lhs.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_lhs.py.snap @@ -15,7 +15,9 @@ Module( value: Name( ExprName { range: 2..3, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_0.py.snap index 30a6f6402c8f29..68256a79c3939b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_0.py.snap @@ -18,7 +18,9 @@ Module( left: Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -29,7 +31,9 @@ Module( Name( ExprName { range: 3..3, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_1.py.snap index 8a9bf572acb4e6..f6282c99a37c4b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_1.py.snap @@ -15,7 +15,9 @@ Module( value: Name( ExprName { range: 59..60, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -31,7 +33,9 @@ Module( operand: Name( ExprName { range: 64..64, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_2.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_2.py.snap index 741fd3d2b0f3a4..a4fa94bbeacb27 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_2.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__missing_rhs_2.py.snap @@ -18,7 +18,9 @@ Module( left: Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -29,7 +31,9 @@ Module( Name( ExprName { range: 8..8, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__multiple_equals.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__multiple_equals.py.snap index 344a3aa2cf33d4..41bebac101db27 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__multiple_equals.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__multiple_equals.py.snap @@ -19,7 +19,9 @@ Module( left: Name( ExprName { range: 25..26, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -30,7 +32,9 @@ Module( Name( ExprName { range: 29..29, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -41,7 +45,9 @@ Module( value: Name( ExprName { range: 31..32, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -57,7 +63,9 @@ Module( left: Name( ExprName { range: 33..34, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -68,7 +76,9 @@ Module( Name( ExprName { range: 37..37, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -79,7 +89,9 @@ Module( value: Name( ExprName { range: 39..40, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__named_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__named_expression.py.snap index 923f38214381fb..16452af47a561c 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__named_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__named_expression.py.snap @@ -18,7 +18,9 @@ Module( left: Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -29,7 +31,9 @@ Module( Name( ExprName { range: 9..10, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -77,7 +81,9 @@ Module( left: Name( ExprName { range: 21..22, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -88,7 +94,9 @@ Module( Name( ExprName { range: 25..26, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__starred_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__starred_expression.py.snap index cd1ab62b32e90a..03e42c1243e654 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__starred_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__starred_expression.py.snap @@ -18,7 +18,9 @@ Module( left: Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -32,7 +34,9 @@ Module( value: Name( ExprName { range: 6..7, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -53,7 +57,9 @@ Module( left: Name( ExprName { range: 8..9, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -67,7 +73,9 @@ Module( value: Name( ExprName { range: 18..19, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -91,7 +99,9 @@ Module( left: Name( ExprName { range: 22..23, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -102,7 +112,9 @@ Module( Name( ExprName { range: 26..27, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -126,7 +138,9 @@ Module( left: Name( ExprName { range: 29..30, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -137,7 +151,9 @@ Module( Name( ExprName { range: 38..39, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__comprehension.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__comprehension.py.snap index d99635f56af93e..128e8463fe781c 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__comprehension.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__comprehension.py.snap @@ -18,14 +18,18 @@ Module( key: Name( ExprName { range: 18..19, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), value: Name( ExprName { range: 21..22, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -43,7 +47,9 @@ Module( iter: Name( ExprName { range: 32..33, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -64,14 +70,18 @@ Module( key: Name( ExprName { range: 36..37, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), value: Name( ExprName { range: 39..40, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -99,7 +109,9 @@ Module( iter: Name( ExprName { range: 52..53, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -120,14 +132,18 @@ Module( key: Name( ExprName { range: 56..57, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), value: Name( ExprName { range: 59..60, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -140,7 +156,9 @@ Module( func: Name( ExprName { range: 65..69, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -154,7 +172,9 @@ Module( iter: Name( ExprName { range: 75..76, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -175,14 +195,18 @@ Module( key: Name( ExprName { range: 79..80, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), value: Name( ExprName { range: 82..83, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -196,14 +220,18 @@ Module( Name( ExprName { range: 89..90, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 92..93, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -213,7 +241,9 @@ Module( iter: Name( ExprName { range: 98..99, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -234,14 +264,18 @@ Module( key: Name( ExprName { range: 118..119, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), value: Name( ExprName { range: 121..122, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -251,7 +285,9 @@ Module( target: Name( ExprName { range: 127..128, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -261,7 +297,9 @@ Module( value: Name( ExprName { range: 133..134, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -285,14 +323,18 @@ Module( key: Name( ExprName { range: 137..138, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), value: Name( ExprName { range: 140..141, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -302,7 +344,9 @@ Module( target: Name( ExprName { range: 146..147, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -313,7 +357,9 @@ Module( Name( ExprName { range: 157..158, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -337,14 +383,18 @@ Module( key: Name( ExprName { range: 161..162, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), value: Name( ExprName { range: 164..165, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -354,7 +404,9 @@ Module( target: Name( ExprName { range: 170..171, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -364,7 +416,9 @@ Module( value: Name( ExprName { range: 186..187, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -387,14 +441,18 @@ Module( key: Name( ExprName { range: 190..191, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), value: Name( ExprName { range: 193..194, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -404,7 +462,9 @@ Module( target: Name( ExprName { range: 199..200, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -421,7 +481,9 @@ Module( parameter: Parameter { range: 211..212, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 211..212, }, annotation: None, @@ -437,7 +499,9 @@ Module( body: Name( ExprName { range: 214..215, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -460,14 +524,18 @@ Module( key: Name( ExprName { range: 232..233, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), value: Name( ExprName { range: 235..236, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -477,14 +545,18 @@ Module( target: Name( ExprName { range: 241..242, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 246..250, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -495,7 +567,9 @@ Module( value: Name( ExprName { range: 255..256, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -519,14 +593,18 @@ Module( key: Name( ExprName { range: 259..260, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), value: Name( ExprName { range: 262..263, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -536,14 +614,18 @@ Module( target: Name( ExprName { range: 268..269, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 273..277, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -555,7 +637,9 @@ Module( Name( ExprName { range: 287..288, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -579,14 +663,18 @@ Module( key: Name( ExprName { range: 291..292, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), value: Name( ExprName { range: 294..295, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -596,14 +684,18 @@ Module( target: Name( ExprName { range: 300..301, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 305..309, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -614,7 +706,9 @@ Module( value: Name( ExprName { range: 324..325, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -637,14 +731,18 @@ Module( key: Name( ExprName { range: 328..329, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), value: Name( ExprName { range: 331..332, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -654,14 +752,18 @@ Module( target: Name( ExprName { range: 337..338, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 342..346, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -679,7 +781,9 @@ Module( parameter: Parameter { range: 357..358, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 357..358, }, annotation: None, @@ -695,7 +799,9 @@ Module( body: Name( ExprName { range: 360..361, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star.py.snap index bc87a11aba6025..a6ffc48d03cff7 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star.py.snap @@ -21,7 +21,9 @@ Module( value: Name( ExprName { range: 128..129, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -40,7 +42,9 @@ Module( value: Name( ExprName { range: 134..134, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -62,7 +66,9 @@ Module( Name( ExprName { range: 137..138, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -90,14 +96,18 @@ Module( body: Name( ExprName { range: 145..146, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 160..161, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -131,7 +141,9 @@ Module( parameter: Parameter { range: 173..174, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 173..174, }, annotation: None, @@ -147,7 +159,9 @@ Module( body: Name( ExprName { range: 176..177, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -159,7 +173,9 @@ Module( Name( ExprName { range: 179..180, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -190,7 +206,9 @@ Module( Name( ExprName { range: 186..187, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -214,14 +232,18 @@ Module( Name( ExprName { range: 194..195, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 199..200, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -251,14 +273,18 @@ Module( Name( ExprName { range: 205..206, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 211..212, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -271,7 +297,9 @@ Module( Name( ExprName { range: 214..215, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -302,7 +330,9 @@ Module( Name( ExprName { range: 221..222, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -325,7 +355,9 @@ Module( operand: Name( ExprName { range: 233..234, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -337,7 +369,9 @@ Module( Name( ExprName { range: 236..237, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -371,7 +405,9 @@ Module( left: Name( ExprName { range: 245..246, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -382,7 +418,9 @@ Module( Name( ExprName { range: 250..251, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -410,7 +448,9 @@ Module( left: Name( ExprName { range: 256..257, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -421,7 +461,9 @@ Module( Name( ExprName { range: 265..266, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -449,7 +491,9 @@ Module( left: Name( ExprName { range: 271..272, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -460,7 +504,9 @@ Module( Name( ExprName { range: 275..276, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star_comprehension.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star_comprehension.py.snap index a5e9951e6dfee4..8ef43a88d24371 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star_comprehension.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star_comprehension.py.snap @@ -21,7 +21,9 @@ Module( value: Name( ExprName { range: 125..126, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -31,7 +33,9 @@ Module( Name( ExprName { range: 128..129, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -39,7 +43,9 @@ Module( value: Name( ExprName { range: 130..133, - id: "for", + id: Name( + "for", + ), ctx: Load, }, ), @@ -49,7 +55,9 @@ Module( Name( ExprName { range: 134..135, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -57,7 +65,9 @@ Module( value: Name( ExprName { range: 135..135, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -70,7 +80,9 @@ Module( left: Name( ExprName { range: 137..138, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -81,7 +93,9 @@ Module( Name( ExprName { range: 142..146, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -92,7 +106,9 @@ Module( value: Name( ExprName { range: 146..146, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_0.py.snap index f6729651186745..1d75d50ebb18bc 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_0.py.snap @@ -21,7 +21,9 @@ Module( Name( ExprName { range: 1..2, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -29,7 +31,9 @@ Module( value: Name( ExprName { range: 5..8, - id: "def", + id: Name( + "def", + ), ctx: Load, }, ), @@ -42,7 +46,9 @@ Module( func: Name( ExprName { range: 9..12, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -57,7 +63,9 @@ Module( value: Name( ExprName { range: 20..24, - id: "pass", + id: Name( + "pass", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_1.py.snap index e475ac928d5775..611a81139df815 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_1.py.snap @@ -21,7 +21,9 @@ Module( Name( ExprName { range: 1..2, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_2.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_2.py.snap index e116b76e2d21be..bbf66171e3c48f 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_2.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_2.py.snap @@ -21,7 +21,9 @@ Module( Name( ExprName { range: 1..2, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -46,7 +48,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 12..15, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_0.py.snap index 311a18cd33ddc2..ff9792e44e2f64 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_0.py.snap @@ -24,7 +24,9 @@ Module( target: Name( ExprName { range: 56..57, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -42,7 +44,9 @@ Module( value: Name( ExprName { range: 64..65, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -52,7 +56,9 @@ Module( Name( ExprName { range: 67..68, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -60,7 +66,9 @@ Module( value: Name( ExprName { range: 68..68, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -79,7 +87,9 @@ Module( value: Name( ExprName { range: 75..76, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -98,7 +108,9 @@ Module( left: Name( ExprName { range: 79..80, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -106,7 +118,9 @@ Module( right: Name( ExprName { range: 83..84, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_1.py.snap index 09964f98bfd203..b8790e23612ff8 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_1.py.snap @@ -21,7 +21,9 @@ Module( Name( ExprName { range: 58..59, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -29,7 +31,9 @@ Module( value: Name( ExprName { range: 61..62, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -48,7 +52,9 @@ Module( value: Name( ExprName { range: 67..67, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -58,7 +64,9 @@ Module( Name( ExprName { range: 69..70, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -66,7 +74,9 @@ Module( value: Name( ExprName { range: 72..73, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -85,7 +95,9 @@ Module( value: Name( ExprName { range: 78..78, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -104,7 +116,9 @@ Module( left: Name( ExprName { range: 81..82, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -112,7 +126,9 @@ Module( right: Name( ExprName { range: 85..86, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__recover.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__recover.py.snap index 4c7b359e7ea0c8..c48be7b9dfae6b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__recover.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__recover.py.snap @@ -19,7 +19,9 @@ Module( Name( ExprName { range: 89..89, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -185,7 +187,9 @@ Module( value: Name( ExprName { range: 160..160, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -207,7 +211,9 @@ Module( value: Name( ExprName { range: 204..204, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -229,7 +235,9 @@ Module( Name( ExprName { range: 207..208, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -237,7 +245,9 @@ Module( value: Name( ExprName { range: 210..211, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -247,7 +257,9 @@ Module( value: Name( ExprName { range: 215..215, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -257,7 +269,9 @@ Module( Name( ExprName { range: 217..218, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -265,7 +279,9 @@ Module( value: Name( ExprName { range: 220..221, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -290,7 +306,9 @@ Module( value: Name( ExprName { range: 312..313, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -301,7 +319,9 @@ Module( value: Name( ExprName { range: 315..316, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -311,7 +331,9 @@ Module( Name( ExprName { range: 318..319, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -319,7 +341,9 @@ Module( value: Name( ExprName { range: 321..322, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -332,7 +356,9 @@ Module( value: Name( ExprName { range: 325..326, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -343,7 +369,9 @@ Module( value: Name( ExprName { range: 328..329, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -365,7 +393,9 @@ Module( Name( ExprName { range: 332..333, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -376,7 +406,9 @@ Module( value: Name( ExprName { range: 336..337, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -389,7 +421,9 @@ Module( Name( ExprName { range: 339..340, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -400,7 +434,9 @@ Module( value: Name( ExprName { range: 343..344, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__emoji_identifiers.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__emoji_identifiers.py.snap index 0704457cf8efaa..a87df904afea81 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__emoji_identifiers.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__emoji_identifiers.py.snap @@ -16,7 +16,9 @@ Module( Name( ExprName { range: 0..1, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), @@ -24,7 +26,9 @@ Module( value: Name( ExprName { range: 5..5, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -37,7 +41,9 @@ Module( Name( ExprName { range: 32..33, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), @@ -45,7 +51,9 @@ Module( value: Name( ExprName { range: 37..37, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -61,7 +69,9 @@ Module( operand: Name( ExprName { range: 43..43, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_orelse_expr_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_orelse_expr_0.py.snap index 6d33d60b2105dc..205db6a86af239 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_orelse_expr_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_orelse_expr_0.py.snap @@ -18,21 +18,27 @@ Module( test: Name( ExprName { range: 58..62, - id: "expr", + id: Name( + "expr", + ), ctx: Load, }, ), body: Name( ExprName { range: 53..54, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 67..67, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -46,7 +52,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 73..76, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_orelse_expr_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_orelse_expr_1.py.snap index d1108c8dd56a6b..7e4f1b49357358 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_orelse_expr_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_orelse_expr_1.py.snap @@ -18,21 +18,27 @@ Module( test: Name( ExprName { range: 60..64, - id: "expr", + id: Name( + "expr", + ), ctx: Load, }, ), body: Name( ExprName { range: 55..56, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 69..69, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_test_expr_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_test_expr_0.py.snap index 6e386a36357961..a68c063f7cc099 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_test_expr_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_test_expr_0.py.snap @@ -18,21 +18,27 @@ Module( test: Name( ExprName { range: 55..55, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), body: Name( ExprName { range: 51..52, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 55..55, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -46,7 +52,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 61..64, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_test_expr_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_test_expr_1.py.snap index cca10a7160c18a..aceb90d69d9ab2 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_test_expr_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__missing_test_expr_1.py.snap @@ -18,21 +18,27 @@ Module( test: Name( ExprName { range: 57..57, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), body: Name( ExprName { range: 53..54, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 57..57, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__recover.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__recover.py.snap index 0a9c25c6acd0ed..c768bb46520e44 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__recover.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__if__recover.py.snap @@ -21,7 +21,9 @@ Module( value: Name( ExprName { range: 32..36, - id: "expr", + id: Name( + "expr", + ), ctx: Load, }, ), @@ -31,14 +33,18 @@ Module( body: Name( ExprName { range: 26..27, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 42..43, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -65,7 +71,9 @@ Module( parameter: Parameter { range: 56..57, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 56..57, }, annotation: None, @@ -81,7 +89,9 @@ Module( body: Name( ExprName { range: 59..60, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -90,14 +100,18 @@ Module( body: Name( ExprName { range: 44..45, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 66..67, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -118,7 +132,9 @@ Module( Name( ExprName { range: 79..80, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -128,14 +144,18 @@ Module( body: Name( ExprName { range: 68..69, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 86..87, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -155,7 +175,9 @@ Module( value: Name( ExprName { range: 104..105, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -164,14 +186,18 @@ Module( body: Name( ExprName { range: 88..89, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 111..112, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -188,14 +214,18 @@ Module( test: Name( ExprName { range: 147..151, - id: "expr", + id: Name( + "expr", + ), ctx: Load, }, ), body: Name( ExprName { range: 142..143, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -205,7 +235,9 @@ Module( value: Name( ExprName { range: 158..164, - id: "orelse", + id: Name( + "orelse", + ), ctx: Load, }, ), @@ -225,14 +257,18 @@ Module( test: Name( ExprName { range: 170..174, - id: "expr", + id: Name( + "expr", + ), ctx: Load, }, ), body: Name( ExprName { range: 165..166, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -243,7 +279,9 @@ Module( Name( ExprName { range: 186..187, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -263,14 +301,18 @@ Module( test: Name( ExprName { range: 193..197, - id: "expr", + id: Name( + "expr", + ), ctx: Load, }, ), body: Name( ExprName { range: 188..189, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -280,7 +322,9 @@ Module( value: Name( ExprName { range: 214..215, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__lambda_default_parameters.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__lambda_default_parameters.py.snap index fa45ab4e24a5a6..f7af0425967af5 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__lambda_default_parameters.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__lambda_default_parameters.py.snap @@ -25,7 +25,9 @@ Module( parameter: Parameter { range: 7..8, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 7..8, }, annotation: None, @@ -37,7 +39,9 @@ Module( parameter: Parameter { range: 10..11, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 10..11, }, annotation: None, @@ -58,7 +62,9 @@ Module( parameter: Parameter { range: 16..17, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 16..17, }, annotation: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__lambda_duplicate_parameters.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__lambda_duplicate_parameters.py.snap index 82f5f6132a9623..c3e18fe4e199c5 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__lambda_duplicate_parameters.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__lambda_duplicate_parameters.py.snap @@ -25,7 +25,9 @@ Module( parameter: Parameter { range: 7..8, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 7..8, }, annotation: None, @@ -37,7 +39,9 @@ Module( parameter: Parameter { range: 10..11, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 10..11, }, annotation: None, @@ -78,7 +82,9 @@ Module( parameter: Parameter { range: 23..24, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 23..24, }, annotation: None, @@ -93,7 +99,9 @@ Module( parameter: Parameter { range: 29..30, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 29..30, }, annotation: None, @@ -132,7 +140,9 @@ Module( parameter: Parameter { range: 42..43, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 42..43, }, annotation: None, @@ -144,7 +154,9 @@ Module( parameter: Parameter { range: 45..46, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 45..46, }, annotation: None, @@ -194,7 +206,9 @@ Module( parameter: Parameter { range: 61..62, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 61..62, }, annotation: None, @@ -206,7 +220,9 @@ Module( Parameter { range: 64..66, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 65..66, }, annotation: None, @@ -244,7 +260,9 @@ Module( parameter: Parameter { range: 78..79, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 78..79, }, annotation: None, @@ -258,7 +276,9 @@ Module( Parameter { range: 84..87, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 86..87, }, annotation: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__comprehension.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__comprehension.py.snap index 3c663b1a90bc50..9db3bdba1caa34 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__comprehension.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__comprehension.py.snap @@ -21,7 +21,9 @@ Module( value: Name( ExprName { range: 35..36, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -34,14 +36,18 @@ Module( target: Name( ExprName { range: 41..42, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 46..47, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -62,7 +68,9 @@ Module( elt: Name( ExprName { range: 68..69, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -80,7 +88,9 @@ Module( iter: Name( ExprName { range: 79..80, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -101,7 +111,9 @@ Module( elt: Name( ExprName { range: 83..84, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -129,7 +141,9 @@ Module( iter: Name( ExprName { range: 96..97, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -150,7 +164,9 @@ Module( elt: Name( ExprName { range: 100..101, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -163,7 +179,9 @@ Module( func: Name( ExprName { range: 106..110, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -177,7 +195,9 @@ Module( iter: Name( ExprName { range: 116..117, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -198,7 +218,9 @@ Module( elt: Name( ExprName { range: 120..121, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -212,14 +234,18 @@ Module( Name( ExprName { range: 127..128, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 130..131, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -229,7 +255,9 @@ Module( iter: Name( ExprName { range: 136..137, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -250,7 +278,9 @@ Module( elt: Name( ExprName { range: 156..157, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -260,7 +290,9 @@ Module( target: Name( ExprName { range: 162..163, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -270,7 +302,9 @@ Module( value: Name( ExprName { range: 168..169, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -294,7 +328,9 @@ Module( elt: Name( ExprName { range: 172..173, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -304,7 +340,9 @@ Module( target: Name( ExprName { range: 178..179, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -315,7 +353,9 @@ Module( Name( ExprName { range: 189..190, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -339,7 +379,9 @@ Module( elt: Name( ExprName { range: 193..194, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -349,7 +391,9 @@ Module( target: Name( ExprName { range: 199..200, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -359,7 +403,9 @@ Module( value: Name( ExprName { range: 215..216, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -382,7 +428,9 @@ Module( elt: Name( ExprName { range: 219..220, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -392,7 +440,9 @@ Module( target: Name( ExprName { range: 225..226, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -409,7 +459,9 @@ Module( parameter: Parameter { range: 237..238, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 237..238, }, annotation: None, @@ -425,7 +477,9 @@ Module( body: Name( ExprName { range: 240..241, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -448,7 +502,9 @@ Module( elt: Name( ExprName { range: 258..259, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -458,14 +514,18 @@ Module( target: Name( ExprName { range: 264..265, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 269..273, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -476,7 +536,9 @@ Module( value: Name( ExprName { range: 278..279, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -500,7 +562,9 @@ Module( elt: Name( ExprName { range: 282..283, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -510,14 +574,18 @@ Module( target: Name( ExprName { range: 288..289, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 293..297, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -529,7 +597,9 @@ Module( Name( ExprName { range: 307..308, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -553,7 +623,9 @@ Module( elt: Name( ExprName { range: 311..312, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -563,14 +635,18 @@ Module( target: Name( ExprName { range: 317..318, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 322..326, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -581,7 +657,9 @@ Module( value: Name( ExprName { range: 341..342, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -604,7 +682,9 @@ Module( elt: Name( ExprName { range: 345..346, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -614,14 +694,18 @@ Module( target: Name( ExprName { range: 351..352, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 356..360, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -639,7 +723,9 @@ Module( parameter: Parameter { range: 371..372, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 371..372, }, annotation: None, @@ -655,7 +741,9 @@ Module( body: Name( ExprName { range: 374..375, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_0.py.snap index 3c3f2be769ba7d..b40792e55c5d38 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_0.py.snap @@ -19,7 +19,9 @@ Module( Name( ExprName { range: 43..43, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_1.py.snap index b343c2c3cc56c7..56da9f088058a2 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_1.py.snap @@ -22,7 +22,9 @@ Module( left: Name( ExprName { range: 128..129, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -30,7 +32,9 @@ Module( right: Name( ExprName { range: 132..133, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_2.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_2.py.snap index 1e42422912b8b7..72466052fe0e9c 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_2.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_2.py.snap @@ -30,7 +30,9 @@ Module( left: Name( ExprName { range: 136..137, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -38,7 +40,9 @@ Module( right: Name( ExprName { range: 140..141, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_3.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_3.py.snap index faeaa38a8412a8..ddb569e85a0b25 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_3.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_3.py.snap @@ -44,7 +44,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 125..128, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__recover.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__recover.py.snap index 2ff84388a921d3..8eb57182c412c5 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__recover.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__recover.py.snap @@ -19,7 +19,9 @@ Module( Name( ExprName { range: 83..83, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -158,7 +160,9 @@ Module( left: Name( ExprName { range: 189..190, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -166,7 +170,9 @@ Module( right: Name( ExprName { range: 192..192, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -220,7 +226,9 @@ Module( value: Name( ExprName { range: 206..206, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__star_expression_precedence.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__star_expression_precedence.py.snap index 5d9c56c01328c2..29559506f2070e 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__star_expression_precedence.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__star_expression_precedence.py.snap @@ -22,7 +22,9 @@ Module( value: Name( ExprName { range: 87..88, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -32,7 +34,9 @@ Module( Name( ExprName { range: 91..92, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -58,7 +62,9 @@ Module( left: Name( ExprName { range: 96..97, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -69,7 +75,9 @@ Module( Name( ExprName { range: 101..102, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -82,7 +90,9 @@ Module( Name( ExprName { range: 104..105, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -109,7 +119,9 @@ Module( operand: Name( ExprName { range: 113..114, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -121,7 +133,9 @@ Module( Name( ExprName { range: 116..117, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -149,14 +163,18 @@ Module( Name( ExprName { range: 121..122, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 127..128, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -169,7 +187,9 @@ Module( Name( ExprName { range: 130..131, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -197,14 +217,18 @@ Module( Name( ExprName { range: 135..136, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 140..141, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -217,7 +241,9 @@ Module( Name( ExprName { range: 143..144, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -249,14 +275,18 @@ Module( body: Name( ExprName { range: 148..149, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 163..164, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -268,7 +298,9 @@ Module( Name( ExprName { range: 166..167, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -301,7 +333,9 @@ Module( parameter: Parameter { range: 178..179, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 178..179, }, annotation: None, @@ -317,7 +351,9 @@ Module( body: Name( ExprName { range: 181..182, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -329,7 +365,9 @@ Module( Name( ExprName { range: 184..185, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -355,7 +393,9 @@ Module( value: Name( ExprName { range: 189..190, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -375,7 +415,9 @@ Module( Name( ExprName { range: 197..198, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__invalid_target.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__invalid_target.py.snap index ca8a03f58f863e..431ff606ad22b0 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__invalid_target.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__invalid_target.py.snap @@ -21,12 +21,16 @@ Module( value: Name( ExprName { range: 59..60, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), attr: Identifier { - id: "y", + id: Name( + "y", + ), range: 61..62, }, ctx: Store, @@ -56,14 +60,18 @@ Module( value: Name( ExprName { range: 70..71, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), slice: Name( ExprName { range: 72..73, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -94,7 +102,9 @@ Module( value: Name( ExprName { range: 83..84, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -126,14 +136,18 @@ Module( Name( ExprName { range: 93..94, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), Name( ExprName { range: 96..97, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_0.py.snap index f2583dca28154b..ca7cae00974dd2 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_0.py.snap @@ -15,7 +15,9 @@ Module( value: Name( ExprName { range: 71..72, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_1.py.snap index 4a3dc48c47acc4..5236d2e3550be2 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_1.py.snap @@ -18,14 +18,18 @@ Module( target: Name( ExprName { range: 29..30, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), value: Name( ExprName { range: 33..33, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_2.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_2.py.snap index 7da176072a4518..c7456ca3292219 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_2.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_2.py.snap @@ -18,14 +18,18 @@ Module( target: Name( ExprName { range: 62..63, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), value: Name( ExprName { range: 68..71, - id: "def", + id: Name( + "def", + ), ctx: Load, }, ), @@ -42,7 +46,9 @@ Module( func: Name( ExprName { range: 72..75, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -56,7 +62,9 @@ Module( annotation: Name( ExprName { range: 83..87, - id: "pass", + id: Name( + "pass", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_3.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_3.py.snap index 4fedd3fdad4a42..0cad2eef8d0602 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_3.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_3.py.snap @@ -18,7 +18,9 @@ Module( target: Name( ExprName { range: 101..102, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -28,7 +30,9 @@ Module( left: Name( ExprName { range: 107..108, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -36,7 +40,9 @@ Module( right: Name( ExprName { range: 111..112, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_4.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_4.py.snap index 916b3919331c7e..379c1bf8ec276a 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_4.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_4.py.snap @@ -18,14 +18,18 @@ Module( target: Name( ExprName { range: 65..66, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), value: Name( ExprName { range: 69..69, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -42,7 +46,9 @@ Module( left: Name( ExprName { range: 73..74, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -50,7 +56,9 @@ Module( right: Name( ExprName { range: 77..78, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__generator.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__generator.py.snap index 776e7601ce9231..9e646c68fa890e 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__generator.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__generator.py.snap @@ -21,7 +21,9 @@ Module( value: Name( ExprName { range: 2..3, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -34,14 +36,18 @@ Module( target: Name( ExprName { range: 8..9, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 13..14, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -67,7 +73,9 @@ Module( target: Name( ExprName { range: 17..18, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -95,14 +103,18 @@ Module( target: Name( ExprName { range: 29..30, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 34..35, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_0.py.snap index f7c864a2655d84..885314240b09c5 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_0.py.snap @@ -15,7 +15,9 @@ Module( value: Name( ExprName { range: 47..47, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_1.py.snap index 37bfd450e06000..4ae7a54ab9aaf8 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_1.py.snap @@ -18,7 +18,9 @@ Module( left: Name( ExprName { range: 132..133, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -26,7 +28,9 @@ Module( right: Name( ExprName { range: 136..137, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_2.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_2.py.snap index 6c0f8e9524108d..aa86072a1b6b56 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_2.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_2.py.snap @@ -30,7 +30,9 @@ Module( left: Name( ExprName { range: 141..142, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -38,7 +40,9 @@ Module( right: Name( ExprName { range: 145..146, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_3.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_3.py.snap index e0708719b1f002..80f39a4ca466db 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_3.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_3.py.snap @@ -45,7 +45,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 129..132, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__parenthesized.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__parenthesized.py.snap index 363ea166276112..34c701824cabc3 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__parenthesized.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__parenthesized.py.snap @@ -18,7 +18,9 @@ Module( value: Name( ExprName { range: 68..69, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -33,7 +35,9 @@ Module( value: Name( ExprName { range: 119..120, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple.py.snap index 5227204d9882c6..969ce306026ded 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple.py.snap @@ -19,7 +19,9 @@ Module( Name( ExprName { range: 84..84, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -152,7 +154,9 @@ Module( left: Name( ExprName { range: 190..191, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -160,7 +164,9 @@ Module( right: Name( ExprName { range: 193..193, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -209,14 +215,18 @@ Module( Name( ExprName { range: 255..256, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 258..259, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -231,7 +241,9 @@ Module( Name( ExprName { range: 266..267, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple_starred_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple_starred_expr.py.snap index 49b3005abfe137..8f8a4adfa0eb3e 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple_starred_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple_starred_expr.py.snap @@ -25,7 +25,9 @@ Module( left: Name( ExprName { range: 163..164, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -36,7 +38,9 @@ Module( Name( ExprName { range: 168..169, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -49,7 +53,9 @@ Module( Name( ExprName { range: 171..172, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -62,7 +68,9 @@ Module( left: Name( ExprName { range: 175..176, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -73,7 +81,9 @@ Module( Name( ExprName { range: 180..181, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -107,7 +117,9 @@ Module( operand: Name( ExprName { range: 189..190, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -119,7 +131,9 @@ Module( Name( ExprName { range: 192..193, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -133,7 +147,9 @@ Module( operand: Name( ExprName { range: 200..201, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -167,14 +183,18 @@ Module( Name( ExprName { range: 205..206, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 211..212, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -187,7 +207,9 @@ Module( Name( ExprName { range: 214..215, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -202,14 +224,18 @@ Module( Name( ExprName { range: 218..219, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 224..225, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -244,14 +270,18 @@ Module( Name( ExprName { range: 229..230, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 234..235, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -264,7 +294,9 @@ Module( Name( ExprName { range: 237..238, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -279,14 +311,18 @@ Module( Name( ExprName { range: 241..242, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 246..247, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -325,14 +361,18 @@ Module( body: Name( ExprName { range: 251..252, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 266..267, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -344,7 +384,9 @@ Module( Name( ExprName { range: 269..270, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -363,14 +405,18 @@ Module( body: Name( ExprName { range: 273..274, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 288..289, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -409,7 +455,9 @@ Module( parameter: Parameter { range: 300..301, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 300..301, }, annotation: None, @@ -425,7 +473,9 @@ Module( body: Name( ExprName { range: 303..304, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -437,7 +487,9 @@ Module( Name( ExprName { range: 306..307, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -457,7 +509,9 @@ Module( parameter: Parameter { range: 317..318, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 317..318, }, annotation: None, @@ -473,7 +527,9 @@ Module( body: Name( ExprName { range: 320..321, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -505,7 +561,9 @@ Module( value: Name( ExprName { range: 325..326, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -525,7 +583,9 @@ Module( Name( ExprName { range: 333..334, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -538,7 +598,9 @@ Module( value: Name( ExprName { range: 337..338, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -578,7 +640,9 @@ Module( left: Name( ExprName { range: 368..369, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -589,7 +653,9 @@ Module( Name( ExprName { range: 373..374, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -602,7 +668,9 @@ Module( Name( ExprName { range: 376..377, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -615,7 +683,9 @@ Module( left: Name( ExprName { range: 380..381, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -626,7 +696,9 @@ Module( Name( ExprName { range: 385..386, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -660,7 +732,9 @@ Module( operand: Name( ExprName { range: 392..393, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -672,7 +746,9 @@ Module( Name( ExprName { range: 395..396, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -686,7 +762,9 @@ Module( operand: Name( ExprName { range: 403..404, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -720,14 +798,18 @@ Module( Name( ExprName { range: 406..407, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 412..413, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -740,7 +822,9 @@ Module( Name( ExprName { range: 415..416, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -755,14 +839,18 @@ Module( Name( ExprName { range: 419..420, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 425..426, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -797,14 +885,18 @@ Module( Name( ExprName { range: 428..429, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 433..434, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -817,7 +909,9 @@ Module( Name( ExprName { range: 436..437, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -832,14 +926,18 @@ Module( Name( ExprName { range: 440..441, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 445..446, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -878,14 +976,18 @@ Module( body: Name( ExprName { range: 448..449, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 463..464, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -897,7 +999,9 @@ Module( Name( ExprName { range: 466..467, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -916,14 +1020,18 @@ Module( body: Name( ExprName { range: 470..471, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 485..486, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -962,7 +1070,9 @@ Module( parameter: Parameter { range: 495..496, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 495..496, }, annotation: None, @@ -978,7 +1088,9 @@ Module( body: Name( ExprName { range: 498..499, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -990,7 +1102,9 @@ Module( Name( ExprName { range: 501..502, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -1010,7 +1124,9 @@ Module( parameter: Parameter { range: 512..513, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 512..513, }, annotation: None, @@ -1026,7 +1142,9 @@ Module( body: Name( ExprName { range: 515..516, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1051,7 +1169,9 @@ Module( value: Name( ExprName { range: 518..519, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1078,7 +1198,9 @@ Module( Name( ExprName { range: 526..527, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -1088,7 +1210,9 @@ Module( value: Name( ExprName { range: 530..531, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__comprehension.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__comprehension.py.snap index a4bff441f8cb40..18d2d99df59d24 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__comprehension.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__comprehension.py.snap @@ -21,7 +21,9 @@ Module( value: Name( ExprName { range: 35..36, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -34,14 +36,18 @@ Module( target: Name( ExprName { range: 41..42, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 46..47, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -62,7 +68,9 @@ Module( elt: Name( ExprName { range: 68..69, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -80,7 +88,9 @@ Module( iter: Name( ExprName { range: 79..80, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -101,7 +111,9 @@ Module( elt: Name( ExprName { range: 83..84, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -129,7 +141,9 @@ Module( iter: Name( ExprName { range: 96..97, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -150,7 +164,9 @@ Module( elt: Name( ExprName { range: 100..101, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -163,7 +179,9 @@ Module( func: Name( ExprName { range: 106..110, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -177,7 +195,9 @@ Module( iter: Name( ExprName { range: 116..117, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -198,7 +218,9 @@ Module( elt: Name( ExprName { range: 120..121, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -212,14 +234,18 @@ Module( Name( ExprName { range: 127..128, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 130..131, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -229,7 +255,9 @@ Module( iter: Name( ExprName { range: 136..137, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -250,7 +278,9 @@ Module( elt: Name( ExprName { range: 156..157, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -260,7 +290,9 @@ Module( target: Name( ExprName { range: 162..163, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -270,7 +302,9 @@ Module( value: Name( ExprName { range: 168..169, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -294,7 +328,9 @@ Module( elt: Name( ExprName { range: 172..173, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -304,7 +340,9 @@ Module( target: Name( ExprName { range: 178..179, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -315,7 +353,9 @@ Module( Name( ExprName { range: 189..190, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -339,7 +379,9 @@ Module( elt: Name( ExprName { range: 193..194, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -349,7 +391,9 @@ Module( target: Name( ExprName { range: 199..200, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -359,7 +403,9 @@ Module( value: Name( ExprName { range: 215..216, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -382,7 +428,9 @@ Module( elt: Name( ExprName { range: 219..220, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -392,7 +440,9 @@ Module( target: Name( ExprName { range: 225..226, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -409,7 +459,9 @@ Module( parameter: Parameter { range: 237..238, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 237..238, }, annotation: None, @@ -425,7 +477,9 @@ Module( body: Name( ExprName { range: 240..241, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -448,7 +502,9 @@ Module( elt: Name( ExprName { range: 258..259, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -458,14 +514,18 @@ Module( target: Name( ExprName { range: 264..265, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 269..273, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -476,7 +536,9 @@ Module( value: Name( ExprName { range: 278..279, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -500,7 +562,9 @@ Module( elt: Name( ExprName { range: 282..283, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -510,14 +574,18 @@ Module( target: Name( ExprName { range: 288..289, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 293..297, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -529,7 +597,9 @@ Module( Name( ExprName { range: 307..308, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -553,7 +623,9 @@ Module( elt: Name( ExprName { range: 311..312, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -563,14 +635,18 @@ Module( target: Name( ExprName { range: 317..318, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 322..326, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -581,7 +657,9 @@ Module( value: Name( ExprName { range: 341..342, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -604,7 +682,9 @@ Module( elt: Name( ExprName { range: 345..346, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -614,14 +694,18 @@ Module( target: Name( ExprName { range: 351..352, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 356..360, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -639,7 +723,9 @@ Module( parameter: Parameter { range: 371..372, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 371..372, }, annotation: None, @@ -655,7 +741,9 @@ Module( body: Name( ExprName { range: 374..375, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_0.py.snap index 18c6034e1e43ca..785ceda896b4ee 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_0.py.snap @@ -19,7 +19,9 @@ Module( Name( ExprName { range: 47..47, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_1.py.snap index 340384ab77d7ff..110db59cf0049a 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_1.py.snap @@ -22,7 +22,9 @@ Module( left: Name( ExprName { range: 131..132, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -30,7 +32,9 @@ Module( right: Name( ExprName { range: 135..136, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_2.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_2.py.snap index 9cdfecacebe6e2..382cbbe3421bbc 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_2.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_2.py.snap @@ -30,7 +30,9 @@ Module( left: Name( ExprName { range: 139..140, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -38,7 +40,9 @@ Module( right: Name( ExprName { range: 143..144, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_3.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_3.py.snap index 5c7dcaa38888ee..4f320db5cee76b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_3.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_3.py.snap @@ -43,7 +43,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 129..132, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__recover.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__recover.py.snap index 946b061be1f436..09b702ed56679f 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__recover.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__recover.py.snap @@ -19,7 +19,9 @@ Module( Name( ExprName { range: 198..198, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -157,7 +159,9 @@ Module( left: Name( ExprName { range: 304..305, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -165,7 +169,9 @@ Module( right: Name( ExprName { range: 307..307, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -217,7 +223,9 @@ Module( value: Name( ExprName { range: 321..321, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__star_expression_precedence.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__star_expression_precedence.py.snap index 978e113160587c..8f8d20f2d05c7b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__star_expression_precedence.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__star_expression_precedence.py.snap @@ -22,7 +22,9 @@ Module( value: Name( ExprName { range: 86..87, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -32,7 +34,9 @@ Module( Name( ExprName { range: 90..91, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -57,7 +61,9 @@ Module( left: Name( ExprName { range: 95..96, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -68,7 +74,9 @@ Module( Name( ExprName { range: 100..101, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -81,7 +89,9 @@ Module( Name( ExprName { range: 103..104, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -107,7 +117,9 @@ Module( operand: Name( ExprName { range: 112..113, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -119,7 +131,9 @@ Module( Name( ExprName { range: 115..116, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -146,14 +160,18 @@ Module( Name( ExprName { range: 120..121, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 126..127, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -166,7 +184,9 @@ Module( Name( ExprName { range: 129..130, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -193,14 +213,18 @@ Module( Name( ExprName { range: 134..135, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 139..140, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -213,7 +237,9 @@ Module( Name( ExprName { range: 142..143, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -244,14 +270,18 @@ Module( body: Name( ExprName { range: 147..148, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 162..163, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -263,7 +293,9 @@ Module( Name( ExprName { range: 165..166, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -295,7 +327,9 @@ Module( parameter: Parameter { range: 177..178, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 177..178, }, annotation: None, @@ -311,7 +345,9 @@ Module( body: Name( ExprName { range: 180..181, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -323,7 +359,9 @@ Module( Name( ExprName { range: 183..184, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -348,7 +386,9 @@ Module( value: Name( ExprName { range: 188..189, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -368,7 +408,9 @@ Module( Name( ExprName { range: 196..197, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__subscript__invalid_slice_element.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__subscript__invalid_slice_element.py.snap index 45fbf9dad61f03..4e7eb4be54831d 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__subscript__invalid_slice_element.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__subscript__invalid_slice_element.py.snap @@ -18,7 +18,9 @@ Module( value: Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -32,7 +34,9 @@ Module( target: Name( ExprName { range: 2..3, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -65,7 +69,9 @@ Module( value: Name( ExprName { range: 33..34, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -79,7 +85,9 @@ Module( value: Name( ExprName { range: 36..37, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -105,7 +113,9 @@ Module( value: Name( ExprName { range: 40..41, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -120,7 +130,9 @@ Module( value: Name( ExprName { range: 44..45, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -145,7 +157,9 @@ Module( value: Name( ExprName { range: 47..48, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -161,7 +175,9 @@ Module( value: Name( ExprName { range: 52..53, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -185,14 +201,18 @@ Module( value: Name( ExprName { range: 70..71, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), slice: Name( ExprName { range: 72..73, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -210,7 +230,9 @@ Module( value: Name( ExprName { range: 123..124, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -223,7 +245,9 @@ Module( value: Name( ExprName { range: 126..127, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__subscript__unclosed_slice_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__subscript__unclosed_slice_0.py.snap index 19fe8dd3eda309..a7d8d80b239d0b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__subscript__unclosed_slice_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__subscript__unclosed_slice_0.py.snap @@ -18,7 +18,9 @@ Module( value: Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -33,7 +35,9 @@ Module( left: Name( ExprName { range: 5..6, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -41,7 +45,9 @@ Module( right: Name( ExprName { range: 9..10, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__subscript__unclosed_slice_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__subscript__unclosed_slice_1.py.snap index 25e36ee3deb14f..c844e97e144c71 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__subscript__unclosed_slice_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__subscript__unclosed_slice_1.py.snap @@ -18,7 +18,9 @@ Module( value: Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -31,7 +33,9 @@ Module( Name( ExprName { range: 6..9, - id: "def", + id: Name( + "def", + ), ctx: Load, }, ), @@ -52,7 +56,9 @@ Module( func: Name( ExprName { range: 10..13, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -66,7 +72,9 @@ Module( annotation: Name( ExprName { range: 21..25, - id: "pass", + id: Name( + "pass", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary.py.snap index 1f4c963db2a69d..eed941eed12c0a 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary.py.snap @@ -19,7 +19,9 @@ Module( operand: Name( ExprName { range: 4..5, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary__named_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary__named_expression.py.snap index 89a46ff73ece5d..fbf1127948e9cd 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary__named_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary__named_expression.py.snap @@ -19,7 +19,9 @@ Module( operand: Name( ExprName { range: 1..2, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -50,7 +52,9 @@ Module( operand: Name( ExprName { range: 12..13, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary__no_expression_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary__no_expression_0.py.snap index bc8357cc3c5c7b..254234464d7298 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary__no_expression_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary__no_expression_0.py.snap @@ -19,7 +19,9 @@ Module( operand: Name( ExprName { range: 3..3, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -36,7 +38,9 @@ Module( left: Name( ExprName { range: 5..6, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -44,7 +48,9 @@ Module( right: Name( ExprName { range: 9..10, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary__no_expression_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary__no_expression_1.py.snap index c53f05dc108d09..e5f746f1677f0e 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary__no_expression_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__unary__no_expression_1.py.snap @@ -19,7 +19,9 @@ Module( operand: Name( ExprName { range: 1..1, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -36,7 +38,9 @@ Module( left: Name( ExprName { range: 3..4, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -44,7 +48,9 @@ Module( right: Name( ExprName { range: 7..8, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield__named_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield__named_expression.py.snap index 933fd61a1ddf7e..74fd3fa46f60bb 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield__named_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield__named_expression.py.snap @@ -19,7 +19,9 @@ Module( Name( ExprName { range: 58..59, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -63,7 +65,9 @@ Module( Name( ExprName { range: 75..76, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield__star_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield__star_expression.py.snap index 69d607d70392f3..568e059d389d7b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield__star_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield__star_expression.py.snap @@ -22,7 +22,9 @@ Module( value: Name( ExprName { range: 45..46, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -56,14 +58,18 @@ Module( Name( ExprName { range: 56..57, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 62..63, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -76,7 +82,9 @@ Module( Name( ExprName { range: 65..66, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield_from__starred_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield_from__starred_expression.py.snap index 866aae89fc93d3..5fb45cc7bf3f53 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield_from__starred_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield_from__starred_expression.py.snap @@ -21,7 +21,9 @@ Module( value: Name( ExprName { range: 82..83, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -48,7 +50,9 @@ Module( value: Name( ExprName { range: 96..97, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -58,7 +62,9 @@ Module( Name( ExprName { range: 99..100, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield_from__unparenthesized.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield_from__unparenthesized.py.snap index 8ee4ab27c556ff..414c2287376b76 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield_from__unparenthesized.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield_from__unparenthesized.py.snap @@ -18,7 +18,9 @@ Module( value: Name( ExprName { range: 46..47, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -52,14 +54,18 @@ Module( Name( ExprName { range: 100..101, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 103..104, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -85,7 +91,9 @@ Module( Name( ExprName { range: 180..181, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -100,14 +108,18 @@ Module( Name( ExprName { range: 184..185, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 190..191, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_empty_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_empty_expression.py.snap index 6f8fdf7b09eda3..adc3957e11f424 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_empty_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_empty_expression.py.snap @@ -27,7 +27,9 @@ Module( expression: Name( ExprName { range: 3..3, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -68,7 +70,9 @@ Module( expression: Name( ExprName { range: 9..9, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_invalid_conversion_flag_name_tok.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_invalid_conversion_flag_name_tok.py.snap index 43b521ce6a48b8..d87237b2cab80a 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_invalid_conversion_flag_name_tok.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_invalid_conversion_flag_name_tok.py.snap @@ -27,7 +27,9 @@ Module( expression: Name( ExprName { range: 3..4, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_invalid_conversion_flag_other_tok.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_invalid_conversion_flag_other_tok.py.snap index 7376ec2087bff2..79825642434110 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_invalid_conversion_flag_other_tok.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_invalid_conversion_flag_other_tok.py.snap @@ -27,7 +27,9 @@ Module( expression: Name( ExprName { range: 3..4, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -68,7 +70,9 @@ Module( expression: Name( ExprName { range: 14..15, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_invalid_starred_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_invalid_starred_expr.py.snap index df5f3b0e8d1d73..c69d074cf1996c 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_invalid_starred_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_invalid_starred_expr.py.snap @@ -30,7 +30,9 @@ Module( value: Name( ExprName { range: 81..81, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -82,14 +84,18 @@ Module( Name( ExprName { range: 88..89, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 94..95, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -143,7 +149,9 @@ Module( Name( ExprName { range: 108..109, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_lambda_without_parentheses.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_lambda_without_parentheses.py.snap index 669ca2dd2ba07d..bbe499d2a7c296 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_lambda_without_parentheses.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_lambda_without_parentheses.py.snap @@ -37,7 +37,9 @@ Module( parameter: Parameter { range: 10..11, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 10..11, }, annotation: None, @@ -53,7 +55,9 @@ Module( body: Name( ExprName { range: 12..12, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_unclosed_lbrace.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_unclosed_lbrace.py.snap index bdd816e505aa19..acf448c9758342 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_unclosed_lbrace.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_unclosed_lbrace.py.snap @@ -27,7 +27,9 @@ Module( expression: Name( ExprName { range: 3..3, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -68,7 +70,9 @@ Module( expression: Name( ExprName { range: 8..11, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -109,7 +113,9 @@ Module( expression: Name( ExprName { range: 18..21, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -156,7 +162,9 @@ Module( expression: Name( ExprName { range: 27..27, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -183,7 +191,9 @@ Module( expression: Name( ExprName { range: 34..34, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_unclosed_lbrace_in_format_spec.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_unclosed_lbrace_in_format_spec.py.snap index 8fe99992990824..31107940a9b495 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_unclosed_lbrace_in_format_spec.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_unclosed_lbrace_in_format_spec.py.snap @@ -33,7 +33,9 @@ Module( expression: Name( ExprName { range: 9..10, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -85,7 +87,9 @@ Module( expression: Name( ExprName { range: 22..23, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_iter_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_iter_expr.py.snap index 13d3c6dca1e17c..c7c116902b3b4c 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_iter_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_iter_expr.py.snap @@ -16,7 +16,9 @@ Module( target: Name( ExprName { range: 4..5, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -31,14 +33,18 @@ Module( Name( ExprName { range: 10..11, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 16..17, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -70,7 +76,9 @@ Module( target: Name( ExprName { range: 27..28, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -81,7 +89,9 @@ Module( Name( ExprName { range: 38..39, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -110,14 +120,18 @@ Module( target: Name( ExprName { range: 49..55, - id: "target", + id: Name( + "target", + ), ctx: Store, }, ), iter: Name( ExprName { range: 59..60, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_target.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_target.py.snap index 10e86925536094..bdd32c63ef5817 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_target.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_target.py.snap @@ -24,7 +24,9 @@ Module( iter: Name( ExprName { range: 9..10, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -68,7 +70,9 @@ Module( iter: Name( ExprName { range: 27..28, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -102,14 +106,18 @@ Module( Name( ExprName { range: 39..40, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 45..46, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -122,7 +130,9 @@ Module( iter: Name( ExprName { range: 50..51, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -154,7 +164,9 @@ Module( left: Name( ExprName { range: 62..63, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -162,7 +174,9 @@ Module( right: Name( ExprName { range: 66..67, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -174,7 +188,9 @@ Module( iter: Name( ExprName { range: 71..72, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -203,7 +219,9 @@ Module( value: Name( ExprName { range: 88..89, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -212,7 +230,9 @@ Module( iter: Name( ExprName { range: 93..94, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -245,7 +265,9 @@ Module( left: Name( ExprName { range: 110..111, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -256,7 +278,9 @@ Module( Name( ExprName { range: 115..116, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -269,7 +293,9 @@ Module( iter: Name( ExprName { range: 116..116, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -299,7 +325,9 @@ Module( Name( ExprName { range: 127..128, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -314,7 +342,9 @@ Module( Name( ExprName { range: 133..134, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -357,7 +387,9 @@ Module( iter: Name( ExprName { range: 147..148, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_target_binary_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_target_binary_expr.py.snap index 7d06a792e973bc..32eb9c6a63014b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_target_binary_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_target_binary_expr.py.snap @@ -19,7 +19,9 @@ Module( left: Name( ExprName { range: 4..5, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -30,7 +32,9 @@ Module( Name( ExprName { range: 13..14, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -40,7 +44,9 @@ Module( iter: Name( ExprName { range: 18..19, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -69,7 +75,9 @@ Module( left: Name( ExprName { range: 29..30, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -80,7 +88,9 @@ Module( Name( ExprName { range: 34..35, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -90,7 +100,9 @@ Module( iter: Name( ExprName { range: 39..40, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -121,14 +133,18 @@ Module( Name( ExprName { range: 50..51, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 55..56, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -138,7 +154,9 @@ Module( iter: Name( ExprName { range: 60..61, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -168,7 +186,9 @@ Module( operand: Name( ExprName { range: 72..73, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -177,7 +197,9 @@ Module( iter: Name( ExprName { range: 77..78, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -207,7 +229,9 @@ Module( operand: Name( ExprName { range: 92..93, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -216,7 +240,9 @@ Module( iter: Name( ExprName { range: 97..98, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -245,7 +271,9 @@ Module( left: Name( ExprName { range: 108..109, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -253,7 +281,9 @@ Module( right: Name( ExprName { range: 112..113, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -262,7 +292,9 @@ Module( iter: Name( ExprName { range: 117..118, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_target_in_keyword.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_target_in_keyword.py.snap index c6e9447da789eb..4633b5e08adf72 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_target_in_keyword.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_target_in_keyword.py.snap @@ -19,7 +19,9 @@ Module( func: Name( ExprName { range: 4..5, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), @@ -32,7 +34,9 @@ Module( left: Name( ExprName { range: 6..7, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -43,7 +47,9 @@ Module( Name( ExprName { range: 11..12, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -58,7 +64,9 @@ Module( iter: Name( ExprName { range: 17..23, - id: "target", + id: Name( + "target", + ), ctx: Load, }, ), @@ -90,7 +98,9 @@ Module( left: Name( ExprName { range: 34..35, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -101,7 +111,9 @@ Module( Name( ExprName { range: 39..40, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -118,7 +130,9 @@ Module( iter: Name( ExprName { range: 47..51, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), @@ -147,7 +161,9 @@ Module( left: Name( ExprName { range: 62..63, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -158,7 +174,9 @@ Module( Name( ExprName { range: 67..68, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -168,7 +186,9 @@ Module( iter: Name( ExprName { range: 73..77, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), @@ -201,7 +221,9 @@ Module( left: Name( ExprName { range: 88..89, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -212,7 +234,9 @@ Module( Name( ExprName { range: 93..94, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -222,7 +246,9 @@ Module( Name( ExprName { range: 96..97, - id: "z", + id: Name( + "z", + ), ctx: Store, }, ), @@ -234,7 +260,9 @@ Module( iter: Name( ExprName { range: 102..106, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), @@ -267,7 +295,9 @@ Module( left: Name( ExprName { range: 117..118, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -278,7 +308,9 @@ Module( Name( ExprName { range: 122..123, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -288,7 +320,9 @@ Module( Name( ExprName { range: 125..126, - id: "z", + id: Name( + "z", + ), ctx: Store, }, ), @@ -299,7 +333,9 @@ Module( iter: Name( ExprName { range: 131..135, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), @@ -332,7 +368,9 @@ Module( left: Name( ExprName { range: 146..147, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -343,7 +381,9 @@ Module( Name( ExprName { range: 151..152, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -353,7 +393,9 @@ Module( Name( ExprName { range: 154..155, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -363,7 +405,9 @@ Module( iter: Name( ExprName { range: 160..164, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_missing_in_keyword.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_missing_in_keyword.py.snap index 007a4ef75d67dc..016a80cb29f512 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_missing_in_keyword.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_missing_in_keyword.py.snap @@ -16,14 +16,18 @@ Module( target: Name( ExprName { range: 4..5, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), iter: Name( ExprName { range: 6..7, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -49,14 +53,18 @@ Module( target: Name( ExprName { range: 17..18, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), iter: Name( ExprName { range: 18..18, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_missing_iter.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_missing_iter.py.snap index 93821ecf7c64fa..6dfaa5c6e6d145 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_missing_iter.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_missing_iter.py.snap @@ -16,14 +16,18 @@ Module( target: Name( ExprName { range: 4..5, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 8..8, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -35,7 +39,9 @@ Module( Name( ExprName { range: 14..15, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_missing_target.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_missing_target.py.snap index dd0bb8cfe41662..0b1bd26d4fcf70 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_missing_target.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_missing_target.py.snap @@ -16,14 +16,18 @@ Module( target: Name( ExprName { range: 4..6, - id: "in", + id: Name( + "in", + ), ctx: Store, }, ), iter: Name( ExprName { range: 7..8, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_dotted_names.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_dotted_names.py.snap index 3ba6f7198ffb1a..0d0efc6c06c7a3 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_dotted_names.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_dotted_names.py.snap @@ -14,7 +14,9 @@ Module( range: 0..16, module: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 5..6, }, ), @@ -22,7 +24,9 @@ Module( Alias { range: 14..15, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 14..15, }, asname: None, @@ -36,7 +40,9 @@ Module( range: 17..34, module: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 22..23, }, ), @@ -44,7 +50,9 @@ Module( Alias { range: 31..32, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 31..32, }, asname: None, @@ -52,7 +60,9 @@ Module( Alias { range: 33..34, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 33..34, }, asname: None, @@ -66,7 +76,9 @@ Module( range: 35..66, module: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 40..41, }, ), @@ -74,7 +86,9 @@ Module( Alias { range: 49..50, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 49..50, }, asname: None, @@ -82,7 +96,9 @@ Module( Alias { range: 52..53, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 52..53, }, asname: None, @@ -90,7 +106,9 @@ Module( Alias { range: 54..55, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 54..55, }, asname: None, @@ -98,7 +116,9 @@ Module( Alias { range: 57..58, name: Identifier { - id: "d", + id: Name( + "d", + ), range: 57..58, }, asname: None, @@ -106,7 +126,9 @@ Module( Alias { range: 60..61, name: Identifier { - id: "e", + id: Name( + "e", + ), range: 60..61, }, asname: None, @@ -114,7 +136,9 @@ Module( Alias { range: 62..63, name: Identifier { - id: "f", + id: Name( + "f", + ), range: 62..63, }, asname: None, @@ -122,7 +146,9 @@ Module( Alias { range: 65..66, name: Identifier { - id: "g", + id: Name( + "g", + ), range: 65..66, }, asname: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_empty_names.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_empty_names.py.snap index 1b446fb502e6d4..4cefe0acafeb4c 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_empty_names.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_empty_names.py.snap @@ -14,7 +14,9 @@ Module( range: 0..13, module: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 5..6, }, ), @@ -27,7 +29,9 @@ Module( range: 14..30, module: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 19..20, }, ), @@ -40,7 +44,9 @@ Module( range: 31..47, module: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 36..37, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_missing_module.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_missing_module.py.snap index 4cb803abd18484..a337c46facf914 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_missing_module.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_missing_module.py.snap @@ -25,7 +25,9 @@ Module( Alias { range: 17..18, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 17..18, }, asname: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_missing_rpar.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_missing_rpar.py.snap index df0c2c6587a217..29620f4315c0a3 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_missing_rpar.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_missing_rpar.py.snap @@ -14,7 +14,9 @@ Module( range: 0..19, module: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 5..6, }, ), @@ -22,7 +24,9 @@ Module( Alias { range: 15..16, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 15..16, }, asname: None, @@ -30,7 +34,9 @@ Module( Alias { range: 18..19, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 18..19, }, asname: None, @@ -71,7 +77,9 @@ Module( range: 26..46, module: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 31..32, }, ), @@ -79,7 +87,9 @@ Module( Alias { range: 41..42, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 41..42, }, asname: None, @@ -87,7 +97,9 @@ Module( Alias { range: 44..45, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 44..45, }, asname: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_star_with_other_names.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_star_with_other_names.py.snap index a82029dfb57011..9bb7ec61021cf7 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_star_with_other_names.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_star_with_other_names.py.snap @@ -14,7 +14,9 @@ Module( range: 0..18, module: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 5..6, }, ), @@ -22,7 +24,9 @@ Module( Alias { range: 14..15, name: Identifier { - id: "*", + id: Name( + "*", + ), range: 14..15, }, asname: None, @@ -30,7 +34,9 @@ Module( Alias { range: 17..18, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 17..18, }, asname: None, @@ -44,7 +50,9 @@ Module( range: 19..40, module: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 24..25, }, ), @@ -52,7 +60,9 @@ Module( Alias { range: 33..34, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 33..34, }, asname: None, @@ -60,7 +70,9 @@ Module( Alias { range: 36..37, name: Identifier { - id: "*", + id: Name( + "*", + ), range: 36..37, }, asname: None, @@ -68,7 +80,9 @@ Module( Alias { range: 39..40, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 39..40, }, asname: None, @@ -82,7 +96,9 @@ Module( range: 41..64, module: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 46..47, }, ), @@ -90,7 +106,9 @@ Module( Alias { range: 55..56, name: Identifier { - id: "*", + id: Name( + "*", + ), range: 55..56, }, asname: None, @@ -98,12 +116,16 @@ Module( Alias { range: 58..64, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 58..59, }, asname: Some( Identifier { - id: "b", + id: Name( + "b", + ), range: 63..64, }, ), @@ -117,7 +139,9 @@ Module( range: 65..86, module: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 70..71, }, ), @@ -125,7 +149,9 @@ Module( Alias { range: 79..80, name: Identifier { - id: "*", + id: Name( + "*", + ), range: 79..80, }, asname: None, @@ -133,7 +159,9 @@ Module( Alias { range: 82..83, name: Identifier { - id: "*", + id: Name( + "*", + ), range: 82..83, }, asname: None, @@ -141,7 +169,9 @@ Module( Alias { range: 85..86, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 85..86, }, asname: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_unparenthesized_trailing_comma.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_unparenthesized_trailing_comma.py.snap index 404317157362a1..b3b0fe0f27c9c3 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_unparenthesized_trailing_comma.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_unparenthesized_trailing_comma.py.snap @@ -14,7 +14,9 @@ Module( range: 0..16, module: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 5..6, }, ), @@ -22,7 +24,9 @@ Module( Alias { range: 14..15, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 14..15, }, asname: None, @@ -36,7 +40,9 @@ Module( range: 17..38, module: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 22..23, }, ), @@ -44,12 +50,16 @@ Module( Alias { range: 31..37, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 31..32, }, asname: Some( Identifier { - id: "c", + id: Name( + "c", + ), range: 36..37, }, ), @@ -63,7 +73,9 @@ Module( range: 39..58, module: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 44..45, }, ), @@ -71,7 +83,9 @@ Module( Alias { range: 53..54, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 53..54, }, asname: None, @@ -79,7 +93,9 @@ Module( Alias { range: 56..57, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 56..57, }, asname: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_empty_body.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_empty_body.py.snap index 66550f46753919..e6754a3c115ea1 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_empty_body.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_empty_body.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -37,7 +39,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 15..18, }, type_params: None, @@ -53,7 +57,9 @@ Module( Name( ExprName { range: 24..27, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -68,7 +74,9 @@ Module( Name( ExprName { range: 29..30, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_invalid_return_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_invalid_return_expr.py.snap index c96a223891d1cc..7a01e5a09c683d 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_invalid_return_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_invalid_return_expr.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -34,7 +36,9 @@ Module( value: Name( ExprName { range: 14..17, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -62,7 +66,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 27..30, }, type_params: None, @@ -81,7 +87,9 @@ Module( value: Name( ExprName { range: 38..41, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -109,7 +117,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 52..55, }, type_params: None, @@ -129,7 +139,9 @@ Module( Name( ExprName { range: 67..68, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_missing_identifier.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_missing_identifier.py.snap index 68e3130a862ce4..e8c7878d721a7d 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_missing_identifier.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_missing_identifier.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "", + id: Name( + "", + ), range: 3..3, }, type_params: None, @@ -48,7 +50,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "", + id: Name( + "", + ), range: 15..15, }, type_params: None, @@ -64,7 +68,9 @@ Module( Name( ExprName { range: 22..25, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_missing_return_type.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_missing_return_type.py.snap index 192bbfdd747dac..5953fdefee0822 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_missing_return_type.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_missing_return_type.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_unclosed_parameter_list.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_unclosed_parameter_list.py.snap index e37c632e7f9bc8..eaeeb5a05dad5a 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_unclosed_parameter_list.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_unclosed_parameter_list.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -28,14 +30,18 @@ Module( parameter: Parameter { range: 8..14, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 8..9, }, annotation: Some( Name( ExprName { range: 11..14, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -48,7 +54,9 @@ Module( parameter: Parameter { range: 16..18, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 16..17, }, annotation: None, @@ -70,7 +78,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 23..26, }, type_params: None, @@ -108,7 +118,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 48..51, }, type_params: None, @@ -121,14 +133,18 @@ Module( parameter: Parameter { range: 52..58, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 52..53, }, annotation: Some( Name( ExprName { range: 55..58, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -141,14 +157,18 @@ Module( parameter: Parameter { range: 60..66, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 60..61, }, annotation: Some( Name( ExprName { range: 63..66, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -161,7 +181,9 @@ Module( parameter: Parameter { range: 67..68, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 67..68, }, annotation: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_unclosed_type_param_list.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_unclosed_type_param_list.py.snap index c5cfe5b377958f..4454e5cdc28550 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_unclosed_type_param_list.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_unclosed_type_param_list.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: Some( @@ -26,7 +28,9 @@ Module( TypeParamTypeVar { range: 8..10, name: Identifier { - id: "T1", + id: Name( + "T1", + ), range: 8..10, }, bound: None, @@ -37,7 +41,9 @@ Module( TypeParamTypeVarTuple { range: 12..15, name: Identifier { - id: "T2", + id: Name( + "T2", + ), range: 13..15, }, default: None, @@ -55,7 +61,9 @@ Module( parameter: Parameter { range: 16..17, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 16..17, }, annotation: None, @@ -67,7 +75,9 @@ Module( parameter: Parameter { range: 19..20, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 19..20, }, annotation: None, @@ -91,7 +101,9 @@ Module( left: Name( ExprName { range: 34..35, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -99,7 +111,9 @@ Module( right: Name( ExprName { range: 38..39, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -118,7 +132,9 @@ Module( Name( ExprName { range: 40..41, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_unparenthesized_return_types.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_unparenthesized_return_types.py.snap index 202748b993d2ea..4929fdffeffeab 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_unparenthesized_return_types.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_unparenthesized_return_types.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -35,7 +37,9 @@ Module( Name( ExprName { range: 13..16, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -65,7 +69,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 27..30, }, type_params: None, @@ -85,14 +91,18 @@ Module( Name( ExprName { range: 36..39, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), Name( ExprName { range: 41..44, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@global_stmt_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@global_stmt_expression.py.snap index dcb28456ec1a96..5642b1da7e9884 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@global_stmt_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@global_stmt_expression.py.snap @@ -14,7 +14,9 @@ Module( range: 0..8, names: [ Identifier { - id: "x", + id: Name( + "x", + ), range: 7..8, }, ], diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@global_stmt_trailing_comma.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@global_stmt_trailing_comma.py.snap index d84efa64801b25..25f733a6e62f83 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@global_stmt_trailing_comma.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@global_stmt_trailing_comma.py.snap @@ -20,7 +20,9 @@ Module( range: 9..18, names: [ Identifier { - id: "x", + id: Name( + "x", + ), range: 16..17, }, ], @@ -31,11 +33,15 @@ Module( range: 19..31, names: [ Identifier { - id: "x", + id: Name( + "x", + ), range: 26..27, }, Identifier { - id: "y", + id: Name( + "y", + ), range: 29..30, }, ], diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_elif_missing_colon.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_elif_missing_colon.py.snap index 94ad569a4f518a..6cf4514cd84cd2 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_elif_missing_colon.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_elif_missing_colon.py.snap @@ -15,7 +15,9 @@ Module( test: Name( ExprName { range: 3..4, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -33,7 +35,9 @@ Module( Name( ExprName { range: 20..21, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_invalid_elif_test_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_invalid_elif_test_expr.py.snap index a80c406018a9ac..aa4e966d4a604a 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_invalid_elif_test_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_invalid_elif_test_expr.py.snap @@ -15,7 +15,9 @@ Module( test: Name( ExprName { range: 3..4, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -36,7 +38,9 @@ Module( value: Name( ExprName { range: 21..22, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -62,7 +66,9 @@ Module( Name( ExprName { range: 44..45, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_invalid_test_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_invalid_test_expr.py.snap index cf7c49e04c7074..ea8836ac5b9ef2 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_invalid_test_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_invalid_test_expr.py.snap @@ -18,7 +18,9 @@ Module( value: Name( ExprName { range: 4..5, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -50,7 +52,9 @@ Module( Name( ExprName { range: 20..21, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -81,7 +85,9 @@ Module( value: Name( ExprName { range: 41..42, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_missing_colon.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_missing_colon.py.snap index 80f43b4bd6463b..1831dcb3a8e6a3 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_missing_colon.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_missing_colon.py.snap @@ -15,7 +15,9 @@ Module( test: Name( ExprName { range: 3..4, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -29,7 +31,9 @@ Module( test: Name( ExprName { range: 8..9, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -50,7 +54,9 @@ Module( Name( ExprName { range: 19..20, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_missing_test.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_missing_test.py.snap index 973d6d77074aa1..f59774d872733e 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_missing_test.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_missing_test.py.snap @@ -15,7 +15,9 @@ Module( test: Name( ExprName { range: 2..2, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_misspelled_elif.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_misspelled_elif.py.snap index b36d6f97eaade0..ea3d334330a621 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_misspelled_elif.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_misspelled_elif.py.snap @@ -34,14 +34,18 @@ Module( target: Name( ExprName { range: 18..21, - id: "elf", + id: Name( + "elf", + ), ctx: Store, }, ), annotation: Name( ExprName { range: 22..22, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@implicitly_concatenated_unterminated_string.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@implicitly_concatenated_unterminated_string.py.snap index 7eada587cdee4e..f5908604daa89f 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@implicitly_concatenated_unterminated_string.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@implicitly_concatenated_unterminated_string.py.snap @@ -95,7 +95,9 @@ Module( expression: Name( ExprName { range: 38..39, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@implicitly_concatenated_unterminated_string_multiline.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@implicitly_concatenated_unterminated_string_multiline.py.snap index 2091165382461e..bae1bc04a81083 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@implicitly_concatenated_unterminated_string_multiline.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@implicitly_concatenated_unterminated_string_multiline.py.snap @@ -45,7 +45,9 @@ Module( expression: Name( ExprName { range: 27..28, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@import_alias_missing_asname.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@import_alias_missing_asname.py.snap index 0b5fdda550fb49..a48ccb3dc50d54 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@import_alias_missing_asname.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@import_alias_missing_asname.py.snap @@ -16,7 +16,9 @@ Module( Alias { range: 7..11, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 7..8, }, asname: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@import_stmt_parenthesized_names.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@import_stmt_parenthesized_names.py.snap index 07706b4e062c12..79304d28ce414e 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@import_stmt_parenthesized_names.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@import_stmt_parenthesized_names.py.snap @@ -21,7 +21,9 @@ Module( value: Name( ExprName { range: 8..9, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -43,14 +45,18 @@ Module( Name( ExprName { range: 19..20, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 22..23, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@import_stmt_star_import.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@import_stmt_star_import.py.snap index d7b385d339a5fb..d0579f9a996399 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@import_stmt_star_import.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@import_stmt_star_import.py.snap @@ -24,7 +24,9 @@ Module( value: Name( ExprName { range: 8..8, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -40,7 +42,9 @@ Module( Alias { range: 16..17, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 16..17, }, asname: None, @@ -61,7 +65,9 @@ Module( value: Name( ExprName { range: 20..20, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -71,7 +77,9 @@ Module( Name( ExprName { range: 22..23, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@import_stmt_trailing_comma.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@import_stmt_trailing_comma.py.snap index 513a22fac0b04b..7be4700da97af7 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@import_stmt_trailing_comma.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@import_stmt_trailing_comma.py.snap @@ -22,7 +22,9 @@ Module( Alias { range: 16..17, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 16..17, }, asname: None, @@ -30,7 +32,9 @@ Module( Alias { range: 19..20, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 19..20, }, asname: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@invalid_del_target.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@invalid_del_target.py.snap index d32507dc88cdd6..6f3cef7b8337f2 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@invalid_del_target.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@invalid_del_target.py.snap @@ -19,7 +19,9 @@ Module( left: Name( ExprName { range: 4..5, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@lambda_body_with_starred_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@lambda_body_with_starred_expr.py.snap index 05fbaf22c9c400..b8628c69a377e2 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@lambda_body_with_starred_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@lambda_body_with_starred_expr.py.snap @@ -25,7 +25,9 @@ Module( parameter: Parameter { range: 7..8, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 7..8, }, annotation: None, @@ -44,7 +46,9 @@ Module( value: Name( ExprName { range: 11..12, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -75,7 +79,9 @@ Module( parameter: Parameter { range: 20..21, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 20..21, }, annotation: None, @@ -94,7 +100,9 @@ Module( value: Name( ExprName { range: 24..25, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -130,7 +138,9 @@ Module( parameter: Parameter { range: 34..35, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 34..35, }, annotation: None, @@ -149,7 +159,9 @@ Module( value: Name( ExprName { range: 38..39, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -161,7 +173,9 @@ Module( Name( ExprName { range: 41..42, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -188,7 +202,9 @@ Module( parameter: Parameter { range: 50..51, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 50..51, }, annotation: None, @@ -212,14 +228,18 @@ Module( Name( ExprName { range: 54..55, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), Name( ExprName { range: 60..61, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@lambda_body_with_yield_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@lambda_body_with_yield_expr.py.snap index 22675825920b2b..f88dbeaeb72b07 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@lambda_body_with_yield_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@lambda_body_with_yield_expr.py.snap @@ -25,7 +25,9 @@ Module( parameter: Parameter { range: 7..8, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 7..8, }, annotation: None, @@ -45,7 +47,9 @@ Module( Name( ExprName { range: 16..17, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -72,7 +76,9 @@ Module( parameter: Parameter { range: 25..26, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 25..26, }, annotation: None, @@ -91,7 +97,9 @@ Module( value: Name( ExprName { range: 39..40, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_classify_as_keyword.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_classify_as_keyword.py.snap index 70c3203746c261..63d591cffa19de 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_classify_as_keyword.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_classify_as_keyword.py.snap @@ -19,7 +19,9 @@ Module( Name( ExprName { range: 12..15, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_classify_as_keyword_or_identifier.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_classify_as_keyword_or_identifier.py.snap index 4f420387e903b8..e62f7d3a30a0b4 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_classify_as_keyword_or_identifier.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_classify_as_keyword_or_identifier.py.snap @@ -18,7 +18,9 @@ Module( value: Name( ExprName { range: 7..10, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_expect_indented_block.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_expect_indented_block.py.snap index 2b4bd18bfc920c..ba370a807059c1 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_expect_indented_block.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_expect_indented_block.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 6..9, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_expected_case_block.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_expected_case_block.py.snap index af91bab864b31f..9f6afdeb78ecff 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_expected_case_block.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_expected_case_block.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 6..7, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -29,7 +31,9 @@ Module( Name( ExprName { range: 13..14, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -50,7 +54,9 @@ Module( subject: Name( ExprName { range: 25..26, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -63,7 +69,9 @@ Module( subject: Name( ExprName { range: 38..39, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_invalid_guard_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_invalid_guard_expr.py.snap index b697fd9a524654..95f0e2d6cd5b4a 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_invalid_guard_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_invalid_guard_expr.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 6..7, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -28,7 +30,9 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name( + "y", + ), range: 18..19, }, ), @@ -41,7 +45,9 @@ Module( value: Name( ExprName { range: 24..25, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -71,7 +77,9 @@ Module( subject: Name( ExprName { range: 37..38, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -84,7 +92,9 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name( + "y", + ), range: 49..50, }, ), @@ -97,7 +107,9 @@ Module( value: Name( ExprName { range: 56..57, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -127,7 +139,9 @@ Module( subject: Name( ExprName { range: 70..71, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -140,7 +154,9 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name( + "y", + ), range: 82..83, }, ), @@ -154,7 +170,9 @@ Module( Name( ExprName { range: 93..94, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_invalid_subject_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_invalid_subject_expr.py.snap index f5d5a8223aab06..1c5714e462dbe9 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_invalid_subject_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_invalid_subject_expr.py.snap @@ -18,7 +18,9 @@ Module( value: Name( ExprName { range: 8..9, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -70,14 +72,18 @@ Module( Name( ExprName { range: 72..73, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 78..79, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -90,7 +96,9 @@ Module( Name( ExprName { range: 81..82, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -136,7 +144,9 @@ Module( Name( ExprName { range: 112..113, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_missing_guard_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_missing_guard_expr.py.snap index f21bb6097843b0..0e31763d280e0c 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_missing_guard_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_missing_guard_expr.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 6..7, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -28,7 +30,9 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name( + "y", + ), range: 18..19, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_missing_pattern.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_missing_pattern.py.snap index 882bb798387916..8a128a13aa26f1 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_missing_pattern.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_missing_pattern.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 6..7, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -28,7 +30,9 @@ Module( value: Name( ExprName { range: 17..17, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_no_newline_before_case.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_no_newline_before_case.py.snap index 2e8be2f3068a7e..1799456a8b0c77 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_no_newline_before_case.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_no_newline_before_case.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 6..9, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_single_starred_subject.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_single_starred_subject.py.snap index aeed10c67518ce..32b4e8142c1a57 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_single_starred_subject.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_single_starred_subject.py.snap @@ -18,7 +18,9 @@ Module( value: Name( ExprName { range: 7..10, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@multiple_clauses_on_same_line.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@multiple_clauses_on_same_line.py.snap index 2a3a470fadc5d4..77bfce9bcbff04 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@multiple_clauses_on_same_line.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@multiple_clauses_on_same_line.py.snap @@ -114,14 +114,18 @@ Module( target: Name( ExprName { range: 90..91, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 95..99, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), @@ -148,14 +152,18 @@ Module( target: Name( ExprName { range: 122..123, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 127..131, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), @@ -193,7 +201,9 @@ Module( Name( ExprName { range: 168..171, - id: "exc", + id: Name( + "exc", + ), ctx: Load, }, ), @@ -244,7 +254,9 @@ Module( Name( ExprName { range: 221..224, - id: "exc", + id: Name( + "exc", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@node_range_with_gaps.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@node_range_with_gaps.py.snap index 1456d1a7a8ede6..23e26fd8650c9d 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@node_range_with_gaps.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@node_range_with_gaps.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -37,7 +39,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "bar", + id: Name( + "bar", + ), range: 22..25, }, type_params: None, @@ -70,7 +74,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "baz", + id: Name( + "baz", + ), range: 37..40, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@nonlocal_stmt_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@nonlocal_stmt_expression.py.snap index 2becdd33525d52..071fa5661f623b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@nonlocal_stmt_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@nonlocal_stmt_expression.py.snap @@ -14,7 +14,9 @@ Module( range: 0..10, names: [ Identifier { - id: "x", + id: Name( + "x", + ), range: 9..10, }, ], diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@nonlocal_stmt_trailing_comma.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@nonlocal_stmt_trailing_comma.py.snap index de8910ccb6777e..0444d6a844987e 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@nonlocal_stmt_trailing_comma.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@nonlocal_stmt_trailing_comma.py.snap @@ -20,7 +20,9 @@ Module( range: 11..22, names: [ Identifier { - id: "x", + id: Name( + "x", + ), range: 20..21, }, ], @@ -31,11 +33,15 @@ Module( range: 23..37, names: [ Identifier { - id: "x", + id: Name( + "x", + ), range: 32..33, }, Identifier { - id: "y", + id: Name( + "y", + ), range: 35..36, }, ], diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_missing_annotation.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_missing_annotation.py.snap index d8b202163ab84e..8105d78e88ca02 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_missing_annotation.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_missing_annotation.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -28,7 +30,9 @@ Module( parameter: Parameter { range: 8..10, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 8..9, }, annotation: None, @@ -61,7 +65,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 21..24, }, type_params: None, @@ -74,7 +80,9 @@ Module( parameter: Parameter { range: 25..27, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 25..26, }, annotation: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_missing_default.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_missing_default.py.snap index b648cc9fddd6e9..3ceec073a784ca 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_missing_default.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_missing_default.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -28,7 +30,9 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 8..9, }, annotation: None, @@ -61,7 +65,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 21..24, }, type_params: None, @@ -74,14 +80,18 @@ Module( parameter: Parameter { range: 25..31, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 25..26, }, annotation: Some( Name( ExprName { range: 28..31, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_with_invalid_annotation.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_with_invalid_annotation.py.snap index eea04d97781a20..47518ba9918da1 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_with_invalid_annotation.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_with_invalid_annotation.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -28,7 +30,9 @@ Module( parameter: Parameter { range: 8..17, name: Identifier { - id: "arg", + id: Name( + "arg", + ), range: 8..11, }, annotation: Some( @@ -38,7 +42,9 @@ Module( value: Name( ExprName { range: 14..17, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -75,7 +81,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 28..31, }, type_params: None, @@ -88,7 +96,9 @@ Module( parameter: Parameter { range: 32..46, name: Identifier { - id: "arg", + id: Name( + "arg", + ), range: 32..35, }, annotation: Some( @@ -99,7 +109,9 @@ Module( Name( ExprName { range: 43..46, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -136,7 +148,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 57..60, }, type_params: None, @@ -149,14 +163,18 @@ Module( parameter: Parameter { range: 61..67, name: Identifier { - id: "arg", + id: Name( + "arg", + ), range: 61..64, }, annotation: Some( Name( ExprName { range: 66..67, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -169,7 +187,9 @@ Module( parameter: Parameter { range: 71..74, name: Identifier { - id: "int", + id: Name( + "int", + ), range: 71..74, }, annotation: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_with_invalid_default.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_with_invalid_default.py.snap index ad562a053f4f5a..9d4466dc7ca767 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_with_invalid_default.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_with_invalid_default.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -28,7 +30,9 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 8..9, }, annotation: None, @@ -40,7 +44,9 @@ Module( value: Name( ExprName { range: 11..14, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -75,7 +81,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 25..28, }, type_params: None, @@ -88,7 +96,9 @@ Module( parameter: Parameter { range: 29..30, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 29..30, }, annotation: None, @@ -100,7 +110,9 @@ Module( value: Name( ExprName { range: 33..36, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -135,7 +147,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 48..51, }, type_params: None, @@ -148,7 +162,9 @@ Module( parameter: Parameter { range: 52..53, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 52..53, }, annotation: None, @@ -161,7 +177,9 @@ Module( Name( ExprName { range: 60..61, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_with_invalid_star_annotation.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_with_invalid_star_annotation.py.snap index 388c8c721ab923..c9ffff420a7627 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_with_invalid_star_annotation.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_with_invalid_star_annotation.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -27,7 +29,9 @@ Module( Parameter { range: 8..16, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 9..13, }, annotation: Some( @@ -37,7 +41,9 @@ Module( value: Name( ExprName { range: 16..16, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -71,7 +77,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 27..30, }, type_params: None, @@ -83,7 +91,9 @@ Module( Parameter { range: 31..51, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 32..36, }, annotation: Some( @@ -96,14 +106,18 @@ Module( value: Name( ExprName { range: 40..45, - id: "tuple", + id: Name( + "tuple", + ), ctx: Load, }, ), slice: Name( ExprName { range: 46..49, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -140,7 +154,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 62..65, }, type_params: None, @@ -152,7 +168,9 @@ Module( Parameter { range: 66..84, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 67..71, }, annotation: Some( @@ -167,14 +185,18 @@ Module( Name( ExprName { range: 74..77, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), Name( ExprName { range: 81..84, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -211,7 +233,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 95..98, }, type_params: None, @@ -223,7 +247,9 @@ Module( Parameter { range: 99..114, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 100..104, }, annotation: Some( @@ -237,7 +263,9 @@ Module( Name( ExprName { range: 113..114, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_duplicate_names.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_duplicate_names.py.snap index 47f14abfa57449..19938cd0a46add 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_duplicate_names.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_duplicate_names.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -28,7 +30,9 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 8..9, }, annotation: None, @@ -40,7 +44,9 @@ Module( parameter: Parameter { range: 11..12, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 11..12, }, annotation: None, @@ -61,7 +67,9 @@ Module( Parameter { range: 17..19, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 18..19, }, annotation: None, @@ -73,7 +81,9 @@ Module( parameter: Parameter { range: 21..22, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 21..22, }, annotation: None, @@ -85,14 +95,18 @@ Module( parameter: Parameter { range: 24..30, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 24..25, }, annotation: Some( Name( ExprName { range: 27..30, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -105,7 +119,9 @@ Module( Parameter { range: 32..35, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 34..35, }, annotation: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_expected_after_star_separator.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_expected_after_star_separator.py.snap index 110d02ed1bdc02..b51ad2d2a47082 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_expected_after_star_separator.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_expected_after_star_separator.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -48,7 +50,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 20..23, }, type_params: None, @@ -81,7 +85,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 37..40, }, type_params: None, @@ -94,7 +100,9 @@ Module( parameter: Parameter { range: 41..42, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 41..42, }, annotation: None, @@ -127,7 +135,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 56..59, }, type_params: None, @@ -140,7 +150,9 @@ Module( parameter: Parameter { range: 60..61, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 60..61, }, annotation: None, @@ -173,7 +185,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 76..79, }, type_params: None, @@ -187,7 +201,9 @@ Module( Parameter { range: 83..91, name: Identifier { - id: "kwargs", + id: Name( + "kwargs", + ), range: 85..91, }, annotation: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_kwarg_after_star_separator.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_kwarg_after_star_separator.py.snap index cd77b73780a0c3..3b5d25b3227410 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_kwarg_after_star_separator.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_kwarg_after_star_separator.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -29,7 +31,9 @@ Module( Parameter { range: 11..19, name: Identifier { - id: "kwargs", + id: Name( + "kwargs", + ), range: 13..19, }, annotation: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_multiple_kwargs.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_multiple_kwargs.py.snap index 4f1c1d86137c1e..f64b17625bef3b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_multiple_kwargs.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_multiple_kwargs.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -28,7 +30,9 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 8..9, }, annotation: None, @@ -42,7 +46,9 @@ Module( Parameter { range: 22..31, name: Identifier { - id: "kwargs2", + id: Name( + "kwargs2", + ), range: 24..31, }, annotation: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_multiple_slash_separator.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_multiple_slash_separator.py.snap index df14cc04f70e70..203168a3ec7032 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_multiple_slash_separator.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_multiple_slash_separator.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -27,7 +29,9 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 8..9, }, annotation: None, @@ -41,7 +45,9 @@ Module( parameter: Parameter { range: 17..18, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 17..18, }, annotation: None, @@ -74,7 +80,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 29..32, }, type_params: None, @@ -86,7 +94,9 @@ Module( parameter: Parameter { range: 33..34, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 33..34, }, annotation: None, @@ -100,7 +110,9 @@ Module( parameter: Parameter { range: 39..40, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 39..40, }, annotation: None, @@ -112,7 +124,9 @@ Module( parameter: Parameter { range: 42..43, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 42..43, }, annotation: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_multiple_star_separator.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_multiple_star_separator.py.snap index 7db636e923fc7b..d7beec9c7616d0 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_multiple_star_separator.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_multiple_star_separator.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -28,7 +30,9 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 8..9, }, annotation: None, @@ -43,7 +47,9 @@ Module( parameter: Parameter { range: 17..18, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 17..18, }, annotation: None, @@ -74,7 +80,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 29..32, }, type_params: None, @@ -87,7 +95,9 @@ Module( parameter: Parameter { range: 33..34, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 33..34, }, annotation: None, @@ -102,7 +112,9 @@ Module( parameter: Parameter { range: 39..40, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 39..40, }, annotation: None, @@ -114,7 +126,9 @@ Module( parameter: Parameter { range: 42..43, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 42..43, }, annotation: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_multiple_varargs.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_multiple_varargs.py.snap index a74e1988f2d101..907b16ed02f7c5 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_multiple_varargs.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_multiple_varargs.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -28,7 +30,9 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 8..9, }, annotation: None, @@ -40,7 +44,9 @@ Module( Parameter { range: 14..19, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 15..19, }, annotation: None, @@ -52,7 +58,9 @@ Module( parameter: Parameter { range: 21..22, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 21..22, }, annotation: None, @@ -83,7 +91,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 67..70, }, type_params: None, @@ -96,7 +106,9 @@ Module( parameter: Parameter { range: 71..72, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 71..72, }, annotation: None, @@ -108,7 +120,9 @@ Module( Parameter { range: 74..80, name: Identifier { - id: "args1", + id: Name( + "args1", + ), range: 75..80, }, annotation: None, @@ -120,7 +134,9 @@ Module( parameter: Parameter { range: 90..91, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 90..91, }, annotation: None, @@ -151,7 +167,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 102..105, }, type_params: None, @@ -164,7 +182,9 @@ Module( parameter: Parameter { range: 106..107, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 106..107, }, annotation: None, @@ -176,7 +196,9 @@ Module( Parameter { range: 109..115, name: Identifier { - id: "args1", + id: Name( + "args1", + ), range: 110..115, }, annotation: None, @@ -188,7 +210,9 @@ Module( parameter: Parameter { range: 117..118, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 117..118, }, annotation: None, @@ -200,7 +224,9 @@ Module( parameter: Parameter { range: 120..121, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 120..121, }, annotation: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_no_arg_before_slash.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_no_arg_before_slash.py.snap index e469e48e3846e6..062d14cff280bc 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_no_arg_before_slash.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_no_arg_before_slash.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -48,7 +50,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 20..23, }, type_params: None, @@ -61,7 +65,9 @@ Module( parameter: Parameter { range: 27..28, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 27..28, }, annotation: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_non_default_after_default.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_non_default_after_default.py.snap index 641923a7a0df08..e22cdd56db2585 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_non_default_after_default.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_non_default_after_default.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -28,7 +30,9 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 8..9, }, annotation: None, @@ -49,7 +53,9 @@ Module( parameter: Parameter { range: 14..15, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 14..15, }, annotation: None, @@ -61,14 +67,18 @@ Module( parameter: Parameter { range: 17..23, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 17..18, }, annotation: Some( Name( ExprName { range: 20..23, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_star_after_slash.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_star_after_slash.py.snap index a22c22b5bfde7a..f76d6f138311fc 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_star_after_slash.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_star_after_slash.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -27,7 +29,9 @@ Module( Parameter { range: 8..10, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 9..10, }, annotation: None, @@ -57,7 +61,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 24..27, }, type_params: None, @@ -69,7 +75,9 @@ Module( parameter: Parameter { range: 28..29, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 28..29, }, annotation: None, @@ -82,7 +90,9 @@ Module( Parameter { range: 31..36, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 32..36, }, annotation: None, @@ -94,7 +104,9 @@ Module( parameter: Parameter { range: 38..39, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 38..39, }, annotation: None, @@ -125,7 +137,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 53..56, }, type_params: None, @@ -137,7 +151,9 @@ Module( parameter: Parameter { range: 57..58, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 57..58, }, annotation: None, @@ -153,7 +169,9 @@ Module( parameter: Parameter { range: 66..67, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 66..67, }, annotation: None, @@ -184,7 +202,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 78..81, }, type_params: None, @@ -196,7 +216,9 @@ Module( parameter: Parameter { range: 82..83, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 82..83, }, annotation: None, @@ -212,7 +234,9 @@ Module( parameter: Parameter { range: 88..89, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 88..89, }, annotation: None, @@ -224,7 +248,9 @@ Module( parameter: Parameter { range: 91..92, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 91..92, }, annotation: None, @@ -236,7 +262,9 @@ Module( parameter: Parameter { range: 97..98, name: Identifier { - id: "d", + id: Name( + "d", + ), range: 97..98, }, annotation: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_star_separator_after_star_param.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_star_separator_after_star_param.py.snap index 4f43b9e0f15060..71dfbb9368fe06 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_star_separator_after_star_param.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_star_separator_after_star_param.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -28,7 +30,9 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 8..9, }, annotation: None, @@ -40,7 +44,9 @@ Module( Parameter { range: 11..16, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 12..16, }, annotation: None, @@ -52,7 +58,9 @@ Module( parameter: Parameter { range: 21..22, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 21..22, }, annotation: None, @@ -83,7 +91,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 33..36, }, type_params: None, @@ -96,7 +106,9 @@ Module( parameter: Parameter { range: 37..38, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 37..38, }, annotation: None, @@ -108,7 +120,9 @@ Module( Parameter { range: 40..45, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 41..45, }, annotation: None, @@ -120,7 +134,9 @@ Module( parameter: Parameter { range: 47..48, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 47..48, }, annotation: None, @@ -132,7 +148,9 @@ Module( parameter: Parameter { range: 50..51, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 50..51, }, annotation: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_var_keyword_with_default.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_var_keyword_with_default.py.snap index 014b96b8e30a0d..d481b87870a510 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_var_keyword_with_default.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_var_keyword_with_default.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -28,7 +30,9 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 8..9, }, annotation: None, @@ -42,7 +46,9 @@ Module( Parameter { range: 11..19, name: Identifier { - id: "kwargs", + id: Name( + "kwargs", + ), range: 13..19, }, annotation: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_var_positional_with_default.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_var_positional_with_default.py.snap index 2e022695318552..d920cdd0f43163 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_var_positional_with_default.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_var_positional_with_default.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -28,7 +30,9 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 8..9, }, annotation: None, @@ -40,7 +44,9 @@ Module( Parameter { range: 11..16, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 12..16, }, annotation: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@raise_stmt_invalid_cause.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@raise_stmt_invalid_cause.py.snap index ea3cd182b7c157..598b3a9972049c 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@raise_stmt_invalid_cause.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@raise_stmt_invalid_cause.py.snap @@ -16,7 +16,9 @@ Module( Name( ExprName { range: 6..7, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -28,7 +30,9 @@ Module( value: Name( ExprName { range: 14..15, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -45,7 +49,9 @@ Module( Name( ExprName { range: 22..23, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -58,7 +64,9 @@ Module( Name( ExprName { range: 35..36, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -75,7 +83,9 @@ Module( Name( ExprName { range: 43..44, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -84,7 +94,9 @@ Module( Name( ExprName { range: 50..51, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@raise_stmt_invalid_exc.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@raise_stmt_invalid_exc.py.snap index 0fe739737d2448..b3f8780d76a417 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@raise_stmt_invalid_exc.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@raise_stmt_invalid_exc.py.snap @@ -19,7 +19,9 @@ Module( value: Name( ExprName { range: 7..8, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -41,7 +43,9 @@ Module( Name( ExprName { range: 21..22, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -59,7 +63,9 @@ Module( Name( ExprName { range: 29..30, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@raise_stmt_unparenthesized_tuple_cause.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@raise_stmt_unparenthesized_tuple_cause.py.snap index 0e6aec6ac52020..58872cce39413b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@raise_stmt_unparenthesized_tuple_cause.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@raise_stmt_unparenthesized_tuple_cause.py.snap @@ -16,7 +16,9 @@ Module( Name( ExprName { range: 6..7, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -29,7 +31,9 @@ Module( Name( ExprName { range: 13..14, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -48,7 +52,9 @@ Module( Name( ExprName { range: 22..23, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -61,14 +67,18 @@ Module( Name( ExprName { range: 29..30, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), Name( ExprName { range: 32..33, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@raise_stmt_unparenthesized_tuple_exc.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@raise_stmt_unparenthesized_tuple_exc.py.snap index 4e97be69714ea3..651e679d5b7c3e 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@raise_stmt_unparenthesized_tuple_exc.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@raise_stmt_unparenthesized_tuple_exc.py.snap @@ -20,7 +20,9 @@ Module( Name( ExprName { range: 6..7, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -44,14 +46,18 @@ Module( Name( ExprName { range: 15..16, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 18..19, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -75,14 +81,18 @@ Module( Name( ExprName { range: 26..27, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 29..30, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -96,7 +106,9 @@ Module( Name( ExprName { range: 36..37, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token.py.snap index 2a3c1866e79994..fe631072fcac46 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 51..55, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -28,7 +30,9 @@ Module( Name( ExprName { range: 56..59, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -47,7 +51,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "bar", + id: Name( + "bar", + ), range: 64..67, }, type_params: None, @@ -78,7 +84,9 @@ Module( func: Name( ExprName { range: 116..120, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -88,7 +96,9 @@ Module( Name( ExprName { range: 121..124, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -104,7 +114,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "bar", + id: Name( + "bar", + ), range: 133..136, }, type_params: None, @@ -139,7 +151,9 @@ Module( func: Name( ExprName { range: 231..235, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -149,7 +163,9 @@ Module( Name( ExprName { range: 236..239, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -165,7 +181,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "bar", + id: Name( + "bar", + ), range: 250..253, }, type_params: None, @@ -200,7 +218,9 @@ Module( func: Name( ExprName { range: 347..351, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -210,7 +230,9 @@ Module( Name( ExprName { range: 352..355, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -226,7 +248,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "bar", + id: Name( + "bar", + ), range: 373..376, }, type_params: None, @@ -261,7 +285,9 @@ Module( func: Name( ExprName { range: 456..460, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -271,7 +297,9 @@ Module( Name( ExprName { range: 461..464, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -282,14 +310,18 @@ Module( Name( ExprName { range: 467..468, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 470..471, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -309,7 +341,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "bar", + id: Name( + "bar", + ), range: 480..483, }, type_params: None, @@ -344,7 +378,9 @@ Module( func: Name( ExprName { range: 567..571, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -354,7 +390,9 @@ Module( Name( ExprName { range: 572..575, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -365,14 +403,18 @@ Module( Name( ExprName { range: 578..579, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 581..582, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -392,7 +434,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "bar", + id: Name( + "bar", + ), range: 592..595, }, type_params: None, @@ -427,7 +471,9 @@ Module( func: Name( ExprName { range: 775..779, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -437,7 +483,9 @@ Module( Name( ExprName { range: 780..783, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -448,14 +496,18 @@ Module( Name( ExprName { range: 786..787, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 793..794, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -475,7 +527,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "bar", + id: Name( + "bar", + ), range: 805..808, }, type_params: None, @@ -510,7 +564,9 @@ Module( func: Name( ExprName { range: 890..894, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -538,7 +594,9 @@ Module( expression: Name( ExprName { range: 904..905, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -571,7 +629,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "bar", + id: Name( + "bar", + ), range: 914..917, }, type_params: None, @@ -606,7 +666,9 @@ Module( func: Name( ExprName { range: 939..943, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -648,7 +710,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "bar", + id: Name( + "bar", + ), range: 960..963, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token_mac_eol.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token_mac_eol.py.snap index 72eca32ab69cfc..4ae3dad881e03e 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token_mac_eol.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token_mac_eol.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 3..7, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -28,7 +30,9 @@ Module( Name( ExprName { range: 8..11, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -39,14 +43,18 @@ Module( Name( ExprName { range: 14..15, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 17..18, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -66,7 +74,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "bar", + id: Name( + "bar", + ), range: 27..30, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token_windows_eol.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token_windows_eol.py.snap index d11a5cf9263c2c..378679cccabb62 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token_windows_eol.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token_windows_eol.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 3..7, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -28,7 +30,9 @@ Module( Name( ExprName { range: 8..11, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -39,14 +43,18 @@ Module( Name( ExprName { range: 14..15, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 17..18, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -66,7 +74,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "bar", + id: Name( + "bar", + ), range: 28..31, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__fstring_format_spec_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__fstring_format_spec_1.py.snap index a4c68ae7d325eb..b0648cde463235 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__fstring_format_spec_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__fstring_format_spec_1.py.snap @@ -85,7 +85,9 @@ Module( value: Name( ExprName { range: 192..198, - id: "format", + id: Name( + "format", + ), ctx: Load, }, ), @@ -97,7 +99,9 @@ Module( value: Name( ExprName { range: 199..203, - id: "spec", + id: Name( + "spec", + ), ctx: Load, }, ), @@ -272,7 +276,9 @@ Module( value: Name( ExprName { range: 285..291, - id: "format", + id: Name( + "format", + ), ctx: Load, }, ), @@ -284,7 +290,9 @@ Module( value: Name( ExprName { range: 292..296, - id: "spec", + id: Name( + "spec", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__line_continuation_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__line_continuation_1.py.snap index 55113bd113f129..d31cc44ee73af9 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__line_continuation_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__line_continuation_1.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -28,14 +30,18 @@ Module( Name( ExprName { range: 5..6, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 8..9, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -52,7 +58,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "bar", + id: Name( + "bar", + ), range: 20..23, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__line_continuation_windows_eol.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__line_continuation_windows_eol.py.snap index 3b106ee4081491..af080c4fd7f5d5 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__line_continuation_windows_eol.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__line_continuation_windows_eol.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -28,14 +30,18 @@ Module( Name( ExprName { range: 5..6, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 8..9, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -52,7 +58,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "bar", + id: Name( + "bar", + ), range: 30..33, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_1.py.snap index c5aa38428f4a87..88888f1b90624b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_1.py.snap @@ -33,7 +33,9 @@ Module( expression: Name( ExprName { range: 177..178, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_2.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_2.py.snap index b4683fc253ad98..fa25d4d09c02c4 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_2.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_2.py.snap @@ -27,7 +27,9 @@ Module( expression: Name( ExprName { range: 172..175, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_3.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_3.py.snap index 70289856fd1450..b15c4f5181f99b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_3.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_3.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 234..238, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -40,7 +42,9 @@ Module( expression: Name( ExprName { range: 244..245, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@return_stmt_invalid_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@return_stmt_invalid_expr.py.snap index 1c3fdfc0d03e42..b875796e11e363 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@return_stmt_invalid_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@return_stmt_invalid_expr.py.snap @@ -19,7 +19,9 @@ Module( value: Name( ExprName { range: 8..8, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -40,7 +42,9 @@ Module( Name( ExprName { range: 22..23, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -60,7 +64,9 @@ Module( value: Name( ExprName { range: 42..43, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -76,7 +82,9 @@ Module( Name( ExprName { range: 51..52, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -111,14 +119,18 @@ Module( Name( ExprName { range: 66..67, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 72..73, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@simple_and_compound_stmt_on_same_line.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@simple_and_compound_stmt_on_same_line.py.snap index 1ba39f2032e4a8..d8b2055c556c5c 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@simple_and_compound_stmt_on_same_line.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@simple_and_compound_stmt_on_same_line.py.snap @@ -15,7 +15,9 @@ Module( value: Name( ExprName { range: 0..1, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -27,7 +29,9 @@ Module( test: Name( ExprName { range: 6..7, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -43,7 +47,9 @@ Module( value: Name( ExprName { range: 15..16, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@simple_stmts_on_same_line.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@simple_stmts_on_same_line.py.snap index 4e626de9d3ab41..2e7c075f6ed24d 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@simple_stmts_on_same_line.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@simple_stmts_on_same_line.py.snap @@ -15,7 +15,9 @@ Module( value: Name( ExprName { range: 0..1, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -27,7 +29,9 @@ Module( value: Name( ExprName { range: 2..3, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -42,7 +46,9 @@ Module( left: Name( ExprName { range: 4..5, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -50,7 +56,9 @@ Module( right: Name( ExprName { range: 8..9, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -67,7 +75,9 @@ Module( left: Name( ExprName { range: 10..11, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -75,7 +85,9 @@ Module( right: Name( ExprName { range: 14..15, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__function_type_parameters.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__function_type_parameters.py.snap index 16efe8b16c8cde..4cfba278ae1964 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__function_type_parameters.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__function_type_parameters.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "keyword", + id: Name( + "keyword", + ), range: 800..807, }, type_params: Some( @@ -26,7 +28,9 @@ Module( TypeParamTypeVar { range: 808..809, name: Identifier { - id: "A", + id: Name( + "A", + ), range: 808..809, }, bound: None, @@ -37,7 +41,9 @@ Module( TypeParamTypeVar { range: 811..816, name: Identifier { - id: "await", + id: Name( + "await", + ), range: 811..816, }, bound: None, @@ -76,7 +82,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "not_a_type_param", + id: Name( + "not_a_type_param", + ), range: 830..846, }, type_params: Some( @@ -87,7 +95,9 @@ Module( TypeParamTypeVar { range: 847..848, name: Identifier { - id: "A", + id: Name( + "A", + ), range: 847..848, }, bound: None, @@ -98,7 +108,9 @@ Module( TypeParamTypeVar { range: 853..854, name: Identifier { - id: "B", + id: Name( + "B", + ), range: 853..854, }, bound: None, @@ -137,7 +149,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "multiple_commas", + id: Name( + "multiple_commas", + ), range: 868..883, }, type_params: Some( @@ -148,7 +162,9 @@ Module( TypeParamTypeVar { range: 884..885, name: Identifier { - id: "A", + id: Name( + "A", + ), range: 884..885, }, bound: None, @@ -159,7 +175,9 @@ Module( TypeParamTypeVar { range: 887..888, name: Identifier { - id: "B", + id: Name( + "B", + ), range: 887..888, }, bound: None, @@ -198,7 +216,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "multiple_trailing_commas", + id: Name( + "multiple_trailing_commas", + ), range: 902..926, }, type_params: Some( @@ -209,7 +229,9 @@ Module( TypeParamTypeVar { range: 927..928, name: Identifier { - id: "A", + id: Name( + "A", + ), range: 927..928, }, bound: None, @@ -248,7 +270,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "multiple_commas_and_recovery", + id: Name( + "multiple_commas_and_recovery", + ), range: 944..972, }, type_params: Some( @@ -259,7 +283,9 @@ Module( TypeParamTypeVar { range: 973..974, name: Identifier { - id: "A", + id: Name( + "A", + ), range: 973..974, }, bound: None, diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__if_extra_indent.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__if_extra_indent.py.snap index bff02e86c476e2..696aa344098935 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__if_extra_indent.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__if_extra_indent.py.snap @@ -33,7 +33,9 @@ Module( left: Name( ExprName { range: 129..130, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -41,7 +43,9 @@ Module( right: Name( ExprName { range: 133..134, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -65,7 +69,9 @@ Module( Name( ExprName { range: 146..147, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__invalid_assignment_targets.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__invalid_assignment_targets.py.snap index 393c745df591e8..68e3baf95d8dcd 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__invalid_assignment_targets.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__invalid_assignment_targets.py.snap @@ -68,7 +68,9 @@ Module( annotation: Name( ExprName { range: 221..224, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -97,14 +99,18 @@ Module( Name( ExprName { range: 303..304, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 308..309, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -132,7 +138,9 @@ Module( target: Name( ExprName { range: 316..317, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -167,7 +175,9 @@ Module( left: Name( ExprName { range: 329..330, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -175,7 +185,9 @@ Module( right: Name( ExprName { range: 333..334, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -203,7 +215,9 @@ Module( operand: Name( ExprName { range: 341..342, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -237,7 +251,9 @@ Module( parameter: Parameter { range: 356..357, name: Identifier { - id: "_", + id: Name( + "_", + ), range: 356..357, }, annotation: None, @@ -281,21 +297,27 @@ Module( test: Name( ExprName { range: 372..373, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), body: Name( ExprName { range: 367..368, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 379..380, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -375,7 +397,9 @@ Module( Name( ExprName { range: 401..402, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -403,7 +427,9 @@ Module( elt: Name( ExprName { range: 410..411, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -413,14 +439,18 @@ Module( target: Name( ExprName { range: 416..417, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 421..423, - id: "xs", + id: Name( + "xs", + ), ctx: Load, }, ), @@ -451,7 +481,9 @@ Module( elt: Name( ExprName { range: 431..432, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -461,14 +493,18 @@ Module( target: Name( ExprName { range: 437..438, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 442..444, - id: "xs", + id: Name( + "xs", + ), ctx: Load, }, ), @@ -499,7 +535,9 @@ Module( key: Name( ExprName { range: 452..453, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -509,7 +547,9 @@ Module( left: Name( ExprName { range: 455..456, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -530,14 +570,18 @@ Module( target: Name( ExprName { range: 465..466, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 470..472, - id: "xs", + id: Name( + "xs", + ), ctx: Load, }, ), @@ -568,7 +612,9 @@ Module( elt: Name( ExprName { range: 480..481, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -578,14 +624,18 @@ Module( target: Name( ExprName { range: 486..487, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 491..493, - id: "xs", + id: Name( + "xs", + ), ctx: Load, }, ), @@ -617,7 +667,9 @@ Module( value: Name( ExprName { range: 506..507, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -645,7 +697,9 @@ Module( Name( ExprName { range: 520..521, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -673,7 +727,9 @@ Module( value: Name( ExprName { range: 540..542, - id: "xs", + id: Name( + "xs", + ), ctx: Load, }, ), @@ -700,7 +756,9 @@ Module( left: Name( ExprName { range: 549..550, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -712,14 +770,18 @@ Module( Name( ExprName { range: 553..554, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), Name( ExprName { range: 557..558, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -747,7 +809,9 @@ Module( func: Name( ExprName { range: 564..567, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -788,7 +852,9 @@ Module( expression: Name( ExprName { range: 579..583, - id: "quux", + id: Name( + "quux", + ), ctx: Load, }, ), @@ -839,7 +905,9 @@ Module( expression: Name( ExprName { range: 594..597, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -860,7 +928,9 @@ Module( expression: Name( ExprName { range: 604..607, - id: "bar", + id: Name( + "bar", + ), ctx: Load, }, ), @@ -1059,7 +1129,9 @@ Module( func: Name( ExprName { range: 678..681, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -1095,7 +1167,9 @@ Module( Name( ExprName { range: 690..691, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -1105,7 +1179,9 @@ Module( func: Name( ExprName { range: 693..696, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -1119,7 +1195,9 @@ Module( Name( ExprName { range: 700..701, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -1177,14 +1255,18 @@ Module( Name( ExprName { range: 720..721, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), Name( ExprName { range: 723..724, - id: "b", + id: Name( + "b", + ), ctx: Store, }, ), @@ -1219,7 +1301,9 @@ Module( Name( ExprName { range: 735..736, - id: "d", + id: Name( + "d", + ), ctx: Store, }, ), @@ -1305,7 +1389,9 @@ Module( Name( ExprName { range: 760..761, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -1315,7 +1401,9 @@ Module( func: Name( ExprName { range: 763..766, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -1329,7 +1417,9 @@ Module( Name( ExprName { range: 770..771, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__invalid_augmented_assignment_target.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__invalid_augmented_assignment_target.py.snap index 92fa9327512f32..49ac52b7dc2639 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__invalid_augmented_assignment_target.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__invalid_augmented_assignment_target.py.snap @@ -20,14 +20,18 @@ Module( Name( ExprName { range: 97..98, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 102..103, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -54,7 +58,9 @@ Module( target: Name( ExprName { range: 111..112, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -88,7 +94,9 @@ Module( left: Name( ExprName { range: 125..126, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -96,7 +104,9 @@ Module( right: Name( ExprName { range: 129..130, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -123,7 +133,9 @@ Module( operand: Name( ExprName { range: 138..139, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -156,7 +168,9 @@ Module( parameter: Parameter { range: 154..155, name: Identifier { - id: "_", + id: Name( + "_", + ), range: 154..155, }, annotation: None, @@ -199,21 +213,27 @@ Module( test: Name( ExprName { range: 171..172, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), body: Name( ExprName { range: 166..167, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 178..179, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -291,7 +311,9 @@ Module( Name( ExprName { range: 202..203, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -318,7 +340,9 @@ Module( elt: Name( ExprName { range: 212..213, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -328,14 +352,18 @@ Module( target: Name( ExprName { range: 218..219, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 223..225, - id: "xs", + id: Name( + "xs", + ), ctx: Load, }, ), @@ -365,7 +393,9 @@ Module( elt: Name( ExprName { range: 234..235, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -375,14 +405,18 @@ Module( target: Name( ExprName { range: 240..241, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 245..247, - id: "xs", + id: Name( + "xs", + ), ctx: Load, }, ), @@ -412,7 +446,9 @@ Module( key: Name( ExprName { range: 256..257, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -422,7 +458,9 @@ Module( left: Name( ExprName { range: 259..260, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -443,14 +481,18 @@ Module( target: Name( ExprName { range: 269..270, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 274..276, - id: "xs", + id: Name( + "xs", + ), ctx: Load, }, ), @@ -480,7 +522,9 @@ Module( elt: Name( ExprName { range: 285..286, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -490,14 +534,18 @@ Module( target: Name( ExprName { range: 291..292, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 296..298, - id: "xs", + id: Name( + "xs", + ), ctx: Load, }, ), @@ -528,7 +576,9 @@ Module( value: Name( ExprName { range: 312..313, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -555,7 +605,9 @@ Module( Name( ExprName { range: 327..328, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -582,7 +634,9 @@ Module( value: Name( ExprName { range: 348..350, - id: "xs", + id: Name( + "xs", + ), ctx: Load, }, ), @@ -608,7 +662,9 @@ Module( left: Name( ExprName { range: 358..359, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -620,14 +676,18 @@ Module( Name( ExprName { range: 362..363, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), Name( ExprName { range: 366..367, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -654,7 +714,9 @@ Module( func: Name( ExprName { range: 374..377, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -694,7 +756,9 @@ Module( expression: Name( ExprName { range: 390..394, - id: "quux", + id: Name( + "quux", + ), ctx: Load, }, ), @@ -744,7 +808,9 @@ Module( expression: Name( ExprName { range: 406..409, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -765,7 +831,9 @@ Module( expression: Name( ExprName { range: 416..419, - id: "bar", + id: Name( + "bar", + ), ctx: Load, }, ), @@ -957,7 +1025,9 @@ Module( func: Name( ExprName { range: 497..500, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -992,7 +1062,9 @@ Module( Name( ExprName { range: 510..511, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -1002,7 +1074,9 @@ Module( func: Name( ExprName { range: 513..516, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -1016,7 +1090,9 @@ Module( Name( ExprName { range: 520..521, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -1073,14 +1149,18 @@ Module( Name( ExprName { range: 541..542, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), Name( ExprName { range: 544..545, - id: "b", + id: Name( + "b", + ), ctx: Store, }, ), @@ -1115,7 +1195,9 @@ Module( Name( ExprName { range: 556..557, - id: "d", + id: Name( + "d", + ), ctx: Store, }, ), @@ -1200,7 +1282,9 @@ Module( Name( ExprName { range: 582..583, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -1210,7 +1294,9 @@ Module( func: Name( ExprName { range: 585..588, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -1224,7 +1310,9 @@ Module( Name( ExprName { range: 592..593, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_0.py.snap index 3baeb69fe78baf..40e5dc5d73e8c1 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_0.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 6..13, - id: "subject", + id: Name( + "subject", + ), ctx: Load, }, ), @@ -28,7 +30,9 @@ Module( cls: Name( ExprName { range: 133..139, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -41,7 +45,9 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 141..142, }, ), @@ -53,7 +59,9 @@ Module( pattern: None, name: Some( Identifier { - id: "b", + id: Name( + "b", + ), range: 144..145, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_1.py.snap index 78c331540125df..aa179a30b95c48 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_1.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 6..13, - id: "subject", + id: Name( + "subject", + ), ctx: Load, }, ), @@ -31,7 +33,9 @@ Module( left: Name( ExprName { range: 146..152, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_2.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_2.py.snap index 736d318dfb8829..6e7cc80a350ef4 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_2.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_2.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 6..13, - id: "subject", + id: Name( + "subject", + ), ctx: Load, }, ), @@ -32,7 +34,9 @@ Module( pattern: None, name: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 164..165, }, ), @@ -41,7 +45,9 @@ Module( ), name: Some( Identifier { - id: "y", + id: Name( + "y", + ), range: 169..170, }, ), @@ -70,7 +76,9 @@ Module( annotation: Name( ExprName { range: 176..176, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_3.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_3.py.snap index 89f02bcde39919..b89e5208467bd7 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_3.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_3.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 6..13, - id: "subject", + id: Name( + "subject", + ), ctx: Load, }, ), @@ -44,7 +46,9 @@ Module( pattern: None, name: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 110..111, }, ), @@ -53,7 +57,9 @@ Module( ), name: Some( Identifier { - id: "y", + id: Name( + "y", + ), range: 115..116, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_4.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_4.py.snap index 3b1a06c49d7a2e..1daaf669c13f2c 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_4.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_4.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 6..13, - id: "subject", + id: Name( + "subject", + ), ctx: Load, }, ), @@ -29,14 +31,18 @@ Module( Name( ExprName { range: 162..163, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), Name( ExprName { range: 167..168, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -48,7 +54,9 @@ Module( pattern: None, name: Some( Identifier { - id: "as", + id: Name( + "as", + ), range: 164..166, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__invalid_class_pattern.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__invalid_class_pattern.py.snap index 288f3909d4fc36..8201259ed3a20f 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__invalid_class_pattern.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__invalid_class_pattern.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 50..57, - id: "subject", + id: Name( + "subject", + ), ctx: Load, }, ), @@ -28,7 +30,9 @@ Module( cls: Name( ExprName { range: 68..71, - id: "Foo", + id: Name( + "Foo", + ), ctx: Load, }, ), @@ -39,7 +43,9 @@ Module( PatternKeyword { range: 72..82, attr: Identifier { - id: "", + id: Name( + "", + ), range: 80..80, }, pattern: MatchValue( @@ -77,7 +83,9 @@ Module( cls: Name( ExprName { range: 107..110, - id: "Foo", + id: Name( + "Foo", + ), ctx: Load, }, ), @@ -88,7 +96,9 @@ Module( PatternKeyword { range: 111..120, attr: Identifier { - id: "", + id: Name( + "", + ), range: 118..118, }, pattern: MatchValue( @@ -126,7 +136,9 @@ Module( cls: Name( ExprName { range: 145..148, - id: "Foo", + id: Name( + "Foo", + ), ctx: Load, }, ), @@ -137,7 +149,9 @@ Module( PatternKeyword { range: 149..159, attr: Identifier { - id: "", + id: Name( + "", + ), range: 157..157, }, pattern: MatchValue( @@ -175,7 +189,9 @@ Module( cls: Name( ExprName { range: 184..187, - id: "Foo", + id: Name( + "Foo", + ), ctx: Load, }, ), @@ -186,7 +202,9 @@ Module( PatternKeyword { range: 188..202, attr: Identifier { - id: "", + id: Name( + "", + ), range: 200..200, }, pattern: MatchValue( @@ -224,7 +242,9 @@ Module( cls: Name( ExprName { range: 227..230, - id: "Foo", + id: Name( + "Foo", + ), ctx: Load, }, ), @@ -235,7 +255,9 @@ Module( PatternKeyword { range: 231..234, attr: Identifier { - id: "", + id: Name( + "", + ), range: 233..233, }, pattern: MatchValue( @@ -273,7 +295,9 @@ Module( cls: Name( ExprName { range: 259..262, - id: "Foo", + id: Name( + "Foo", + ), ctx: Load, }, ), @@ -284,7 +308,9 @@ Module( PatternKeyword { range: 263..270, attr: Identifier { - id: "", + id: Name( + "", + ), range: 269..269, }, pattern: MatchValue( diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__invalid_lhs_or_rhs_pattern.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__invalid_lhs_or_rhs_pattern.py.snap index 2185fc051d68d5..4a4a28e0bc2bfa 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__invalid_lhs_or_rhs_pattern.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__invalid_lhs_or_rhs_pattern.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 6..25, - id: "invalid_lhs_pattern", + id: Name( + "invalid_lhs_pattern", + ), ctx: Load, }, ), @@ -34,7 +36,9 @@ Module( func: Name( ExprName { range: 36..39, - id: "Foo", + id: Name( + "Foo", + ), ctx: Load, }, ), @@ -79,7 +83,9 @@ Module( left: Name( ExprName { range: 70..71, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -117,7 +123,9 @@ Module( left: Name( ExprName { range: 100..101, - id: "_", + id: Name( + "_", + ), ctx: Store, }, ), @@ -408,7 +416,9 @@ Module( func: Name( ExprName { range: 302..305, - id: "Foo", + id: Name( + "Foo", + ), ctx: Load, }, ), @@ -418,7 +428,9 @@ Module( Name( ExprName { range: 306..312, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -459,7 +471,9 @@ Module( subject: Name( ExprName { range: 340..359, - id: "invalid_rhs_pattern", + id: Name( + "invalid_rhs_pattern", + ), ctx: Load, }, ), @@ -487,7 +501,9 @@ Module( func: Name( ExprName { range: 374..377, - id: "Foo", + id: Name( + "Foo", + ), ctx: Load, }, ), @@ -531,7 +547,9 @@ Module( right: Name( ExprName { range: 407..408, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -568,7 +586,9 @@ Module( right: Name( ExprName { range: 436..437, - id: "_", + id: Name( + "_", + ), ctx: Store, }, ), @@ -807,7 +827,9 @@ Module( func: Name( ExprName { range: 600..603, - id: "Foo", + id: Name( + "Foo", + ), ctx: Load, }, ), @@ -817,7 +839,9 @@ Module( Name( ExprName { range: 604..610, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -848,7 +872,9 @@ Module( subject: Name( ExprName { range: 633..656, - id: "invalid_lhs_rhs_pattern", + id: Name( + "invalid_lhs_rhs_pattern", + ), ctx: Load, }, ), @@ -867,7 +893,9 @@ Module( func: Name( ExprName { range: 667..670, - id: "Foo", + id: Name( + "Foo", + ), ctx: Load, }, ), @@ -885,7 +913,9 @@ Module( func: Name( ExprName { range: 675..678, - id: "Bar", + id: Name( + "Bar", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__invalid_mapping_pattern.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__invalid_mapping_pattern.py.snap index c86688b9b0fbc8..d0889378cd3e56 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__invalid_mapping_pattern.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__invalid_mapping_pattern.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 67..74, - id: "subject", + id: Name( + "subject", + ), ctx: Load, }, ), @@ -32,7 +34,9 @@ Module( value: Name( ExprName { range: 87..90, - id: "key", + id: Name( + "key", + ), ctx: Store, }, ), @@ -47,7 +51,9 @@ Module( value: Name( ExprName { range: 90..90, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -78,7 +84,9 @@ Module( value: Name( ExprName { range: 117..120, - id: "key", + id: Name( + "key", + ), ctx: Store, }, ), @@ -125,7 +133,9 @@ Module( value: Name( ExprName { range: 150..153, - id: "key", + id: Name( + "key", + ), ctx: Store, }, ), @@ -172,7 +182,9 @@ Module( value: Name( ExprName { range: 182..185, - id: "key", + id: Name( + "key", + ), ctx: Store, }, ), @@ -192,7 +204,9 @@ Module( value: Name( ExprName { range: 185..185, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -233,7 +247,9 @@ Module( subject: Name( ExprName { range: 311..318, - id: "subject", + id: Name( + "subject", + ), ctx: Load, }, ), @@ -267,7 +283,9 @@ Module( ], rest: Some( Identifier { - id: "rest", + id: Name( + "rest", + ), range: 332..336, }, ), @@ -311,7 +329,9 @@ Module( ], rest: Some( Identifier { - id: "rest2", + id: Name( + "rest2", + ), range: 382..387, }, ), @@ -355,7 +375,9 @@ Module( ], rest: Some( Identifier { - id: "rest2", + id: Name( + "rest2", + ), range: 442..447, }, ), @@ -379,7 +401,9 @@ Module( subject: Name( ExprName { range: 470..477, - id: "subject", + id: Name( + "subject", + ), ctx: Load, }, ), @@ -396,7 +420,9 @@ Module( func: Name( ExprName { range: 489..492, - id: "Foo", + id: Name( + "Foo", + ), ctx: Load, }, ), @@ -406,7 +432,9 @@ Module( Name( ExprName { range: 493..499, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__star_pattern_usage.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__star_pattern_usage.py.snap index ed6a2f1cdc4f33..23526ca8ba3f24 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__star_pattern_usage.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__star_pattern_usage.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 63..70, - id: "subject", + id: Name( + "subject", + ), ctx: Load, }, ), @@ -52,7 +54,9 @@ Module( ), name: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 113..114, }, ), @@ -74,7 +78,9 @@ Module( range: 138..142, name: Some( Identifier { - id: "foo", + id: Name( + "foo", + ), range: 139..142, }, ), @@ -100,7 +106,9 @@ Module( range: 166..170, name: Some( Identifier { - id: "foo", + id: Name( + "foo", + ), range: 167..170, }, ), @@ -155,7 +163,9 @@ Module( range: 202..206, name: Some( Identifier { - id: "foo", + id: Name( + "foo", + ), range: 203..206, }, ), @@ -181,7 +191,9 @@ Module( cls: Name( ExprName { range: 230..233, - id: "Foo", + id: Name( + "Foo", + ), ctx: Load, }, ), @@ -216,7 +228,9 @@ Module( cls: Name( ExprName { range: 261..264, - id: "Foo", + id: Name( + "Foo", + ), ctx: Load, }, ), @@ -227,7 +241,9 @@ Module( PatternKeyword { range: 265..269, attr: Identifier { - id: "x", + id: Name( + "x", + ), range: 265..266, }, pattern: MatchStar( @@ -262,7 +278,9 @@ Module( value: Name( ExprName { range: 296..297, - id: "_", + id: Name( + "_", + ), ctx: Store, }, ), @@ -277,7 +295,9 @@ Module( value: Name( ExprName { range: 297..297, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -308,7 +328,9 @@ Module( value: Name( ExprName { range: 324..325, - id: "_", + id: Name( + "_", + ), ctx: Store, }, ), @@ -398,7 +420,9 @@ Module( value: Name( ExprName { range: 392..393, - id: "_", + id: Name( + "_", + ), ctx: Store, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__unary_add_usage.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__unary_add_usage.py.snap index b17e7f476e63e8..e70e289d7dc9f2 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__unary_add_usage.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__unary_add_usage.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 80..87, - id: "subject", + id: Name( + "subject", + ), ctx: Load, }, ), @@ -196,7 +198,9 @@ Module( cls: Name( ExprName { range: 194..197, - id: "Foo", + id: Name( + "Foo", + ), ctx: Load, }, ), @@ -207,7 +211,9 @@ Module( PatternKeyword { range: 198..202, attr: Identifier { - id: "x", + id: Name( + "x", + ), range: 198..199, }, pattern: MatchValue( @@ -233,7 +239,9 @@ Module( PatternKeyword { range: 204..208, attr: Identifier { - id: "y", + id: Name( + "y", + ), range: 204..205, }, pattern: MatchValue( diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__ambiguous_lpar_with_items.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__ambiguous_lpar_with_items.py.snap index c37a03be19985f..c993f10c6adf43 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__ambiguous_lpar_with_items.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__ambiguous_lpar_with_items.py.snap @@ -23,14 +23,18 @@ Module( Name( ExprName { range: 169..174, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), Name( ExprName { range: 176..181, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -70,14 +74,18 @@ Module( Name( ExprName { range: 195..200, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), Name( ExprName { range: 202..207, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -93,7 +101,9 @@ Module( context_expr: Name( ExprName { range: 213..214, - id: "f", + id: Name( + "f", + ), ctx: Load, }, ), @@ -128,14 +138,18 @@ Module( Name( ExprName { range: 226..231, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), Name( ExprName { range: 233..238, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -151,7 +165,9 @@ Module( context_expr: Name( ExprName { range: 241..246, - id: "item3", + id: Name( + "item3", + ), ctx: Load, }, ), @@ -185,7 +201,9 @@ Module( value: Name( ExprName { range: 260..264, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -222,7 +240,9 @@ Module( value: Name( ExprName { range: 278..282, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -233,7 +253,9 @@ Module( Name( ExprName { range: 287..288, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -267,7 +289,9 @@ Module( target: Name( ExprName { range: 300..304, - id: "item", + id: Name( + "item", + ), ctx: Store, }, ), @@ -285,7 +309,9 @@ Module( Name( ExprName { range: 314..315, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -316,7 +342,9 @@ Module( context_expr: Name( ExprName { range: 328..333, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), @@ -330,7 +358,9 @@ Module( target: Name( ExprName { range: 335..340, - id: "item2", + id: Name( + "item2", + ), ctx: Store, }, ), @@ -348,7 +378,9 @@ Module( Name( ExprName { range: 350..351, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -382,7 +414,9 @@ Module( elt: Name( ExprName { range: 364..365, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -392,7 +426,9 @@ Module( target: Name( ExprName { range: 370..371, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -402,7 +438,9 @@ Module( func: Name( ExprName { range: 375..380, - id: "range", + id: Name( + "range", + ), ctx: Load, }, ), @@ -436,7 +474,9 @@ Module( context_expr: Name( ExprName { range: 386..390, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -471,14 +511,18 @@ Module( Name( ExprName { range: 403..407, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), Name( ExprName { range: 409..410, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -500,7 +544,9 @@ Module( target: Name( ExprName { range: 415..416, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -510,7 +556,9 @@ Module( func: Name( ExprName { range: 420..425, - id: "range", + id: Name( + "range", + ), ctx: Load, }, ), @@ -557,7 +605,9 @@ Module( value: Name( ExprName { range: 504..508, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -597,7 +647,9 @@ Module( value: Name( ExprName { range: 524..525, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -610,14 +662,18 @@ Module( target: Name( ExprName { range: 530..531, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 535..539, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), @@ -635,7 +691,9 @@ Module( context_expr: Name( ExprName { range: 541..545, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -670,7 +728,9 @@ Module( Name( ExprName { range: 558..563, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), @@ -680,7 +740,9 @@ Module( value: Name( ExprName { range: 566..567, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -705,7 +767,9 @@ Module( target: Name( ExprName { range: 572..573, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -716,14 +780,18 @@ Module( Name( ExprName { range: 577..581, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), Name( ExprName { range: 583..588, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -756,7 +824,9 @@ Module( context_expr: Name( ExprName { range: 601..602, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -764,7 +834,9 @@ Module( Name( ExprName { range: 606..607, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -778,7 +850,9 @@ Module( value: Name( ExprName { range: 610..611, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -815,7 +889,9 @@ Module( value: Name( ExprName { range: 625..626, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -829,7 +905,9 @@ Module( context_expr: Name( ExprName { range: 628..629, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -837,7 +915,9 @@ Module( Name( ExprName { range: 633..634, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -872,7 +952,9 @@ Module( Name( ExprName { range: 647..648, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -883,7 +965,9 @@ Module( Name( ExprName { range: 656..657, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -926,7 +1010,9 @@ Module( Name( ExprName { range: 670..671, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -941,14 +1027,18 @@ Module( Name( ExprName { range: 679..680, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), Name( ExprName { range: 682..683, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -996,7 +1086,9 @@ Module( Name( ExprName { range: 696..697, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1006,7 +1098,9 @@ Module( value: Name( ExprName { range: 710..711, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -1044,7 +1138,9 @@ Module( context_expr: Name( ExprName { range: 724..725, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1052,7 +1148,9 @@ Module( Name( ExprName { range: 729..730, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -1063,7 +1161,9 @@ Module( context_expr: Name( ExprName { range: 732..733, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -1079,7 +1179,9 @@ Module( target: Name( ExprName { range: 738..739, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -1105,7 +1207,9 @@ Module( elt: Name( ExprName { range: 751..752, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1115,14 +1219,18 @@ Module( target: Name( ExprName { range: 757..758, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 762..766, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), @@ -1137,7 +1245,9 @@ Module( Name( ExprName { range: 770..771, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -1168,7 +1278,9 @@ Module( context_expr: Name( ExprName { range: 844..848, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -1176,7 +1288,9 @@ Module( Name( ExprName { range: 852..853, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -1206,7 +1320,9 @@ Module( context_expr: Name( ExprName { range: 868..872, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -1214,7 +1330,9 @@ Module( Name( ExprName { range: 876..877, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -1230,7 +1348,9 @@ Module( target: Name( ExprName { range: 880..881, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -1253,7 +1373,9 @@ Module( context_expr: Name( ExprName { range: 893..897, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -1261,7 +1383,9 @@ Module( Name( ExprName { range: 901..903, - id: "f1", + id: Name( + "f1", + ), ctx: Store, }, ), @@ -1277,7 +1401,9 @@ Module( target: Name( ExprName { range: 908..910, - id: "f2", + id: Name( + "f2", + ), ctx: Store, }, ), @@ -1300,7 +1426,9 @@ Module( context_expr: Name( ExprName { range: 922..927, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), @@ -1308,7 +1436,9 @@ Module( Name( ExprName { range: 931..932, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -1322,7 +1452,9 @@ Module( target: Name( ExprName { range: 934..939, - id: "item2", + id: Name( + "item2", + ), ctx: Store, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__empty_with_items.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__empty_with_items.py.snap index 643131e0417154..a5a8e5538d00da 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__empty_with_items.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__empty_with_items.py.snap @@ -37,7 +37,9 @@ Module( left: Name( ExprName { range: 100..101, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -45,7 +47,9 @@ Module( right: Name( ExprName { range: 104..105, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__unclosed_ambiguous_lpar.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__unclosed_ambiguous_lpar.py.snap index cb8bddca0d2051..37e73d1d89bc03 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__unclosed_ambiguous_lpar.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__unclosed_ambiguous_lpar.py.snap @@ -19,7 +19,9 @@ Module( context_expr: Name( ExprName { range: 6..6, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -36,7 +38,9 @@ Module( left: Name( ExprName { range: 9..10, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -44,7 +48,9 @@ Module( right: Name( ExprName { range: 13..14, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__unclosed_ambiguous_lpar_eof.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__unclosed_ambiguous_lpar_eof.py.snap index 54267677e53e33..03ebcb47053e12 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__unclosed_ambiguous_lpar_eof.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__unclosed_ambiguous_lpar_eof.py.snap @@ -19,7 +19,9 @@ Module( context_expr: Name( ExprName { range: 6..6, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__unparenthesized_with_items.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__unparenthesized_with_items.py.snap index cd69d7291a8767..cc4716bee594d1 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__unparenthesized_with_items.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__unparenthesized_with_items.py.snap @@ -19,7 +19,9 @@ Module( context_expr: Name( ExprName { range: 91..95, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -45,7 +47,9 @@ Module( context_expr: Name( ExprName { range: 108..112, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -53,7 +57,9 @@ Module( Name( ExprName { range: 116..117, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -82,7 +88,9 @@ Module( value: Name( ExprName { range: 131..135, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -114,7 +122,9 @@ Module( value: Name( ExprName { range: 148..152, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -125,7 +135,9 @@ Module( Name( ExprName { range: 156..157, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -154,7 +166,9 @@ Module( value: Name( ExprName { range: 170..175, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), @@ -168,7 +182,9 @@ Module( context_expr: Name( ExprName { range: 177..182, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -176,7 +192,9 @@ Module( Name( ExprName { range: 186..187, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -202,7 +220,9 @@ Module( context_expr: Name( ExprName { range: 199..204, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), @@ -210,7 +230,9 @@ Module( Name( ExprName { range: 208..209, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -224,7 +246,9 @@ Module( value: Name( ExprName { range: 212..217, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -253,7 +277,9 @@ Module( context_expr: Name( ExprName { range: 229..233, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -273,7 +299,9 @@ Module( Name( ExprName { range: 242..243, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@try_stmt_misspelled_except.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@try_stmt_misspelled_except.py.snap index 7b73799637c2db..c5506298eef59b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@try_stmt_misspelled_except.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@try_stmt_misspelled_except.py.snap @@ -31,14 +31,18 @@ Module( target: Name( ExprName { range: 14..19, - id: "exept", + id: Name( + "exept", + ), ctx: Store, }, ), annotation: Name( ExprName { range: 20..20, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -63,7 +67,9 @@ Module( Name( ExprName { range: 77..78, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), @@ -115,14 +121,18 @@ Module( target: Name( ExprName { range: 114..119, - id: "exept", + id: Name( + "exept", + ), ctx: Store, }, ), annotation: Name( ExprName { range: 120..120, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -142,7 +152,9 @@ Module( Name( ExprName { range: 159..160, - id: "b", + id: Name( + "b", + ), ctx: Store, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_alias_incomplete_stmt.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_alias_incomplete_stmt.py.snap index 485b07c4d2ffe3..e523d4751e0d23 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_alias_incomplete_stmt.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_alias_incomplete_stmt.py.snap @@ -15,7 +15,9 @@ Module( value: Name( ExprName { range: 0..4, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -27,7 +29,9 @@ Module( value: Name( ExprName { range: 5..9, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -39,7 +43,9 @@ Module( value: Name( ExprName { range: 10..11, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -51,7 +57,9 @@ Module( name: Name( ExprName { range: 17..18, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -59,7 +67,9 @@ Module( value: Name( ExprName { range: 20..20, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_alias_invalid_value_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_alias_invalid_value_expr.py.snap index 35bdc091848b04..285db7f0609fcd 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_alias_invalid_value_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_alias_invalid_value_expr.py.snap @@ -15,7 +15,9 @@ Module( name: Name( ExprName { range: 5..6, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -26,7 +28,9 @@ Module( value: Name( ExprName { range: 10..11, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -41,7 +45,9 @@ Module( name: Name( ExprName { range: 17..18, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -53,7 +59,9 @@ Module( Name( ExprName { range: 27..28, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -68,7 +76,9 @@ Module( name: Name( ExprName { range: 34..35, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -79,7 +89,9 @@ Module( value: Name( ExprName { range: 49..50, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -93,7 +105,9 @@ Module( name: Name( ExprName { range: 56..57, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -101,7 +115,9 @@ Module( value: Name( ExprName { range: 60..61, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_invalid_bound_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_invalid_bound_expr.py.snap index 6ce990e253a444..62b50cf858cb95 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_invalid_bound_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_invalid_bound_expr.py.snap @@ -15,7 +15,9 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -27,7 +29,9 @@ Module( TypeParamTypeVar { range: 7..14, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 7..8, }, bound: Some( @@ -37,7 +41,9 @@ Module( value: Name( ExprName { range: 11..14, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -54,7 +60,9 @@ Module( value: Name( ExprName { range: 18..21, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -66,7 +74,9 @@ Module( name: Name( ExprName { range: 27..28, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -78,7 +88,9 @@ Module( TypeParamTypeVar { range: 29..39, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 29..30, }, bound: Some( @@ -89,7 +101,9 @@ Module( Name( ExprName { range: 38..39, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -106,7 +120,9 @@ Module( value: Name( ExprName { range: 43..46, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -118,7 +134,9 @@ Module( name: Name( ExprName { range: 52..53, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -130,7 +148,9 @@ Module( TypeParamTypeVar { range: 54..69, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 54..55, }, bound: Some( @@ -140,7 +160,9 @@ Module( value: Name( ExprName { range: 68..69, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -156,7 +178,9 @@ Module( value: Name( ExprName { range: 73..76, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -168,7 +192,9 @@ Module( name: Name( ExprName { range: 82..83, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -180,14 +206,18 @@ Module( TypeParamTypeVar { range: 84..88, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 84..85, }, bound: Some( Name( ExprName { range: 87..88, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -199,7 +229,9 @@ Module( TypeParamTypeVar { range: 92..95, name: Identifier { - id: "int", + id: Name( + "int", + ), range: 92..95, }, bound: None, @@ -212,7 +244,9 @@ Module( value: Name( ExprName { range: 99..102, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_missing_bound.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_missing_bound.py.snap index c4a22ec121b327..1cc58d0bf85a7b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_missing_bound.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_missing_bound.py.snap @@ -15,7 +15,9 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -27,7 +29,9 @@ Module( TypeParamTypeVar { range: 7..9, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 7..8, }, bound: None, @@ -40,7 +44,9 @@ Module( value: Name( ExprName { range: 14..17, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -52,7 +58,9 @@ Module( name: Name( ExprName { range: 23..24, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -64,7 +72,9 @@ Module( TypeParamTypeVar { range: 25..28, name: Identifier { - id: "T1", + id: Name( + "T1", + ), range: 25..27, }, bound: None, @@ -75,7 +85,9 @@ Module( TypeParamTypeVar { range: 31..33, name: Identifier { - id: "T2", + id: Name( + "T2", + ), range: 31..33, }, bound: None, @@ -88,7 +100,9 @@ Module( value: Name( ExprName { range: 37..40, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_param_spec_bound.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_param_spec_bound.py.snap index 976cdf2c1c4939..7b32152c6b9ea5 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_param_spec_bound.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_param_spec_bound.py.snap @@ -15,7 +15,9 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -27,7 +29,9 @@ Module( TypeParamParamSpec { range: 7..10, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 9..10, }, default: None, @@ -39,7 +43,9 @@ Module( value: Name( ExprName { range: 10..10, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -51,7 +57,9 @@ Module( value: Name( ExprName { range: 12..15, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -63,7 +71,9 @@ Module( value: Name( ExprName { range: 19..22, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_param_spec_invalid_default_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_param_spec_invalid_default_expr.py.snap index dbaa4ecf56734e..f1190609a2261e 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_param_spec_invalid_default_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_param_spec_invalid_default_expr.py.snap @@ -15,7 +15,9 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -27,7 +29,9 @@ Module( TypeParamParamSpec { range: 7..17, name: Identifier { - id: "P", + id: Name( + "P", + ), range: 9..10, }, default: Some( @@ -37,7 +41,9 @@ Module( value: Name( ExprName { range: 14..17, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -53,7 +59,9 @@ Module( value: Name( ExprName { range: 21..24, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -65,7 +73,9 @@ Module( name: Name( ExprName { range: 30..31, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -77,7 +87,9 @@ Module( TypeParamParamSpec { range: 32..45, name: Identifier { - id: "P", + id: Name( + "P", + ), range: 34..35, }, default: Some( @@ -88,7 +100,9 @@ Module( Name( ExprName { range: 44..45, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -104,7 +118,9 @@ Module( value: Name( ExprName { range: 49..52, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -116,7 +132,9 @@ Module( name: Name( ExprName { range: 58..59, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -128,7 +146,9 @@ Module( TypeParamParamSpec { range: 60..78, name: Identifier { - id: "P", + id: Name( + "P", + ), range: 62..63, }, default: Some( @@ -138,7 +158,9 @@ Module( value: Name( ExprName { range: 77..78, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -153,7 +175,9 @@ Module( value: Name( ExprName { range: 82..85, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -165,7 +189,9 @@ Module( name: Name( ExprName { range: 91..92, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -177,14 +203,18 @@ Module( TypeParamParamSpec { range: 93..100, name: Identifier { - id: "P", + id: Name( + "P", + ), range: 95..96, }, default: Some( Name( ExprName { range: 99..100, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -195,7 +225,9 @@ Module( TypeParamTypeVar { range: 104..107, name: Identifier { - id: "int", + id: Name( + "int", + ), range: 104..107, }, bound: None, @@ -208,7 +240,9 @@ Module( value: Name( ExprName { range: 111..114, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -220,7 +254,9 @@ Module( name: Name( ExprName { range: 120..121, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -232,7 +268,9 @@ Module( TypeParamParamSpec { range: 122..132, name: Identifier { - id: "P", + id: Name( + "P", + ), range: 124..125, }, default: Some( @@ -242,7 +280,9 @@ Module( value: Name( ExprName { range: 129..132, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -258,7 +298,9 @@ Module( value: Name( ExprName { range: 136..139, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_param_spec_missing_default.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_param_spec_missing_default.py.snap index 26192a5aec7ee2..d0671fba9c0ec9 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_param_spec_missing_default.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_param_spec_missing_default.py.snap @@ -15,7 +15,9 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -27,7 +29,9 @@ Module( TypeParamParamSpec { range: 7..12, name: Identifier { - id: "P", + id: Name( + "P", + ), range: 9..10, }, default: None, @@ -39,7 +43,9 @@ Module( value: Name( ExprName { range: 16..19, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -51,7 +57,9 @@ Module( name: Name( ExprName { range: 25..26, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -63,7 +71,9 @@ Module( TypeParamParamSpec { range: 27..32, name: Identifier { - id: "P", + id: Name( + "P", + ), range: 29..30, }, default: None, @@ -73,7 +83,9 @@ Module( TypeParamTypeVar { range: 34..36, name: Identifier { - id: "T2", + id: Name( + "T2", + ), range: 34..36, }, bound: None, @@ -86,7 +98,9 @@ Module( value: Name( ExprName { range: 40..43, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_invalid_default_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_invalid_default_expr.py.snap index 439efae18716c8..2b98a3eb513300 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_invalid_default_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_invalid_default_expr.py.snap @@ -15,7 +15,9 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -27,7 +29,9 @@ Module( TypeParamTypeVar { range: 7..15, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 7..8, }, bound: None, @@ -38,7 +42,9 @@ Module( value: Name( ExprName { range: 12..15, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -54,7 +60,9 @@ Module( value: Name( ExprName { range: 19..22, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -66,7 +74,9 @@ Module( name: Name( ExprName { range: 28..29, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -78,7 +88,9 @@ Module( TypeParamTypeVar { range: 30..41, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 30..31, }, bound: None, @@ -90,7 +102,9 @@ Module( Name( ExprName { range: 40..41, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -106,7 +120,9 @@ Module( value: Name( ExprName { range: 45..48, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -118,7 +134,9 @@ Module( name: Name( ExprName { range: 54..55, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -130,7 +148,9 @@ Module( TypeParamTypeVar { range: 56..69, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 56..57, }, bound: None, @@ -142,7 +162,9 @@ Module( Name( ExprName { range: 67..68, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -158,7 +180,9 @@ Module( value: Name( ExprName { range: 73..76, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -170,7 +194,9 @@ Module( name: Name( ExprName { range: 82..83, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -182,7 +208,9 @@ Module( TypeParamTypeVar { range: 84..100, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 84..85, }, bound: None, @@ -193,7 +221,9 @@ Module( value: Name( ExprName { range: 99..100, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -208,7 +238,9 @@ Module( value: Name( ExprName { range: 104..107, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -220,7 +252,9 @@ Module( name: Name( ExprName { range: 113..114, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -232,7 +266,9 @@ Module( TypeParamTypeVar { range: 115..120, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 115..116, }, bound: None, @@ -240,7 +276,9 @@ Module( Name( ExprName { range: 119..120, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -251,7 +289,9 @@ Module( TypeParamTypeVar { range: 124..127, name: Identifier { - id: "int", + id: Name( + "int", + ), range: 124..127, }, bound: None, @@ -264,7 +304,9 @@ Module( value: Name( ExprName { range: 131..134, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -276,7 +318,9 @@ Module( name: Name( ExprName { range: 140..141, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -288,14 +332,18 @@ Module( TypeParamTypeVar { range: 142..155, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 142..143, }, bound: Some( Name( ExprName { range: 145..148, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -307,7 +355,9 @@ Module( value: Name( ExprName { range: 152..155, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -323,7 +373,9 @@ Module( value: Name( ExprName { range: 159..162, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_missing_default.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_missing_default.py.snap index 7f4c56d9d7bb3d..47101be1790a93 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_missing_default.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_missing_default.py.snap @@ -15,7 +15,9 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -27,7 +29,9 @@ Module( TypeParamTypeVar { range: 7..10, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 7..8, }, bound: None, @@ -40,7 +44,9 @@ Module( value: Name( ExprName { range: 14..17, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -52,7 +58,9 @@ Module( name: Name( ExprName { range: 23..24, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -64,14 +72,18 @@ Module( TypeParamTypeVar { range: 25..33, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 25..26, }, bound: Some( Name( ExprName { range: 28..31, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -85,7 +97,9 @@ Module( value: Name( ExprName { range: 37..40, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -97,7 +111,9 @@ Module( name: Name( ExprName { range: 46..47, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -109,7 +125,9 @@ Module( TypeParamTypeVar { range: 48..52, name: Identifier { - id: "T1", + id: Name( + "T1", + ), range: 48..50, }, bound: None, @@ -120,7 +138,9 @@ Module( TypeParamTypeVar { range: 54..56, name: Identifier { - id: "T2", + id: Name( + "T2", + ), range: 54..56, }, bound: None, @@ -133,7 +153,9 @@ Module( value: Name( ExprName { range: 60..63, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_tuple_bound.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_tuple_bound.py.snap index a5a86ddffdcdab..17da176b90b20f 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_tuple_bound.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_tuple_bound.py.snap @@ -15,7 +15,9 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -27,7 +29,9 @@ Module( TypeParamTypeVarTuple { range: 7..9, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 8..9, }, default: None, @@ -39,7 +43,9 @@ Module( value: Name( ExprName { range: 9..9, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -51,7 +57,9 @@ Module( value: Name( ExprName { range: 11..14, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -63,7 +71,9 @@ Module( value: Name( ExprName { range: 18..21, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_tuple_invalid_default_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_tuple_invalid_default_expr.py.snap index b17121dac35361..cfced777fcd4d9 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_tuple_invalid_default_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_tuple_invalid_default_expr.py.snap @@ -15,7 +15,9 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -27,7 +29,9 @@ Module( TypeParamTypeVarTuple { range: 7..17, name: Identifier { - id: "Ts", + id: Name( + "Ts", + ), range: 8..10, }, default: Some( @@ -37,7 +41,9 @@ Module( value: Name( ExprName { range: 14..17, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -53,7 +59,9 @@ Module( value: Name( ExprName { range: 21..24, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -65,7 +73,9 @@ Module( name: Name( ExprName { range: 30..31, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -77,7 +87,9 @@ Module( TypeParamTypeVarTuple { range: 32..49, name: Identifier { - id: "Ts", + id: Name( + "Ts", + ), range: 33..35, }, default: Some( @@ -92,14 +104,18 @@ Module( Name( ExprName { range: 39..42, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), Name( ExprName { range: 46..49, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -118,7 +134,9 @@ Module( value: Name( ExprName { range: 53..56, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -130,7 +148,9 @@ Module( name: Name( ExprName { range: 62..63, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -142,7 +162,9 @@ Module( TypeParamTypeVarTuple { range: 64..77, name: Identifier { - id: "Ts", + id: Name( + "Ts", + ), range: 65..67, }, default: Some( @@ -153,7 +175,9 @@ Module( Name( ExprName { range: 76..77, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -169,7 +193,9 @@ Module( value: Name( ExprName { range: 81..84, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -181,7 +207,9 @@ Module( name: Name( ExprName { range: 90..91, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -193,7 +221,9 @@ Module( TypeParamTypeVarTuple { range: 92..110, name: Identifier { - id: "Ts", + id: Name( + "Ts", + ), range: 93..95, }, default: Some( @@ -203,7 +233,9 @@ Module( value: Name( ExprName { range: 109..110, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -218,7 +250,9 @@ Module( value: Name( ExprName { range: 114..117, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -230,7 +264,9 @@ Module( name: Name( ExprName { range: 123..124, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -242,14 +278,18 @@ Module( TypeParamTypeVarTuple { range: 125..132, name: Identifier { - id: "Ts", + id: Name( + "Ts", + ), range: 126..128, }, default: Some( Name( ExprName { range: 131..132, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -260,7 +300,9 @@ Module( TypeParamTypeVar { range: 136..139, name: Identifier { - id: "int", + id: Name( + "int", + ), range: 136..139, }, bound: None, @@ -273,7 +315,9 @@ Module( value: Name( ExprName { range: 143..146, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_tuple_missing_default.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_tuple_missing_default.py.snap index c1fa0dfd5a7d20..b2e836860feb71 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_tuple_missing_default.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_tuple_missing_default.py.snap @@ -15,7 +15,9 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -27,7 +29,9 @@ Module( TypeParamTypeVarTuple { range: 7..12, name: Identifier { - id: "Ts", + id: Name( + "Ts", + ), range: 8..10, }, default: None, @@ -39,7 +43,9 @@ Module( value: Name( ExprName { range: 16..19, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -51,7 +57,9 @@ Module( name: Name( ExprName { range: 25..26, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -63,7 +71,9 @@ Module( TypeParamTypeVarTuple { range: 27..32, name: Identifier { - id: "Ts", + id: Name( + "Ts", + ), range: 28..30, }, default: None, @@ -73,7 +83,9 @@ Module( TypeParamTypeVar { range: 34..36, name: Identifier { - id: "T2", + id: Name( + "T2", + ), range: 34..36, }, bound: None, @@ -86,7 +98,9 @@ Module( value: Name( ExprName { range: 40..43, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_params_empty.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_params_empty.py.snap index 3baa5f941a44fb..dcbe67576e00d9 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_params_empty.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_params_empty.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: Some( @@ -48,7 +50,9 @@ Module( name: Name( ExprName { range: 27..36, - id: "ListOrSet", + id: Name( + "ListOrSet", + ), ctx: Store, }, ), @@ -64,7 +68,9 @@ Module( left: Name( ExprName { range: 41..45, - id: "list", + id: Name( + "list", + ), ctx: Load, }, ), @@ -72,7 +78,9 @@ Module( right: Name( ExprName { range: 48..51, - id: "set", + id: Name( + "set", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@unterminated_fstring_newline_recovery.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@unterminated_fstring_newline_recovery.py.snap index 56366ca7a45a43..ff13c4b75b3c3e 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@unterminated_fstring_newline_recovery.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@unterminated_fstring_newline_recovery.py.snap @@ -85,7 +85,9 @@ Module( expression: Name( ExprName { range: 23..24, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -159,7 +161,9 @@ Module( expression: Name( ExprName { range: 40..41, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -238,7 +242,9 @@ Module( expression: Name( ExprName { range: 58..59, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@while_stmt_invalid_test_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@while_stmt_invalid_test_expr.py.snap index f137f3aa87ea09..adccac7f40cd64 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@while_stmt_invalid_test_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@while_stmt_invalid_test_expr.py.snap @@ -18,7 +18,9 @@ Module( value: Name( ExprName { range: 7..8, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -50,7 +52,9 @@ Module( Name( ExprName { range: 26..27, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -78,7 +82,9 @@ Module( test: Name( ExprName { range: 39..40, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -92,7 +98,9 @@ Module( target: Name( ExprName { range: 42..43, - id: "b", + id: Name( + "b", + ), ctx: Store, }, ), @@ -114,7 +122,9 @@ Module( target: Name( ExprName { range: 55..56, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), @@ -138,7 +148,9 @@ Module( target: Name( ExprName { range: 63..64, - id: "b", + id: Name( + "b", + ), ctx: Store, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@while_stmt_missing_colon.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@while_stmt_missing_colon.py.snap index e02b4c349f80a1..04da54348d1f3e 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@while_stmt_missing_colon.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@while_stmt_missing_colon.py.snap @@ -18,7 +18,9 @@ Module( left: Name( ExprName { range: 12..13, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@while_stmt_missing_test.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@while_stmt_missing_test.py.snap index ae8c83e43eebf3..a1827d7fc38428 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@while_stmt_missing_test.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@while_stmt_missing_test.py.snap @@ -15,7 +15,9 @@ Module( test: Name( ExprName { range: 5..5, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -40,7 +42,9 @@ Module( test: Name( ExprName { range: 17..17, - id: "", + id: Name( + "", + ), ctx: Invalid, }, ), @@ -52,7 +56,9 @@ Module( Name( ExprName { range: 24..25, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@with_items_parenthesized_missing_colon.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@with_items_parenthesized_missing_colon.py.snap index 0e9639c5491a0b..d04b2ccd173d49 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@with_items_parenthesized_missing_colon.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@with_items_parenthesized_missing_colon.py.snap @@ -19,7 +19,9 @@ Module( context_expr: Name( ExprName { range: 34..39, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), @@ -30,7 +32,9 @@ Module( context_expr: Name( ExprName { range: 41..46, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@with_items_parenthesized_missing_comma.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@with_items_parenthesized_missing_comma.py.snap index d963f9c1b8b3d6..ae619242264fdc 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@with_items_parenthesized_missing_comma.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@with_items_parenthesized_missing_comma.py.snap @@ -19,7 +19,9 @@ Module( context_expr: Name( ExprName { range: 6..11, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), @@ -30,7 +32,9 @@ Module( context_expr: Name( ExprName { range: 12..17, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -61,7 +65,9 @@ Module( context_expr: Name( ExprName { range: 30..35, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), @@ -69,7 +75,9 @@ Module( Name( ExprName { range: 39..41, - id: "f1", + id: Name( + "f1", + ), ctx: Store, }, ), @@ -80,7 +88,9 @@ Module( context_expr: Name( ExprName { range: 42..47, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -111,7 +121,9 @@ Module( context_expr: Name( ExprName { range: 60..65, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), @@ -122,7 +134,9 @@ Module( context_expr: Name( ExprName { range: 67..72, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -133,7 +147,9 @@ Module( context_expr: Name( ExprName { range: 73..78, - id: "item3", + id: Name( + "item3", + ), ctx: Load, }, ), @@ -144,7 +160,9 @@ Module( context_expr: Name( ExprName { range: 80..85, - id: "item4", + id: Name( + "item4", + ), ctx: Load, }, ), @@ -175,7 +193,9 @@ Module( context_expr: Name( ExprName { range: 98..103, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), @@ -186,7 +206,9 @@ Module( context_expr: Name( ExprName { range: 105..110, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -194,7 +216,9 @@ Module( Name( ExprName { range: 114..116, - id: "f1", + id: Name( + "f1", + ), ctx: Store, }, ), @@ -205,7 +229,9 @@ Module( context_expr: Name( ExprName { range: 117..122, - id: "item3", + id: Name( + "item3", + ), ctx: Load, }, ), @@ -216,7 +242,9 @@ Module( context_expr: Name( ExprName { range: 124..129, - id: "item4", + id: Name( + "item4", + ), ctx: Load, }, ), @@ -251,14 +279,18 @@ Module( Name( ExprName { range: 142..147, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), Name( ExprName { range: 149..154, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@ambiguous_lpar_with_items_binary_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@ambiguous_lpar_with_items_binary_expr.py.snap index 500e275e86d260..b40f6be4db72e4 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@ambiguous_lpar_with_items_binary_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@ambiguous_lpar_with_items_binary_expr.py.snap @@ -24,14 +24,18 @@ Module( Name( ExprName { range: 130..131, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 137..138, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -68,7 +72,9 @@ Module( left: Name( ExprName { range: 150..151, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -79,7 +85,9 @@ Module( Name( ExprName { range: 160..161, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -118,7 +126,9 @@ Module( Name( ExprName { range: 202..203, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -130,14 +140,18 @@ Module( Name( ExprName { range: 208..209, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), Name( ExprName { range: 214..215, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -184,14 +198,18 @@ Module( Name( ExprName { range: 227..228, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 234..235, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -201,7 +219,9 @@ Module( Name( ExprName { range: 239..240, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -244,7 +264,9 @@ Module( left: Name( ExprName { range: 252..253, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -252,7 +274,9 @@ Module( right: Name( ExprName { range: 256..257, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -262,7 +286,9 @@ Module( right: Name( ExprName { range: 262..263, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -272,7 +298,9 @@ Module( right: Name( ExprName { range: 266..267, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), @@ -311,7 +339,9 @@ Module( value: Name( ExprName { range: 318..319, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -333,7 +363,9 @@ Module( left: Name( ExprName { range: 326..327, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -341,7 +373,9 @@ Module( right: Name( ExprName { range: 330..331, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@ambiguous_lpar_with_items_if_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@ambiguous_lpar_with_items_if_expr.py.snap index 97ec50ffc25234..d46f790d9371e9 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@ambiguous_lpar_with_items_if_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@ambiguous_lpar_with_items_if_expr.py.snap @@ -28,14 +28,18 @@ Module( body: Name( ExprName { range: 6..7, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 22..23, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -80,7 +84,9 @@ Module( elt: Name( ExprName { range: 35..36, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -90,14 +96,18 @@ Module( target: Name( ExprName { range: 41..42, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 46..50, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), @@ -111,7 +121,9 @@ Module( orelse: Name( ExprName { range: 65..66, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -156,7 +168,9 @@ Module( elt: Name( ExprName { range: 78..79, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -166,14 +180,18 @@ Module( target: Name( ExprName { range: 90..91, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 95..99, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), @@ -187,7 +205,9 @@ Module( orelse: Name( ExprName { range: 114..115, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -232,7 +252,9 @@ Module( value: Name( ExprName { range: 127..128, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -250,7 +272,9 @@ Module( orelse: Name( ExprName { range: 146..147, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@ann_assign_stmt_simple_target.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@ann_assign_stmt_simple_target.py.snap index 540459aee88b88..4d3d5c197a9cf9 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@ann_assign_stmt_simple_target.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@ann_assign_stmt_simple_target.py.snap @@ -15,14 +15,18 @@ Module( target: Name( ExprName { range: 0..1, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), annotation: Name( ExprName { range: 3..6, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -36,14 +40,18 @@ Module( target: Name( ExprName { range: 18..19, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), annotation: Name( ExprName { range: 22..25, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -60,12 +68,16 @@ Module( value: Name( ExprName { range: 26..27, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), attr: Identifier { - id: "b", + id: Name( + "b", + ), range: 28..29, }, ctx: Store, @@ -74,7 +86,9 @@ Module( annotation: Name( ExprName { range: 31..34, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -91,7 +105,9 @@ Module( value: Name( ExprName { range: 35..36, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -109,7 +125,9 @@ Module( annotation: Name( ExprName { range: 41..44, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@assign_targets_terminator.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@assign_targets_terminator.py.snap index 9bfc041ffa6576..bab6e3d89765b1 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@assign_targets_terminator.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@assign_targets_terminator.py.snap @@ -16,21 +16,27 @@ Module( Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), Name( ExprName { range: 4..5, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), Name( ExprName { range: 8..9, - id: "z", + id: Name( + "z", + ), ctx: Store, }, ), @@ -55,14 +61,18 @@ Module( Name( ExprName { range: 15..16, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 18..19, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -80,21 +90,27 @@ Module( Name( ExprName { range: 20..21, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), Name( ExprName { range: 24..25, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), Name( ExprName { range: 28..29, - id: "z", + id: Name( + "z", + ), ctx: Store, }, ), @@ -119,14 +135,18 @@ Module( Name( ExprName { range: 34..35, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 37..38, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@async_for_statement.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@async_for_statement.py.snap index 3a09a0409687d5..7ac5bfd0e5e806 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@async_for_statement.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@async_for_statement.py.snap @@ -16,14 +16,18 @@ Module( target: Name( ExprName { range: 10..16, - id: "target", + id: Name( + "target", + ), ctx: Store, }, ), iter: Name( ExprName { range: 20..24, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@async_function_definition.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@async_function_definition.py.snap index 0a0aab9974b023..c758233672e05b 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@async_function_definition.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@async_function_definition.py.snap @@ -15,7 +15,9 @@ Module( is_async: true, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 10..13, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@async_with_statement.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@async_with_statement.py.snap index 5d3ae7ebf4ed18..5d7e058a9104cb 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@async_with_statement.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@async_with_statement.py.snap @@ -19,7 +19,9 @@ Module( context_expr: Name( ExprName { range: 11..15, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@class_def_arguments.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@class_def_arguments.py.snap index d9745c22869264..32cbf62e857aac 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@class_def_arguments.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@class_def_arguments.py.snap @@ -14,7 +14,9 @@ Module( range: 0..14, decorator_list: [], name: Identifier { - id: "Foo", + id: Name( + "Foo", + ), range: 6..9, }, type_params: None, @@ -38,7 +40,9 @@ Module( range: 15..31, decorator_list: [], name: Identifier { - id: "Foo", + id: Name( + "Foo", + ), range: 21..24, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@decorator_async_function.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@decorator_async_function.py.snap index f4728ee98772f8..b0aa100842efdc 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@decorator_async_function.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@decorator_async_function.py.snap @@ -19,14 +19,18 @@ Module( expression: Name( ExprName { range: 1..10, - id: "decorator", + id: Name( + "decorator", + ), ctx: Load, }, ), }, ], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 21..24, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@del_targets_terminator.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@del_targets_terminator.py.snap index 2de88d61277424..4e25c49da5a975 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@del_targets_terminator.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@del_targets_terminator.py.snap @@ -16,14 +16,18 @@ Module( Name( ExprName { range: 4..5, - id: "a", + id: Name( + "a", + ), ctx: Del, }, ), Name( ExprName { range: 7..8, - id: "b", + id: Name( + "b", + ), ctx: Del, }, ), @@ -40,14 +44,18 @@ Module( Name( ExprName { range: 10..11, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), Name( ExprName { range: 13..14, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), @@ -65,14 +73,18 @@ Module( Name( ExprName { range: 19..20, - id: "a", + id: Name( + "a", + ), ctx: Del, }, ), Name( ExprName { range: 22..23, - id: "b", + id: Name( + "b", + ), ctx: Del, }, ), @@ -89,14 +101,18 @@ Module( Name( ExprName { range: 24..25, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), Name( ExprName { range: 27..28, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@dotted_name_normalized_spaces.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@dotted_name_normalized_spaces.py.snap index c404f5613ca9ac..b056408bcb1073 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@dotted_name_normalized_spaces.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@dotted_name_normalized_spaces.py.snap @@ -16,7 +16,9 @@ Module( Alias { range: 7..12, name: Identifier { - id: "a.b.c", + id: Name( + "a.b.c", + ), range: 7..12, }, asname: None, @@ -31,7 +33,9 @@ Module( Alias { range: 20..31, name: Identifier { - id: "a.b.c", + id: Name( + "a.b.c", + ), range: 20..31, }, asname: None, diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@except_stmt_as_name_soft_keyword.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@except_stmt_as_name_soft_keyword.py.snap index d9ddd2be7c2d1e..d2e81febd42573 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@except_stmt_as_name_soft_keyword.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@except_stmt_as_name_soft_keyword.py.snap @@ -32,14 +32,18 @@ Module( Name( ExprName { range: 16..25, - id: "Exception", + id: Name( + "Exception", + ), ctx: Load, }, ), ), name: Some( Identifier { - id: "match", + id: Name( + "match", + ), range: 29..34, }, ), @@ -64,14 +68,18 @@ Module( Name( ExprName { range: 47..56, - id: "Exception", + id: Name( + "Exception", + ), ctx: Load, }, ), ), name: Some( Identifier { - id: "case", + id: Name( + "case", + ), range: 60..64, }, ), @@ -96,14 +104,18 @@ Module( Name( ExprName { range: 77..86, - id: "Exception", + id: Name( + "Exception", + ), ctx: Load, }, ), ), name: Some( Identifier { - id: "type", + id: Name( + "type", + ), range: 90..94, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__arguments.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__arguments.py.snap index 0d4e1b3d358cb0..8d0afbc4f9f2a6 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__arguments.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__arguments.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 102..106, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -40,7 +42,9 @@ Module( func: Name( ExprName { range: 109..113, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -50,14 +54,18 @@ Module( Name( ExprName { range: 114..115, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 117..118, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -77,7 +85,9 @@ Module( func: Name( ExprName { range: 120..124, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -87,14 +97,18 @@ Module( Name( ExprName { range: 125..126, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 128..129, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -114,7 +128,9 @@ Module( func: Name( ExprName { range: 150..154, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -126,7 +142,9 @@ Module( range: 155..158, arg: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 155..156, }, ), @@ -143,7 +161,9 @@ Module( range: 160..163, arg: Some( Identifier { - id: "y", + id: Name( + "y", + ), range: 160..161, }, ), @@ -171,7 +191,9 @@ Module( func: Name( ExprName { range: 165..169, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -184,7 +206,9 @@ Module( value: Name( ExprName { range: 171..172, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -207,7 +231,9 @@ Module( func: Name( ExprName { range: 174..178, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -221,7 +247,9 @@ Module( value: Name( ExprName { range: 181..182, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -241,7 +269,9 @@ Module( func: Name( ExprName { range: 193..197, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -251,7 +281,9 @@ Module( Name( ExprName { range: 198..199, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -261,7 +293,9 @@ Module( range: 201..204, arg: Some( Identifier { - id: "y", + id: Name( + "y", + ), range: 201..202, }, ), @@ -289,7 +323,9 @@ Module( func: Name( ExprName { range: 206..210, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -299,7 +335,9 @@ Module( Name( ExprName { range: 211..212, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -309,7 +347,9 @@ Module( value: Name( ExprName { range: 215..216, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -332,7 +372,9 @@ Module( func: Name( ExprName { range: 218..222, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -342,7 +384,9 @@ Module( Name( ExprName { range: 223..224, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -354,7 +398,9 @@ Module( value: Name( ExprName { range: 228..229, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -374,7 +420,9 @@ Module( func: Name( ExprName { range: 231..235, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -387,7 +435,9 @@ Module( value: Name( ExprName { range: 242..243, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -400,7 +450,9 @@ Module( range: 236..239, arg: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 236..237, }, ), @@ -428,7 +480,9 @@ Module( func: Name( ExprName { range: 245..249, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -440,7 +494,9 @@ Module( range: 250..253, arg: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 250..251, }, ), @@ -459,7 +515,9 @@ Module( value: Name( ExprName { range: 257..258, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -479,7 +537,9 @@ Module( func: Name( ExprName { range: 260..264, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -492,7 +552,9 @@ Module( value: Name( ExprName { range: 266..267, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -507,7 +569,9 @@ Module( value: Name( ExprName { range: 271..272, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -527,7 +591,9 @@ Module( func: Name( ExprName { range: 274..278, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -540,7 +606,9 @@ Module( value: Name( ExprName { range: 280..281, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -550,14 +618,18 @@ Module( Name( ExprName { range: 283..284, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), Name( ExprName { range: 286..287, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -577,7 +649,9 @@ Module( func: Name( ExprName { range: 289..293, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -591,7 +665,9 @@ Module( value: Name( ExprName { range: 296..297, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -600,7 +676,9 @@ Module( range: 299..302, arg: Some( Identifier { - id: "y", + id: Name( + "y", + ), range: 299..300, }, ), @@ -617,7 +695,9 @@ Module( range: 304..307, arg: Some( Identifier { - id: "z", + id: Name( + "z", + ), range: 304..305, }, ), @@ -645,7 +725,9 @@ Module( func: Name( ExprName { range: 309..313, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -658,7 +740,9 @@ Module( value: Name( ExprName { range: 315..317, - id: "x1", + id: Name( + "x1", + ), ctx: Load, }, ), @@ -671,7 +755,9 @@ Module( value: Name( ExprName { range: 320..322, - id: "x2", + id: Name( + "x2", + ), ctx: Load, }, ), @@ -686,7 +772,9 @@ Module( value: Name( ExprName { range: 326..328, - id: "y1", + id: Name( + "y1", + ), ctx: Load, }, ), @@ -697,7 +785,9 @@ Module( value: Name( ExprName { range: 332..334, - id: "y2", + id: Name( + "y2", + ), ctx: Load, }, ), @@ -717,7 +807,9 @@ Module( func: Name( ExprName { range: 336..340, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -729,7 +821,9 @@ Module( range: 341..344, arg: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 341..342, }, ), @@ -748,7 +842,9 @@ Module( value: Name( ExprName { range: 348..349, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -757,7 +853,9 @@ Module( range: 351..354, arg: Some( Identifier { - id: "z", + id: Name( + "z", + ), range: 351..352, }, ), @@ -785,7 +883,9 @@ Module( func: Name( ExprName { range: 378..382, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -797,7 +897,9 @@ Module( range: 383..401, arg: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 383..384, }, ), @@ -844,7 +946,9 @@ Module( func: Name( ExprName { range: 403..407, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -856,7 +960,9 @@ Module( range: 408..417, arg: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 408..409, }, ), @@ -866,7 +972,9 @@ Module( value: Name( ExprName { range: 416..417, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -888,7 +996,9 @@ Module( func: Name( ExprName { range: 419..423, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -900,7 +1010,9 @@ Module( range: 424..437, arg: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 424..425, }, ), @@ -917,7 +1029,9 @@ Module( parameter: Parameter { range: 433..434, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 433..434, }, annotation: None, @@ -933,7 +1047,9 @@ Module( body: Name( ExprName { range: 436..437, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -955,7 +1071,9 @@ Module( func: Name( ExprName { range: 439..443, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -967,7 +1085,9 @@ Module( range: 444..454, arg: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 444..445, }, ), @@ -977,7 +1097,9 @@ Module( target: Name( ExprName { range: 447..448, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -1007,7 +1129,9 @@ Module( func: Name( ExprName { range: 476..480, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -1021,7 +1145,9 @@ Module( Name( ExprName { range: 488..489, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1044,7 +1170,9 @@ Module( func: Name( ExprName { range: 492..496, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -1057,7 +1185,9 @@ Module( value: Name( ExprName { range: 509..510, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1079,7 +1209,9 @@ Module( func: Name( ExprName { range: 533..537, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -1092,7 +1224,9 @@ Module( target: Name( ExprName { range: 538..539, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -1122,7 +1256,9 @@ Module( func: Name( ExprName { range: 546..550, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -1138,7 +1274,9 @@ Module( target: Name( ExprName { range: 551..552, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -1158,14 +1296,18 @@ Module( target: Name( ExprName { range: 562..563, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 567..571, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), @@ -1192,7 +1334,9 @@ Module( func: Name( ExprName { range: 596..600, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -1210,14 +1354,18 @@ Module( Name( ExprName { range: 602..603, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 608..609, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -1243,7 +1391,9 @@ Module( func: Name( ExprName { range: 611..615, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -1259,7 +1409,9 @@ Module( left: Name( ExprName { range: 617..618, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1267,7 +1419,9 @@ Module( right: Name( ExprName { range: 621..622, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -1292,7 +1446,9 @@ Module( func: Name( ExprName { range: 624..628, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -1308,7 +1464,9 @@ Module( value: Name( ExprName { range: 636..637, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1333,7 +1491,9 @@ Module( func: Name( ExprName { range: 639..643, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -1356,7 +1516,9 @@ Module( parameter: Parameter { range: 652..653, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 652..653, }, annotation: None, @@ -1372,7 +1534,9 @@ Module( body: Name( ExprName { range: 655..656, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1397,7 +1561,9 @@ Module( func: Name( ExprName { range: 658..662, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -1419,14 +1585,18 @@ Module( body: Name( ExprName { range: 664..665, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 679..680, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -1451,7 +1621,9 @@ Module( func: Name( ExprName { range: 700..704, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -1465,7 +1637,9 @@ Module( value: Name( ExprName { range: 707..708, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1485,7 +1659,9 @@ Module( func: Name( ExprName { range: 710..714, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -1504,14 +1680,18 @@ Module( Name( ExprName { range: 717..718, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 723..724, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -1534,7 +1714,9 @@ Module( func: Name( ExprName { range: 726..730, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -1551,7 +1733,9 @@ Module( value: Name( ExprName { range: 739..740, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1573,7 +1757,9 @@ Module( func: Name( ExprName { range: 742..746, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -1596,14 +1782,18 @@ Module( body: Name( ExprName { range: 749..750, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 764..765, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -1625,7 +1815,9 @@ Module( func: Name( ExprName { range: 767..771, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -1643,7 +1835,9 @@ Module( Name( ExprName { range: 781..782, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1666,7 +1860,9 @@ Module( func: Name( ExprName { range: 785..789, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -1690,7 +1886,9 @@ Module( parameter: Parameter { range: 799..800, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 799..800, }, annotation: None, @@ -1706,7 +1904,9 @@ Module( body: Name( ExprName { range: 802..803, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__attribute.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__attribute.py.snap index abf8605d69a7eb..20500e85d9e711 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__attribute.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__attribute.py.snap @@ -18,12 +18,16 @@ Module( value: Name( ExprName { range: 0..5, - id: "value", + id: Name( + "value", + ), ctx: Load, }, ), attr: Identifier { - id: "attr", + id: Name( + "attr", + ), range: 6..10, }, ctx: Load, @@ -43,12 +47,16 @@ Module( value: Name( ExprName { range: 11..16, - id: "value", + id: Name( + "value", + ), ctx: Load, }, ), attr: Identifier { - id: "attr", + id: Name( + "attr", + ), range: 17..21, }, ctx: Load, @@ -75,7 +83,9 @@ Module( func: Name( ExprName { range: 24..29, - id: "value", + id: Name( + "value", + ), ctx: Load, }, ), @@ -87,7 +97,9 @@ Module( }, ), attr: Identifier { - id: "attr", + id: Name( + "attr", + ), range: 32..36, }, ctx: Load, @@ -113,7 +125,9 @@ Module( func: Name( ExprName { range: 37..42, - id: "value", + id: Name( + "value", + ), ctx: Load, }, ), @@ -125,7 +139,9 @@ Module( }, ), attr: Identifier { - id: "attr", + id: Name( + "attr", + ), range: 45..49, }, ctx: Load, @@ -139,7 +155,9 @@ Module( }, ), attr: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 52..55, }, ctx: Load, @@ -159,19 +177,25 @@ Module( value: Name( ExprName { range: 56..61, - id: "value", + id: Name( + "value", + ), ctx: Load, }, ), attr: Identifier { - id: "attr", + id: Name( + "attr", + ), range: 62..66, }, ctx: Load, }, ), attr: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 67..70, }, ctx: Load, @@ -194,12 +218,16 @@ Module( value: Name( ExprName { range: 72..77, - id: "value", + id: Name( + "value", + ), ctx: Load, }, ), attr: Identifier { - id: "attr", + id: Name( + "attr", + ), range: 79..83, }, ctx: Load, @@ -213,7 +241,9 @@ Module( }, ), attr: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 86..89, }, ctx: Load, diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__await.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__await.py.snap index e000166f052dd4..0321e3c5a80e4e 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__await.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__await.py.snap @@ -18,7 +18,9 @@ Module( value: Name( ExprName { range: 6..7, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -38,7 +40,9 @@ Module( value: Name( ExprName { range: 14..15, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -71,7 +75,9 @@ Module( value: Name( ExprName { range: 26..27, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -80,7 +86,9 @@ Module( Name( ExprName { range: 32..33, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -101,7 +109,9 @@ Module( func: Name( ExprName { range: 40..41, - id: "f", + id: Name( + "f", + ), ctx: Load, }, ), @@ -198,7 +208,9 @@ Module( Name( ExprName { range: 77..78, - id: "i", + id: Name( + "i", + ), ctx: Load, }, ), @@ -343,7 +355,9 @@ Module( value: Name( ExprName { range: 127..128, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -374,7 +388,9 @@ Module( value: Name( ExprName { range: 155..156, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -409,7 +425,9 @@ Module( parameter: Parameter { range: 173..174, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 173..174, }, annotation: None, @@ -425,7 +443,9 @@ Module( body: Name( ExprName { range: 176..177, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -447,7 +467,9 @@ Module( value: Name( ExprName { range: 185..186, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -461,7 +483,9 @@ Module( operand: Name( ExprName { range: 191..192, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -483,7 +507,9 @@ Module( value: Name( ExprName { range: 199..200, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -496,7 +522,9 @@ Module( value: Name( ExprName { range: 210..211, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__bin_op.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__bin_op.py.snap index 982687c7f10075..5e7a2cdb1e4553 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__bin_op.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__bin_op.py.snap @@ -1018,7 +1018,9 @@ Module( left: Name( ExprName { range: 390..391, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1030,7 +1032,9 @@ Module( operand: Name( ExprName { range: 395..396, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__bool_op.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__bool_op.py.snap index 2cf78690b7e877..4b3a75f62c20f9 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__bool_op.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__bool_op.py.snap @@ -20,14 +20,18 @@ Module( Name( ExprName { range: 0..1, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 6..7, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -47,21 +51,27 @@ Module( Name( ExprName { range: 8..9, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 14..15, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), Name( ExprName { range: 20..21, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -81,14 +91,18 @@ Module( Name( ExprName { range: 22..23, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 27..28, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -108,21 +122,27 @@ Module( Name( ExprName { range: 29..30, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 34..35, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), Name( ExprName { range: 39..40, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -147,14 +167,18 @@ Module( Name( ExprName { range: 41..42, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 47..48, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -164,7 +188,9 @@ Module( Name( ExprName { range: 52..53, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -189,21 +215,27 @@ Module( Name( ExprName { range: 54..55, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 60..61, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), Name( ExprName { range: 66..67, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -213,7 +245,9 @@ Module( Name( ExprName { range: 71..72, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), @@ -225,14 +259,18 @@ Module( Name( ExprName { range: 76..77, - id: "e", + id: Name( + "e", + ), ctx: Load, }, ), Name( ExprName { range: 82..83, - id: "f", + id: Name( + "f", + ), ctx: Load, }, ), @@ -242,7 +280,9 @@ Module( Name( ExprName { range: 87..88, - id: "g", + id: Name( + "g", + ), ctx: Load, }, ), @@ -267,7 +307,9 @@ Module( Name( ExprName { range: 89..90, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -278,7 +320,9 @@ Module( operand: Name( ExprName { range: 99..100, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -290,7 +334,9 @@ Module( Name( ExprName { range: 104..105, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -319,14 +365,18 @@ Module( Name( ExprName { range: 112..113, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 118..119, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -336,7 +386,9 @@ Module( Name( ExprName { range: 123..124, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -368,7 +420,9 @@ Module( operand: Name( ExprName { range: 129..130, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -377,7 +431,9 @@ Module( Name( ExprName { range: 135..136, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -387,7 +443,9 @@ Module( Name( ExprName { range: 140..141, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__call.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__call.py.snap index 7234aa72add9d8..31e073afb45d73 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__call.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__call.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 114..118, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -43,12 +45,16 @@ Module( value: Name( ExprName { range: 121..125, - id: "attr", + id: Name( + "attr", + ), ctx: Load, }, ), attr: Identifier { - id: "expr", + id: Name( + "expr", + ), range: 126..130, }, ctx: Load, @@ -75,7 +81,9 @@ Module( value: Name( ExprName { range: 133..142, - id: "subscript", + id: Name( + "subscript", + ), ctx: Load, }, ), @@ -128,7 +136,9 @@ Module( value: Name( ExprName { range: 151..156, - id: "slice", + id: Name( + "slice", + ), ctx: Load, }, ), @@ -268,7 +278,9 @@ Module( elt: Name( ExprName { range: 188..189, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -278,14 +290,18 @@ Module( target: Name( ExprName { range: 194..195, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 199..203, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), @@ -426,7 +442,9 @@ Module( Name( ExprName { range: 241..242, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__compare.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__compare.py.snap index bd19b33575a9c0..26cec2237ca36c 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__compare.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__compare.py.snap @@ -18,7 +18,9 @@ Module( left: Name( ExprName { range: 9..10, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -29,7 +31,9 @@ Module( Name( ExprName { range: 14..15, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -47,7 +51,9 @@ Module( left: Name( ExprName { range: 16..17, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -58,7 +64,9 @@ Module( Name( ExprName { range: 20..21, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -76,7 +84,9 @@ Module( left: Name( ExprName { range: 22..23, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -87,7 +97,9 @@ Module( Name( ExprName { range: 26..27, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -105,7 +117,9 @@ Module( left: Name( ExprName { range: 28..29, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -116,7 +130,9 @@ Module( Name( ExprName { range: 33..34, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -134,7 +150,9 @@ Module( left: Name( ExprName { range: 35..36, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -145,7 +163,9 @@ Module( Name( ExprName { range: 40..41, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -163,7 +183,9 @@ Module( left: Name( ExprName { range: 42..43, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -174,7 +196,9 @@ Module( Name( ExprName { range: 47..48, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -192,7 +216,9 @@ Module( left: Name( ExprName { range: 49..50, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -203,7 +229,9 @@ Module( Name( ExprName { range: 54..55, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -221,7 +249,9 @@ Module( left: Name( ExprName { range: 56..57, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -232,7 +262,9 @@ Module( Name( ExprName { range: 61..62, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -250,7 +282,9 @@ Module( left: Name( ExprName { range: 63..64, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -261,7 +295,9 @@ Module( Name( ExprName { range: 72..73, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -279,7 +315,9 @@ Module( left: Name( ExprName { range: 74..75, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -290,7 +328,9 @@ Module( Name( ExprName { range: 83..84, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -308,7 +348,9 @@ Module( left: Name( ExprName { range: 110..111, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -323,35 +365,45 @@ Module( Name( ExprName { range: 119..120, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), Name( ExprName { range: 128..129, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), Name( ExprName { range: 137..138, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), Name( ExprName { range: 146..147, - id: "e", + id: Name( + "e", + ), ctx: Load, }, ), Name( ExprName { range: 155..156, - id: "f", + id: Name( + "f", + ), ctx: Load, }, ), @@ -372,7 +424,9 @@ Module( left: Name( ExprName { range: 177..178, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -380,7 +434,9 @@ Module( right: Name( ExprName { range: 181..182, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -397,7 +453,9 @@ Module( left: Name( ExprName { range: 185..186, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -405,7 +463,9 @@ Module( right: Name( ExprName { range: 189..190, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), @@ -417,7 +477,9 @@ Module( left: Name( ExprName { range: 198..199, - id: "e", + id: Name( + "e", + ), ctx: Load, }, ), @@ -425,7 +487,9 @@ Module( right: Name( ExprName { range: 202..203, - id: "f", + id: Name( + "f", + ), ctx: Load, }, ), @@ -449,7 +513,9 @@ Module( left: Name( ExprName { range: 383..384, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -460,7 +526,9 @@ Module( Name( ExprName { range: 392..393, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -482,7 +550,9 @@ Module( Name( ExprName { range: 395..396, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -497,7 +567,9 @@ Module( left: Name( ExprName { range: 400..401, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -508,7 +580,9 @@ Module( Name( ExprName { range: 409..410, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -518,7 +592,9 @@ Module( Name( ExprName { range: 415..416, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -539,7 +615,9 @@ Module( left: Name( ExprName { range: 417..418, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -553,7 +631,9 @@ Module( value: Name( ExprName { range: 428..429, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -573,7 +653,9 @@ Module( left: Name( ExprName { range: 430..431, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -587,7 +669,9 @@ Module( value: Name( ExprName { range: 445..446, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -607,7 +691,9 @@ Module( left: Name( ExprName { range: 489..490, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -626,63 +712,81 @@ Module( Name( ExprName { range: 493..494, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), Name( ExprName { range: 498..499, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), Name( ExprName { range: 502..503, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), Name( ExprName { range: 507..508, - id: "e", + id: Name( + "e", + ), ctx: Load, }, ), Name( ExprName { range: 516..517, - id: "f", + id: Name( + "f", + ), ctx: Load, }, ), Name( ExprName { range: 525..526, - id: "g", + id: Name( + "g", + ), ctx: Load, }, ), Name( ExprName { range: 530..531, - id: "h", + id: Name( + "h", + ), ctx: Load, }, ), Name( ExprName { range: 535..536, - id: "i", + id: Name( + "i", + ), ctx: Load, }, ), Name( ExprName { range: 540..541, - id: "j", + id: Name( + "j", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__dictionary.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__dictionary.py.snap index 502274b405e345..68be01912cf4f9 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__dictionary.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__dictionary.py.snap @@ -84,7 +84,9 @@ Module( Name( ExprName { range: 26..27, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -103,7 +105,9 @@ Module( Name( ExprName { range: 32..33, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -306,7 +310,9 @@ Module( parameter: Parameter { range: 163..164, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 163..164, }, annotation: None, @@ -322,7 +328,9 @@ Module( body: Name( ExprName { range: 166..167, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -384,7 +392,9 @@ Module( parameter: Parameter { range: 185..186, name: Identifier { - id: "p", + id: Name( + "p", + ), range: 185..186, }, annotation: None, @@ -429,7 +439,9 @@ Module( value: Name( ExprName { range: 199..200, - id: "C", + id: Name( + "C", + ), ctx: Load, }, ), @@ -454,7 +466,9 @@ Module( target: Name( ExprName { range: 226..227, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -472,7 +486,9 @@ Module( value: Name( ExprName { range: 235..236, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -497,7 +513,9 @@ Module( target: Name( ExprName { range: 240..241, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -518,7 +536,9 @@ Module( target: Name( ExprName { range: 250..251, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -550,7 +570,9 @@ Module( value: Name( ExprName { range: 287..288, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), @@ -572,7 +594,9 @@ Module( Name( ExprName { range: 291..292, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -580,7 +604,9 @@ Module( value: Name( ExprName { range: 294..295, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -590,7 +616,9 @@ Module( value: Name( ExprName { range: 299..300, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), @@ -612,7 +640,9 @@ Module( value: Name( ExprName { range: 305..306, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -622,7 +652,9 @@ Module( value: Name( ExprName { range: 310..311, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -684,7 +716,9 @@ Module( value: Name( ExprName { range: 326..327, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -831,7 +865,9 @@ Module( left: Name( ExprName { range: 369..370, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -853,7 +889,9 @@ Module( left: Name( ExprName { range: 376..377, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -877,7 +915,9 @@ Module( func: Name( ExprName { range: 386..390, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -910,7 +950,9 @@ Module( operand: Name( ExprName { range: 468..469, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -952,14 +994,18 @@ Module( body: Name( ExprName { range: 498..499, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 513..514, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -989,14 +1035,18 @@ Module( body: Name( ExprName { range: 517..518, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 532..533, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -1005,7 +1055,9 @@ Module( value: Name( ExprName { range: 535..536, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -1015,7 +1067,9 @@ Module( target: Name( ExprName { range: 541..542, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -1025,7 +1079,9 @@ Module( func: Name( ExprName { range: 546..551, - id: "range", + id: Name( + "range", + ), ctx: Load, }, ), @@ -1053,7 +1109,9 @@ Module( target: Name( ExprName { range: 560..561, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -1063,7 +1121,9 @@ Module( func: Name( ExprName { range: 565..570, - id: "range", + id: Name( + "range", + ), ctx: Load, }, ), @@ -1138,7 +1198,9 @@ Module( Name( ExprName { range: 588..589, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1188,7 +1250,9 @@ Module( Name( ExprName { range: 603..604, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1196,7 +1260,9 @@ Module( value: Name( ExprName { range: 608..609, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -1206,7 +1272,9 @@ Module( Name( ExprName { range: 613..614, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -1214,7 +1282,9 @@ Module( value: Name( ExprName { range: 618..619, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__dictionary_comprehension.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__dictionary_comprehension.py.snap index 13565f213c85a5..1cd9a6c31e0ee1 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__dictionary_comprehension.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__dictionary_comprehension.py.snap @@ -18,7 +18,9 @@ Module( elt: Name( ExprName { range: 1..2, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -28,7 +30,9 @@ Module( target: Name( ExprName { range: 7..8, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -82,14 +86,18 @@ Module( key: Name( ExprName { range: 24..26, - id: "x1", + id: Name( + "x1", + ), ctx: Load, }, ), value: Name( ExprName { range: 28..30, - id: "x2", + id: Name( + "x2", + ), ctx: Load, }, ), @@ -99,14 +107,18 @@ Module( target: Name( ExprName { range: 35..36, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), iter: Name( ExprName { range: 40..41, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -130,7 +142,9 @@ Module( left: Name( ExprName { range: 44..45, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -169,7 +183,9 @@ Module( target: Name( ExprName { range: 59..60, - id: "i", + id: Name( + "i", + ), ctx: Store, }, ), @@ -179,7 +195,9 @@ Module( func: Name( ExprName { range: 64..69, - id: "range", + id: Name( + "range", + ), ctx: Load, }, ), @@ -216,7 +234,9 @@ Module( key: Name( ExprName { range: 75..76, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -226,7 +246,9 @@ Module( left: Name( ExprName { range: 78..79, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -247,14 +269,18 @@ Module( target: Name( ExprName { range: 88..89, - id: "c", + id: Name( + "c", + ), ctx: Store, }, ), iter: Name( ExprName { range: 93..94, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), @@ -265,7 +291,9 @@ Module( left: Name( ExprName { range: 98..99, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -276,7 +304,9 @@ Module( Name( ExprName { range: 103..104, - id: "w", + id: Name( + "w", + ), ctx: Load, }, ), @@ -291,14 +321,18 @@ Module( Name( ExprName { range: 108..109, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), Name( ExprName { range: 114..116, - id: "yy", + id: Name( + "yy", + ), ctx: Load, }, ), @@ -308,7 +342,9 @@ Module( Name( ExprName { range: 120..121, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -329,7 +365,9 @@ Module( key: Name( ExprName { range: 124..125, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -339,7 +377,9 @@ Module( left: Name( ExprName { range: 127..128, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -360,14 +400,18 @@ Module( target: Name( ExprName { range: 138..139, - id: "b", + id: Name( + "b", + ), ctx: Store, }, ), iter: Name( ExprName { range: 143..144, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -380,14 +424,18 @@ Module( Name( ExprName { range: 148..149, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), Name( ExprName { range: 154..155, - id: "e", + id: Name( + "e", + ), ctx: Load, }, ), @@ -402,14 +450,18 @@ Module( target: Name( ExprName { range: 160..161, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), iter: Name( ExprName { range: 165..166, - id: "j", + id: Name( + "j", + ), ctx: Load, }, ), @@ -420,7 +472,9 @@ Module( left: Name( ExprName { range: 170..171, - id: "k", + id: Name( + "k", + ), ctx: Load, }, ), @@ -431,7 +485,9 @@ Module( Name( ExprName { range: 174..175, - id: "h", + id: Name( + "h", + ), ctx: Load, }, ), @@ -455,14 +511,18 @@ Module( key: Name( ExprName { range: 178..179, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), value: Name( ExprName { range: 181..182, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -472,14 +532,18 @@ Module( target: Name( ExprName { range: 187..188, - id: "b", + id: Name( + "b", + ), ctx: Store, }, ), iter: Name( ExprName { range: 192..193, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -492,14 +556,18 @@ Module( Name( ExprName { range: 197..198, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), Name( ExprName { range: 203..204, - id: "e", + id: Name( + "e", + ), ctx: Load, }, ), @@ -514,14 +582,18 @@ Module( target: Name( ExprName { range: 215..216, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), iter: Name( ExprName { range: 220..221, - id: "j", + id: Name( + "j", + ), ctx: Load, }, ), @@ -532,7 +604,9 @@ Module( left: Name( ExprName { range: 225..226, - id: "k", + id: Name( + "k", + ), ctx: Load, }, ), @@ -543,7 +617,9 @@ Module( Name( ExprName { range: 229..230, - id: "h", + id: Name( + "h", + ), ctx: Load, }, ), @@ -567,14 +643,18 @@ Module( key: Name( ExprName { range: 233..234, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), value: Name( ExprName { range: 236..237, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -588,14 +668,18 @@ Module( Name( ExprName { range: 242..243, - id: "b", + id: Name( + "b", + ), ctx: Store, }, ), Name( ExprName { range: 245..246, - id: "c", + id: Name( + "c", + ), ctx: Store, }, ), @@ -607,7 +691,9 @@ Module( iter: Name( ExprName { range: 250..251, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), @@ -628,14 +714,18 @@ Module( key: Name( ExprName { range: 392..393, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), value: Name( ExprName { range: 395..396, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -645,7 +735,9 @@ Module( target: Name( ExprName { range: 401..402, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -656,7 +748,9 @@ Module( Name( ExprName { range: 413..414, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -680,14 +774,18 @@ Module( key: Name( ExprName { range: 418..419, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), value: Name( ExprName { range: 421..422, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -697,7 +795,9 @@ Module( target: Name( ExprName { range: 427..428, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -707,7 +807,9 @@ Module( value: Name( ExprName { range: 444..445, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -730,14 +832,18 @@ Module( key: Name( ExprName { range: 449..450, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), value: Name( ExprName { range: 452..453, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -747,7 +853,9 @@ Module( target: Name( ExprName { range: 458..459, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -764,7 +872,9 @@ Module( parameter: Parameter { range: 471..472, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 471..472, }, annotation: None, @@ -780,7 +890,9 @@ Module( body: Name( ExprName { range: 474..475, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -803,14 +915,18 @@ Module( key: Name( ExprName { range: 479..480, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), value: Name( ExprName { range: 482..483, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -820,14 +936,18 @@ Module( target: Name( ExprName { range: 488..489, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 493..497, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -839,7 +959,9 @@ Module( Name( ExprName { range: 508..509, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -863,14 +985,18 @@ Module( key: Name( ExprName { range: 513..514, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), value: Name( ExprName { range: 516..517, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -880,14 +1006,18 @@ Module( target: Name( ExprName { range: 522..523, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 527..531, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -898,7 +1028,9 @@ Module( value: Name( ExprName { range: 547..548, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -921,14 +1053,18 @@ Module( key: Name( ExprName { range: 552..553, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), value: Name( ExprName { range: 555..556, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -938,14 +1074,18 @@ Module( target: Name( ExprName { range: 561..562, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 566..570, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -963,7 +1103,9 @@ Module( parameter: Parameter { range: 582..583, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 582..583, }, annotation: None, @@ -979,7 +1121,9 @@ Module( body: Name( ExprName { range: 585..586, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__f_string.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__f_string.py.snap index cc523d29a6d896..f80761669b5bef 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__f_string.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__f_string.py.snap @@ -204,7 +204,9 @@ Module( expression: Name( ExprName { range: 60..63, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -521,7 +523,9 @@ Module( expression: Name( ExprName { range: 124..127, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -567,7 +571,9 @@ Module( expression: Name( ExprName { range: 139..142, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -625,7 +631,9 @@ Module( expression: Name( ExprName { range: 160..163, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -862,7 +870,9 @@ Module( left: Name( ExprName { range: 234..235, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -870,7 +880,9 @@ Module( right: Name( ExprName { range: 238..239, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -932,7 +944,9 @@ Module( subject: Name( ExprName { range: 260..263, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -1046,7 +1060,9 @@ Module( expression: Name( ExprName { range: 351..354, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -1067,7 +1083,9 @@ Module( expression: Name( ExprName { range: 357..360, - id: "bar", + id: Name( + "bar", + ), ctx: Load, }, ), @@ -1152,7 +1170,9 @@ Module( expression: Name( ExprName { range: 390..393, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -1205,7 +1225,9 @@ Module( expression: Name( ExprName { range: 428..431, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -1257,7 +1279,9 @@ Module( expression: Name( ExprName { range: 451..454, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -1278,7 +1302,9 @@ Module( expression: Name( ExprName { range: 469..472, - id: "bar", + id: Name( + "bar", + ), ctx: Load, }, ), @@ -1299,7 +1325,9 @@ Module( expression: Name( ExprName { range: 477..482, - id: "three", + id: Name( + "three", + ), ctx: Load, }, ), @@ -1352,7 +1380,9 @@ Module( expression: Name( ExprName { range: 497..500, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -1373,7 +1403,9 @@ Module( expression: Name( ExprName { range: 505..508, - id: "bar", + id: Name( + "bar", + ), ctx: Load, }, ), @@ -1394,7 +1426,9 @@ Module( expression: Name( ExprName { range: 513..516, - id: "baz", + id: Name( + "baz", + ), ctx: Load, }, ), @@ -1415,7 +1449,9 @@ Module( expression: Name( ExprName { range: 521..527, - id: "foobar", + id: Name( + "foobar", + ), ctx: Load, }, ), @@ -1462,7 +1498,9 @@ Module( expression: Name( ExprName { range: 540..541, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1515,7 +1553,9 @@ Module( expression: Name( ExprName { range: 553..554, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1550,7 +1590,9 @@ Module( }, ), attr: Identifier { - id: "pop", + id: Name( + "pop", + ), range: 560..563, }, ctx: Load, @@ -1615,7 +1657,9 @@ Module( parameter: Parameter { range: 580..581, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 580..581, }, annotation: None, @@ -1635,7 +1679,9 @@ Module( Name( ExprName { range: 583..584, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1681,7 +1727,9 @@ Module( expression: Name( ExprName { range: 592..593, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1727,7 +1775,9 @@ Module( expression: Name( ExprName { range: 605..606, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1773,7 +1823,9 @@ Module( expression: Name( ExprName { range: 615..616, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1819,7 +1871,9 @@ Module( expression: Name( ExprName { range: 625..626, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1872,7 +1926,9 @@ Module( expression: Name( ExprName { range: 640..641, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1930,7 +1986,9 @@ Module( expression: Name( ExprName { range: 657..658, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1995,7 +2053,9 @@ Module( expression: Name( ExprName { range: 679..680, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -2038,7 +2098,9 @@ Module( expression: Name( ExprName { range: 686..687, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -2065,7 +2127,9 @@ Module( expression: Name( ExprName { range: 693..694, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -2108,7 +2172,9 @@ Module( expression: Name( ExprName { range: 700..701, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -2171,7 +2237,9 @@ Module( Name( ExprName { range: 740..747, - id: "command", + id: Name( + "command", + ), ctx: Load, }, ), @@ -2181,7 +2249,9 @@ Module( value: Name( ExprName { range: 750..754, - id: "args", + id: Name( + "args", + ), ctx: Load, }, ), @@ -2242,7 +2312,9 @@ Module( expression: Name( ExprName { range: 766..767, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -2410,7 +2482,9 @@ Module( expression: Name( ExprName { range: 860..863, - id: "bar", + id: Name( + "bar", + ), ctx: Load, }, ), @@ -2486,7 +2560,9 @@ Module( expression: Name( ExprName { range: 889..892, - id: "bar", + id: Name( + "bar", + ), ctx: Load, }, ), @@ -2562,7 +2638,9 @@ Module( expression: Name( ExprName { range: 919..922, - id: "bar", + id: Name( + "bar", + ), ctx: Load, }, ), @@ -2644,7 +2722,9 @@ Module( expression: Name( ExprName { range: 954..957, - id: "baz", + id: Name( + "baz", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__generator.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__generator.py.snap index 784a0126258ac1..02c2927ef9fdd2 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__generator.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__generator.py.snap @@ -18,7 +18,9 @@ Module( elt: Name( ExprName { range: 1..2, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -28,14 +30,18 @@ Module( target: Name( ExprName { range: 7..13, - id: "target", + id: Name( + "target", + ), ctx: Store, }, ), iter: Name( ExprName { range: 17..21, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), @@ -57,7 +63,9 @@ Module( elt: Name( ExprName { range: 24..25, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -67,14 +75,18 @@ Module( target: Name( ExprName { range: 36..42, - id: "target", + id: Name( + "target", + ), ctx: Store, }, ), iter: Name( ExprName { range: 46..50, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), @@ -96,7 +108,9 @@ Module( elt: Name( ExprName { range: 53..54, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -106,14 +120,18 @@ Module( target: Name( ExprName { range: 59..65, - id: "target", + id: Name( + "target", + ), ctx: Store, }, ), iter: Name( ExprName { range: 69..73, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), @@ -124,7 +142,9 @@ Module( left: Name( ExprName { range: 77..78, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -135,7 +155,9 @@ Module( Name( ExprName { range: 82..83, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -150,14 +172,18 @@ Module( Name( ExprName { range: 87..88, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 93..94, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -167,7 +193,9 @@ Module( Name( ExprName { range: 98..99, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -189,7 +217,9 @@ Module( elt: Name( ExprName { range: 102..103, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -199,14 +229,18 @@ Module( target: Name( ExprName { range: 108..115, - id: "target1", + id: Name( + "target1", + ), ctx: Store, }, ), iter: Name( ExprName { range: 119..124, - id: "iter1", + id: Name( + "iter1", + ), ctx: Load, }, ), @@ -219,14 +253,18 @@ Module( Name( ExprName { range: 128..129, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 134..135, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -241,14 +279,18 @@ Module( target: Name( ExprName { range: 140..147, - id: "target2", + id: Name( + "target2", + ), ctx: Store, }, ), iter: Name( ExprName { range: 151..156, - id: "iter2", + id: Name( + "iter2", + ), ctx: Load, }, ), @@ -259,7 +301,9 @@ Module( left: Name( ExprName { range: 160..161, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -270,7 +314,9 @@ Module( Name( ExprName { range: 164..165, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -295,7 +341,9 @@ Module( elt: Name( ExprName { range: 168..169, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -305,14 +353,18 @@ Module( target: Name( ExprName { range: 174..181, - id: "target1", + id: Name( + "target1", + ), ctx: Store, }, ), iter: Name( ExprName { range: 185..190, - id: "iter1", + id: Name( + "iter1", + ), ctx: Load, }, ), @@ -325,14 +377,18 @@ Module( Name( ExprName { range: 194..195, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 200..201, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -347,14 +403,18 @@ Module( target: Name( ExprName { range: 212..219, - id: "target2", + id: Name( + "target2", + ), ctx: Store, }, ), iter: Name( ExprName { range: 223..228, - id: "iter2", + id: Name( + "iter2", + ), ctx: Load, }, ), @@ -365,7 +425,9 @@ Module( left: Name( ExprName { range: 232..233, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -376,7 +438,9 @@ Module( Name( ExprName { range: 236..237, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -404,7 +468,9 @@ Module( target: Name( ExprName { range: 260..261, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -414,7 +480,9 @@ Module( left: Name( ExprName { range: 265..266, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -437,14 +505,18 @@ Module( target: Name( ExprName { range: 275..276, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), iter: Name( ExprName { range: 280..281, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -469,21 +541,27 @@ Module( test: Name( ExprName { range: 306..307, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), body: Name( ExprName { range: 301..302, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 313..314, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -495,14 +573,18 @@ Module( target: Name( ExprName { range: 319..320, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), iter: Name( ExprName { range: 324..325, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -543,7 +625,9 @@ Module( }, ), attr: Identifier { - id: "join", + id: Name( + "join", + ), range: 344..348, }, ctx: Load, @@ -558,7 +642,9 @@ Module( elt: Name( ExprName { range: 354..357, - id: "sql", + id: Name( + "sql", + ), ctx: Load, }, ), @@ -568,7 +654,9 @@ Module( target: Name( ExprName { range: 366..369, - id: "sql", + id: Name( + "sql", + ), ctx: Store, }, ), @@ -582,7 +670,9 @@ Module( test: Name( ExprName { range: 405..410, - id: "limit", + id: Name( + "limit", + ), ctx: Load, }, ), @@ -611,7 +701,9 @@ Module( right: Name( ExprName { range: 396..401, - id: "limit", + id: Name( + "limit", + ), ctx: Load, }, ), @@ -630,7 +722,9 @@ Module( test: Name( ExprName { range: 456..462, - id: "offset", + id: Name( + "offset", + ), ctx: Load, }, ), @@ -659,7 +753,9 @@ Module( right: Name( ExprName { range: 445..451, - id: "offset", + id: Name( + "offset", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__if.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__if.py.snap index cb7c075732d0d0..fbb819c90e78eb 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__if.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__if.py.snap @@ -24,14 +24,18 @@ Module( body: Name( ExprName { range: 0..1, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 15..16, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -48,7 +52,9 @@ Module( test: Name( ExprName { range: 24..25, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -58,7 +64,9 @@ Module( func: Name( ExprName { range: 17..18, - id: "f", + id: Name( + "f", + ), ctx: Load, }, ), @@ -87,14 +95,18 @@ Module( test: Name( ExprName { range: 41..42, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), body: Name( ExprName { range: 36..37, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -104,21 +116,27 @@ Module( test: Name( ExprName { range: 53..54, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), body: Name( ExprName { range: 48..49, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 60..61, - id: "e", + id: Name( + "e", + ), ctx: Load, }, ), @@ -175,7 +193,9 @@ Module( right: Name( ExprName { range: 66..67, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -208,7 +228,9 @@ Module( test: Name( ExprName { range: 96..97, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -220,14 +242,18 @@ Module( Name( ExprName { range: 85..86, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 91..92, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -253,7 +279,9 @@ Module( test: Name( ExprName { range: 119..120, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -263,7 +291,9 @@ Module( left: Name( ExprName { range: 109..110, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -274,7 +304,9 @@ Module( Name( ExprName { range: 114..115, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -284,7 +316,9 @@ Module( orelse: Name( ExprName { range: 126..127, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -306,14 +340,18 @@ Module( Name( ExprName { range: 136..137, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 142..143, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -357,7 +395,9 @@ Module( test: Name( ExprName { range: 163..164, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -372,7 +412,9 @@ Module( orelse: Name( ExprName { range: 170..171, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -400,7 +442,9 @@ Module( body: Name( ExprName { range: 214..215, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -417,7 +461,9 @@ Module( parameter: Parameter { range: 236..237, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 236..237, }, annotation: None, @@ -433,7 +479,9 @@ Module( body: Name( ExprName { range: 239..240, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -456,7 +504,9 @@ Module( Name( ExprName { range: 314..315, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -466,14 +516,18 @@ Module( body: Name( ExprName { range: 302..303, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 322..323, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -493,7 +547,9 @@ Module( value: Name( ExprName { range: 341..342, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -502,14 +558,18 @@ Module( body: Name( ExprName { range: 324..325, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 349..350, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -536,7 +596,9 @@ Module( parameter: Parameter { range: 364..365, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 364..365, }, annotation: None, @@ -552,7 +614,9 @@ Module( body: Name( ExprName { range: 367..368, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -561,14 +625,18 @@ Module( body: Name( ExprName { range: 351..352, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 375..376, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -585,21 +653,27 @@ Module( test: Name( ExprName { range: 414..415, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), body: Name( ExprName { range: 409..410, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 421..422, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__lambda.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__lambda.py.snap index b0c41a886a7ff1..2e126596a754bb 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__lambda.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__lambda.py.snap @@ -19,7 +19,9 @@ Module( body: Name( ExprName { range: 8..9, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -62,7 +64,9 @@ Module( parameter: Parameter { range: 27..28, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 27..28, }, annotation: None, @@ -103,7 +107,9 @@ Module( parameter: Parameter { range: 39..40, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 39..40, }, annotation: None, @@ -115,7 +121,9 @@ Module( parameter: Parameter { range: 42..43, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 42..43, }, annotation: None, @@ -153,7 +161,9 @@ Module( parameter: Parameter { range: 56..57, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 56..57, }, annotation: None, @@ -165,7 +175,9 @@ Module( parameter: Parameter { range: 59..60, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 59..60, }, annotation: None, @@ -177,7 +189,9 @@ Module( parameter: Parameter { range: 62..63, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 62..63, }, annotation: None, @@ -218,7 +232,9 @@ Module( parameter: Parameter { range: 74..75, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 74..75, }, annotation: None, @@ -230,7 +246,9 @@ Module( parameter: Parameter { range: 77..78, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 77..78, }, annotation: None, @@ -251,7 +269,9 @@ Module( parameter: Parameter { range: 83..84, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 83..84, }, annotation: None, @@ -301,7 +321,9 @@ Module( parameter: Parameter { range: 98..99, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 98..99, }, annotation: None, @@ -313,7 +335,9 @@ Module( parameter: Parameter { range: 101..102, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 101..102, }, annotation: None, @@ -332,7 +356,9 @@ Module( left: Name( ExprName { range: 104..105, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -340,7 +366,9 @@ Module( right: Name( ExprName { range: 108..109, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -366,7 +394,9 @@ Module( parameter: Parameter { range: 117..118, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 117..118, }, annotation: None, @@ -378,7 +408,9 @@ Module( parameter: Parameter { range: 120..121, name: Identifier { - id: "z", + id: Name( + "z", + ), range: 120..121, }, annotation: None, @@ -406,7 +438,9 @@ Module( left: Name( ExprName { range: 125..126, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -414,7 +448,9 @@ Module( right: Name( ExprName { range: 129..130, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -439,7 +475,9 @@ Module( Parameter { range: 138..140, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 139..140, }, annotation: None, @@ -452,7 +490,9 @@ Module( body: Name( ExprName { range: 142..143, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -475,7 +515,9 @@ Module( Parameter { range: 151..153, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 152..153, }, annotation: None, @@ -487,7 +529,9 @@ Module( parameter: Parameter { range: 155..156, name: Identifier { - id: "z", + id: Name( + "z", + ), range: 155..156, }, annotation: None, @@ -499,7 +543,9 @@ Module( parameter: Parameter { range: 158..159, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 158..159, }, annotation: None, @@ -546,7 +592,9 @@ Module( parameter: Parameter { range: 177..178, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 177..178, }, annotation: None, @@ -558,7 +606,9 @@ Module( parameter: Parameter { range: 180..181, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 180..181, }, annotation: None, @@ -570,7 +620,9 @@ Module( parameter: Parameter { range: 183..184, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 183..184, }, annotation: None, @@ -611,7 +663,9 @@ Module( parameter: Parameter { range: 198..199, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 198..199, }, annotation: None, @@ -623,7 +677,9 @@ Module( parameter: Parameter { range: 201..202, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 201..202, }, annotation: None, @@ -644,7 +700,9 @@ Module( parameter: Parameter { range: 207..208, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 207..208, }, annotation: None, @@ -692,7 +750,9 @@ Module( parameter: Parameter { range: 222..223, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 222..223, }, annotation: None, @@ -704,7 +764,9 @@ Module( parameter: Parameter { range: 225..226, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 225..226, }, annotation: None, @@ -716,7 +778,9 @@ Module( parameter: Parameter { range: 228..229, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 228..229, }, annotation: None, @@ -731,7 +795,9 @@ Module( parameter: Parameter { range: 234..235, name: Identifier { - id: "d", + id: Name( + "d", + ), range: 234..235, }, annotation: None, @@ -743,7 +809,9 @@ Module( parameter: Parameter { range: 237..238, name: Identifier { - id: "e", + id: Name( + "e", + ), range: 237..238, }, annotation: None, @@ -783,7 +851,9 @@ Module( Parameter { range: 249..257, name: Identifier { - id: "kwargs", + id: Name( + "kwargs", + ), range: 251..257, }, annotation: None, @@ -797,7 +867,9 @@ Module( func: Name( ExprName { range: 259..260, - id: "f", + id: Name( + "f", + ), ctx: Load, }, ), @@ -827,7 +899,9 @@ Module( Parameter { range: 270..275, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 271..275, }, annotation: None, @@ -838,7 +912,9 @@ Module( Parameter { range: 277..285, name: Identifier { - id: "kwargs", + id: Name( + "kwargs", + ), range: 279..285, }, annotation: None, @@ -855,7 +931,9 @@ Module( func: Name( ExprName { range: 287..288, - id: "f", + id: Name( + "f", + ), ctx: Load, }, ), @@ -896,7 +974,9 @@ Module( Parameter { range: 302..307, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 303..307, }, annotation: None, @@ -908,7 +988,9 @@ Module( parameter: Parameter { range: 309..310, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 309..310, }, annotation: None, @@ -920,7 +1002,9 @@ Module( parameter: Parameter { range: 312..313, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 312..313, }, annotation: None, @@ -941,7 +1025,9 @@ Module( Parameter { range: 317..325, name: Identifier { - id: "kwargs", + id: Name( + "kwargs", + ), range: 319..325, }, annotation: None, @@ -958,7 +1044,9 @@ Module( func: Name( ExprName { range: 327..328, - id: "f", + id: Name( + "f", + ), ctx: Load, }, ), @@ -999,7 +1087,9 @@ Module( parameter: Parameter { range: 342..343, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 342..343, }, annotation: None, @@ -1037,7 +1127,9 @@ Module( parameter: Parameter { range: 359..360, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 359..360, }, annotation: None, @@ -1051,7 +1143,9 @@ Module( parameter: Parameter { range: 365..366, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 365..366, }, annotation: None, @@ -1088,7 +1182,9 @@ Module( parameter: Parameter { range: 379..380, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 379..380, }, annotation: None, @@ -1135,7 +1231,9 @@ Module( parameter: Parameter { range: 399..400, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 399..400, }, annotation: None, @@ -1147,7 +1245,9 @@ Module( parameter: Parameter { range: 402..403, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 402..403, }, annotation: None, @@ -1163,7 +1263,9 @@ Module( parameter: Parameter { range: 411..412, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 411..412, }, annotation: None, @@ -1199,7 +1301,9 @@ Module( parameter: Parameter { range: 425..427, name: Identifier { - id: "kw", + id: Name( + "kw", + ), range: 425..427, }, annotation: None, @@ -1223,7 +1327,9 @@ Module( parameter: Parameter { range: 434..435, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 434..435, }, annotation: None, @@ -1258,7 +1364,9 @@ Module( parameter: Parameter { range: 448..449, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 448..449, }, annotation: None, @@ -1270,7 +1378,9 @@ Module( parameter: Parameter { range: 451..452, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 451..452, }, annotation: None, @@ -1293,7 +1403,9 @@ Module( parameter: Parameter { range: 460..461, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 460..461, }, annotation: None, @@ -1342,7 +1454,9 @@ Module( parameter: Parameter { range: 475..476, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 475..476, }, annotation: None, @@ -1354,7 +1468,9 @@ Module( parameter: Parameter { range: 478..479, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 478..479, }, annotation: None, @@ -1368,7 +1484,9 @@ Module( parameter: Parameter { range: 484..485, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 484..485, }, annotation: None, @@ -1383,7 +1501,9 @@ Module( parameter: Parameter { range: 490..491, name: Identifier { - id: "d", + id: Name( + "d", + ), range: 490..491, }, annotation: None, @@ -1395,7 +1515,9 @@ Module( parameter: Parameter { range: 493..494, name: Identifier { - id: "e", + id: Name( + "e", + ), range: 493..494, }, annotation: None, @@ -1433,7 +1555,9 @@ Module( parameter: Parameter { range: 505..506, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 505..506, }, annotation: None, @@ -1445,7 +1569,9 @@ Module( parameter: Parameter { range: 508..509, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 508..509, }, annotation: None, @@ -1459,7 +1585,9 @@ Module( parameter: Parameter { range: 514..515, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 514..515, }, annotation: None, @@ -1471,7 +1599,9 @@ Module( Parameter { range: 517..519, name: Identifier { - id: "d", + id: Name( + "d", + ), range: 518..519, }, annotation: None, @@ -1483,7 +1613,9 @@ Module( parameter: Parameter { range: 521..522, name: Identifier { - id: "e", + id: Name( + "e", + ), range: 521..522, }, annotation: None, @@ -1495,7 +1627,9 @@ Module( Parameter { range: 524..527, name: Identifier { - id: "f", + id: Name( + "f", + ), range: 526..527, }, annotation: None, diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__list.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__list.py.snap index ede492d09f77a6..4e9aa1e068fbd3 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__list.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__list.py.snap @@ -310,7 +310,9 @@ Module( target: Name( ExprName { range: 171..172, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -343,7 +345,9 @@ Module( target: Name( ExprName { range: 180..181, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -384,7 +388,9 @@ Module( target: Name( ExprName { range: 193..194, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -433,7 +439,9 @@ Module( value: Name( ExprName { range: 228..229, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -478,7 +486,9 @@ Module( left: Name( ExprName { range: 239..240, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -486,7 +496,9 @@ Module( right: Name( ExprName { range: 243..244, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -585,7 +597,9 @@ Module( Name( ExprName { range: 294..295, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -595,7 +609,9 @@ Module( left: Name( ExprName { range: 297..298, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -603,7 +619,9 @@ Module( right: Name( ExprName { range: 301..302, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -612,7 +630,9 @@ Module( Name( ExprName { range: 304..305, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), @@ -628,21 +648,27 @@ Module( Name( ExprName { range: 309..310, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 312..313, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), Name( ExprName { range: 315..316, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -658,7 +684,9 @@ Module( Name( ExprName { range: 320..321, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -681,7 +709,9 @@ Module( target: Name( ExprName { range: 327..328, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -714,7 +744,9 @@ Module( func: Name( ExprName { range: 336..341, - id: "call1", + id: Name( + "call1", + ), ctx: Load, }, ), @@ -730,7 +762,9 @@ Module( func: Name( ExprName { range: 342..347, - id: "call2", + id: Name( + "call2", + ), ctx: Load, }, ), @@ -746,12 +780,16 @@ Module( value: Name( ExprName { range: 348..353, - id: "value", + id: Name( + "value", + ), ctx: Load, }, ), attr: Identifier { - id: "attr", + id: Name( + "attr", + ), range: 354..358, }, ctx: Load, @@ -775,14 +813,18 @@ Module( target: Name( ExprName { range: 366..373, - id: "element", + id: Name( + "element", + ), ctx: Store, }, ), iter: Name( ExprName { range: 377..381, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__list_comprehension.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__list_comprehension.py.snap index 079ddce8eeb07a..463132907acfd2 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__list_comprehension.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__list_comprehension.py.snap @@ -16,7 +16,9 @@ Module( Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -27,7 +29,9 @@ Module( elt: Name( ExprName { range: 5..6, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -37,7 +41,9 @@ Module( target: Name( ExprName { range: 11..12, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -91,7 +97,9 @@ Module( elt: Name( ExprName { range: 29..30, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -101,7 +109,9 @@ Module( target: Name( ExprName { range: 35..36, - id: "i", + id: Name( + "i", + ), ctx: Store, }, ), @@ -111,7 +121,9 @@ Module( func: Name( ExprName { range: 40..45, - id: "range", + id: Name( + "range", + ), ctx: Load, }, ), @@ -148,7 +160,9 @@ Module( elt: Name( ExprName { range: 51..52, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -158,14 +172,18 @@ Module( target: Name( ExprName { range: 57..58, - id: "c", + id: Name( + "c", + ), ctx: Store, }, ), iter: Name( ExprName { range: 62..63, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), @@ -176,7 +194,9 @@ Module( left: Name( ExprName { range: 67..68, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -187,7 +207,9 @@ Module( Name( ExprName { range: 72..73, - id: "w", + id: Name( + "w", + ), ctx: Load, }, ), @@ -202,14 +224,18 @@ Module( Name( ExprName { range: 77..78, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), Name( ExprName { range: 83..85, - id: "yy", + id: Name( + "yy", + ), ctx: Load, }, ), @@ -219,7 +245,9 @@ Module( Name( ExprName { range: 89..90, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -240,7 +268,9 @@ Module( elt: Name( ExprName { range: 93..94, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -250,14 +280,18 @@ Module( target: Name( ExprName { range: 99..100, - id: "b", + id: Name( + "b", + ), ctx: Store, }, ), iter: Name( ExprName { range: 104..105, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -270,14 +304,18 @@ Module( Name( ExprName { range: 109..110, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), Name( ExprName { range: 115..116, - id: "e", + id: Name( + "e", + ), ctx: Load, }, ), @@ -292,14 +330,18 @@ Module( target: Name( ExprName { range: 121..122, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), iter: Name( ExprName { range: 126..127, - id: "j", + id: Name( + "j", + ), ctx: Load, }, ), @@ -310,7 +352,9 @@ Module( left: Name( ExprName { range: 131..132, - id: "k", + id: Name( + "k", + ), ctx: Load, }, ), @@ -321,7 +365,9 @@ Module( Name( ExprName { range: 135..136, - id: "h", + id: Name( + "h", + ), ctx: Load, }, ), @@ -345,7 +391,9 @@ Module( elt: Name( ExprName { range: 139..140, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -355,14 +403,18 @@ Module( target: Name( ExprName { range: 145..146, - id: "b", + id: Name( + "b", + ), ctx: Store, }, ), iter: Name( ExprName { range: 150..151, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -375,14 +427,18 @@ Module( Name( ExprName { range: 155..156, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), Name( ExprName { range: 161..162, - id: "e", + id: Name( + "e", + ), ctx: Load, }, ), @@ -397,14 +453,18 @@ Module( target: Name( ExprName { range: 173..174, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), iter: Name( ExprName { range: 178..179, - id: "j", + id: Name( + "j", + ), ctx: Load, }, ), @@ -415,7 +475,9 @@ Module( left: Name( ExprName { range: 183..184, - id: "k", + id: Name( + "k", + ), ctx: Load, }, ), @@ -426,7 +488,9 @@ Module( Name( ExprName { range: 187..188, - id: "h", + id: Name( + "h", + ), ctx: Load, }, ), @@ -461,7 +525,9 @@ Module( target: Name( ExprName { range: 197..198, - id: "i", + id: Name( + "i", + ), ctx: Store, }, ), @@ -471,7 +537,9 @@ Module( left: Name( ExprName { range: 202..203, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -482,7 +550,9 @@ Module( Name( ExprName { range: 207..208, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -506,7 +576,9 @@ Module( elt: Name( ExprName { range: 211..212, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -520,14 +592,18 @@ Module( Name( ExprName { range: 217..218, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), Name( ExprName { range: 220..221, - id: "b", + id: Name( + "b", + ), ctx: Store, }, ), @@ -539,7 +615,9 @@ Module( iter: Name( ExprName { range: 225..226, - id: "G", + id: Name( + "G", + ), ctx: Load, }, ), @@ -563,7 +641,9 @@ Module( value: Name( ExprName { range: 240..241, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -579,14 +659,18 @@ Module( Name( ExprName { range: 246..247, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), Name( ExprName { range: 249..250, - id: "b", + id: Name( + "b", + ), ctx: Store, }, ), @@ -598,7 +682,9 @@ Module( iter: Name( ExprName { range: 254..255, - id: "C", + id: Name( + "C", + ), ctx: Load, }, ), @@ -619,7 +705,9 @@ Module( elt: Name( ExprName { range: 259..260, - id: "i", + id: Name( + "i", + ), ctx: Load, }, ), @@ -629,7 +717,9 @@ Module( target: Name( ExprName { range: 265..266, - id: "i", + id: Name( + "i", + ), ctx: Store, }, ), @@ -639,7 +729,9 @@ Module( value: Name( ExprName { range: 276..277, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -652,7 +744,9 @@ Module( left: Name( ExprName { range: 281..287, - id: "entity", + id: Name( + "entity", + ), ctx: Load, }, ), @@ -685,7 +779,9 @@ Module( elt: Name( ExprName { range: 302..303, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -695,7 +791,9 @@ Module( target: Name( ExprName { range: 308..309, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -711,14 +809,18 @@ Module( body: Name( ExprName { range: 314..315, - id: "l", + id: Name( + "l", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 329..330, - id: "L", + id: Name( + "L", + ), ctx: Load, }, ), @@ -728,7 +830,9 @@ Module( Name( ExprName { range: 335..336, - id: "T", + id: Name( + "T", + ), ctx: Load, }, ), @@ -749,7 +853,9 @@ Module( elt: Name( ExprName { range: 339..340, - id: "i", + id: Name( + "i", + ), ctx: Load, }, ), @@ -759,7 +865,9 @@ Module( target: Name( ExprName { range: 345..346, - id: "i", + id: Name( + "i", + ), ctx: Store, }, ), @@ -778,7 +886,9 @@ Module( value: Name( ExprName { range: 357..358, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -787,7 +897,9 @@ Module( orelse: Name( ExprName { range: 372..373, - id: "X", + id: Name( + "X", + ), ctx: Load, }, ), @@ -797,7 +909,9 @@ Module( Name( ExprName { range: 378..379, - id: "F", + id: Name( + "F", + ), ctx: Load, }, ), @@ -818,7 +932,9 @@ Module( elt: Name( ExprName { range: 382..383, - id: "i", + id: Name( + "i", + ), ctx: Load, }, ), @@ -828,7 +944,9 @@ Module( target: Name( ExprName { range: 388..389, - id: "i", + id: Name( + "i", + ), ctx: Store, }, ), @@ -847,14 +965,18 @@ Module( body: Name( ExprName { range: 400..401, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 415..416, - id: "X", + id: Name( + "X", + ), ctx: Load, }, ), @@ -866,7 +988,9 @@ Module( Name( ExprName { range: 421..422, - id: "F", + id: Name( + "F", + ), ctx: Load, }, ), @@ -887,7 +1011,9 @@ Module( elt: Name( ExprName { range: 425..426, - id: "f", + id: Name( + "f", + ), ctx: Load, }, ), @@ -897,7 +1023,9 @@ Module( target: Name( ExprName { range: 431..432, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -907,7 +1035,9 @@ Module( func: Name( ExprName { range: 436..437, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -926,7 +1056,9 @@ Module( body: Name( ExprName { range: 438..439, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -961,7 +1093,9 @@ Module( elt: Name( ExprName { range: 597..598, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -971,7 +1105,9 @@ Module( target: Name( ExprName { range: 603..604, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -982,7 +1118,9 @@ Module( Name( ExprName { range: 615..616, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -1006,7 +1144,9 @@ Module( elt: Name( ExprName { range: 620..621, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1016,7 +1156,9 @@ Module( target: Name( ExprName { range: 626..627, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -1026,7 +1168,9 @@ Module( value: Name( ExprName { range: 643..644, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -1049,7 +1193,9 @@ Module( elt: Name( ExprName { range: 648..649, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1059,7 +1205,9 @@ Module( target: Name( ExprName { range: 654..655, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -1076,7 +1224,9 @@ Module( parameter: Parameter { range: 667..668, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 667..668, }, annotation: None, @@ -1092,7 +1242,9 @@ Module( body: Name( ExprName { range: 670..671, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -1115,7 +1267,9 @@ Module( elt: Name( ExprName { range: 675..676, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1125,14 +1279,18 @@ Module( target: Name( ExprName { range: 681..682, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 686..690, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -1144,7 +1302,9 @@ Module( Name( ExprName { range: 701..702, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -1168,7 +1328,9 @@ Module( elt: Name( ExprName { range: 706..707, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1178,14 +1340,18 @@ Module( target: Name( ExprName { range: 712..713, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 717..721, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -1196,7 +1362,9 @@ Module( value: Name( ExprName { range: 737..738, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -1219,7 +1387,9 @@ Module( elt: Name( ExprName { range: 742..743, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1229,14 +1399,18 @@ Module( target: Name( ExprName { range: 748..749, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 753..757, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -1254,7 +1428,9 @@ Module( parameter: Parameter { range: 769..770, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 769..770, }, annotation: None, @@ -1270,7 +1446,9 @@ Module( body: Name( ExprName { range: 772..773, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__name.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__name.py.snap index 243594adfa0d6b..37f2713811b6b1 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__name.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__name.py.snap @@ -15,7 +15,9 @@ Module( value: Name( ExprName { range: 0..1, - id: "_", + id: Name( + "_", + ), ctx: Load, }, ), @@ -27,7 +29,9 @@ Module( value: Name( ExprName { range: 3..4, - id: "_", + id: Name( + "_", + ), ctx: Load, }, ), @@ -39,7 +43,9 @@ Module( value: Name( ExprName { range: 6..8, - id: "__", + id: Name( + "__", + ), ctx: Load, }, ), @@ -51,7 +57,9 @@ Module( value: Name( ExprName { range: 9..17, - id: "__init__", + id: Name( + "__init__", + ), ctx: Load, }, ), @@ -63,7 +71,9 @@ Module( value: Name( ExprName { range: 18..22, - id: "name", + id: Name( + "name", + ), ctx: Load, }, ), @@ -75,7 +85,9 @@ Module( value: Name( ExprName { range: 24..28, - id: "name", + id: Name( + "name", + ), ctx: Load, }, ), @@ -87,7 +99,9 @@ Module( value: Name( ExprName { range: 60..65, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -99,7 +113,9 @@ Module( value: Name( ExprName { range: 66..70, - id: "case", + id: Name( + "case", + ), ctx: Load, }, ), @@ -111,7 +127,9 @@ Module( value: Name( ExprName { range: 71..75, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__named.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__named.py.snap index de7a542cf0316f..1ba87e5b4391fe 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__named.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__named.py.snap @@ -18,7 +18,9 @@ Module( target: Name( ExprName { range: 1..5, - id: "name", + id: Name( + "name", + ), ctx: Store, }, ), @@ -43,7 +45,9 @@ Module( target: Name( ExprName { range: 13..17, - id: "name", + id: Name( + "name", + ), ctx: Store, }, ), @@ -53,7 +57,9 @@ Module( left: Name( ExprName { range: 22..23, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -61,7 +67,9 @@ Module( right: Name( ExprName { range: 26..27, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -80,7 +88,9 @@ Module( target: Name( ExprName { range: 31..35, - id: "name", + id: Name( + "name", + ), ctx: Store, }, ), @@ -119,7 +129,9 @@ Module( target: Name( ExprName { range: 47..51, - id: "name", + id: Name( + "name", + ), ctx: Store, }, ), @@ -133,7 +145,9 @@ Module( value: Name( ExprName { range: 57..58, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -143,7 +157,9 @@ Module( Name( ExprName { range: 60..61, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -165,7 +181,9 @@ Module( target: Name( ExprName { range: 65..69, - id: "name", + id: Name( + "name", + ), ctx: Store, }, ), @@ -181,14 +199,18 @@ Module( body: Name( ExprName { range: 73..74, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 88..89, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -207,7 +229,9 @@ Module( target: Name( ExprName { range: 92..96, - id: "name", + id: Name( + "name", + ), ctx: Store, }, ), @@ -224,7 +248,9 @@ Module( parameter: Parameter { range: 107..108, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 107..108, }, annotation: None, @@ -240,7 +266,9 @@ Module( body: Name( ExprName { range: 110..111, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -259,7 +287,9 @@ Module( target: Name( ExprName { range: 114..118, - id: "name", + id: Name( + "name", + ), ctx: Store, }, ), @@ -270,7 +300,9 @@ Module( Name( ExprName { range: 129..130, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -290,7 +322,9 @@ Module( target: Name( ExprName { range: 134..138, - id: "name", + id: Name( + "name", + ), ctx: Store, }, ), @@ -300,7 +334,9 @@ Module( value: Name( ExprName { range: 154..155, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__number_literal.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__number_literal.py.snap index 52cb6df41a5a17..c610a2af5b60d9 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__number_literal.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__number_literal.py.snap @@ -16,7 +16,9 @@ Module( Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -38,7 +40,9 @@ Module( Name( ExprName { range: 14..15, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -60,7 +64,9 @@ Module( Name( ExprName { range: 25..26, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -82,7 +88,9 @@ Module( Name( ExprName { range: 32..33, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -104,7 +112,9 @@ Module( Name( ExprName { range: 39..40, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -126,7 +136,9 @@ Module( Name( ExprName { range: 48..49, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -148,7 +160,9 @@ Module( Name( ExprName { range: 57..58, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -170,7 +184,9 @@ Module( Name( ExprName { range: 74..75, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -192,7 +208,9 @@ Module( Name( ExprName { range: 98..99, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -214,7 +232,9 @@ Module( Name( ExprName { range: 132..133, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -236,7 +256,9 @@ Module( Name( ExprName { range: 156..157, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -259,7 +281,9 @@ Module( Name( ExprName { range: 171..172, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -282,7 +306,9 @@ Module( Name( ExprName { range: 196..197, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -304,7 +330,9 @@ Module( Name( ExprName { range: 208..209, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -326,7 +354,9 @@ Module( Name( ExprName { range: 219..220, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -348,7 +378,9 @@ Module( Name( ExprName { range: 229..230, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -370,7 +402,9 @@ Module( Name( ExprName { range: 245..246, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -392,7 +426,9 @@ Module( Name( ExprName { range: 255..256, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -414,7 +450,9 @@ Module( Name( ExprName { range: 286..287, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -431,7 +469,9 @@ Module( }, ), attr: Identifier { - id: "imag", + id: Name( + "imag", + ), range: 294..298, }, ctx: Load, @@ -446,7 +486,9 @@ Module( Name( ExprName { range: 299..300, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -463,7 +505,9 @@ Module( }, ), attr: Identifier { - id: "imag", + id: Name( + "imag", + ), range: 308..312, }, ctx: Load, @@ -478,7 +522,9 @@ Module( Name( ExprName { range: 313..314, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -495,7 +541,9 @@ Module( }, ), attr: Identifier { - id: "real", + id: Name( + "real", + ), range: 322..326, }, ctx: Load, @@ -510,7 +558,9 @@ Module( Name( ExprName { range: 327..328, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -530,7 +580,9 @@ Module( }, ), attr: Identifier { - id: "hex", + id: Name( + "hex", + ), range: 351..354, }, ctx: Load, @@ -552,7 +604,9 @@ Module( Name( ExprName { range: 357..358, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -569,7 +623,9 @@ Module( }, ), attr: Identifier { - id: "real", + id: Name( + "real", + ), range: 392..396, }, ctx: Load, @@ -584,7 +640,9 @@ Module( Name( ExprName { range: 397..398, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -604,7 +662,9 @@ Module( }, ), attr: Identifier { - id: "conjugate", + id: Name( + "conjugate", + ), range: 422..431, }, ctx: Load, @@ -626,7 +686,9 @@ Module( Name( ExprName { range: 434..435, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -644,7 +706,9 @@ Module( }, ), attr: Identifier { - id: "real", + id: Name( + "real", + ), range: 449..453, }, ctx: Load, @@ -659,7 +723,9 @@ Module( Name( ExprName { range: 454..455, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -680,7 +746,9 @@ Module( }, ), attr: Identifier { - id: "__add__", + id: Name( + "__add__", + ), range: 479..486, }, ctx: Load, @@ -704,7 +772,9 @@ Module( }, ), attr: Identifier { - id: "bit_length", + id: Name( + "bit_length", + ), range: 494..504, }, ctx: Load, @@ -731,7 +801,9 @@ Module( Name( ExprName { range: 508..509, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -751,7 +823,9 @@ Module( }, ), attr: Identifier { - id: "conjugate", + id: Name( + "conjugate", + ), range: 520..529, }, ctx: Load, @@ -773,7 +847,9 @@ Module( Name( ExprName { range: 532..533, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -793,7 +869,9 @@ Module( }, ), attr: Identifier { - id: "conjugate", + id: Name( + "conjugate", + ), range: 544..553, }, ctx: Load, @@ -815,7 +893,9 @@ Module( Name( ExprName { range: 556..557, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -832,7 +912,9 @@ Module( }, ), attr: Identifier { - id: "real", + id: Name( + "real", + ), range: 567..571, }, ctx: Load, @@ -847,7 +929,9 @@ Module( Name( ExprName { range: 572..573, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -867,7 +951,9 @@ Module( }, ), attr: Identifier { - id: "hex", + id: Name( + "hex", + ), range: 590..593, }, ctx: Load, @@ -889,7 +975,9 @@ Module( Name( ExprName { range: 596..597, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -926,7 +1014,9 @@ Module( }, ), attr: Identifier { - id: "real", + id: Name( + "real", + ), range: 619..623, }, ctx: Load, @@ -954,7 +1044,9 @@ Module( Name( ExprName { range: 677..678, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -973,7 +1065,9 @@ Module( slice: Name( ExprName { range: 685..687, - id: "no", + id: Name( + "no", + ), ctx: Load, }, ), @@ -989,7 +1083,9 @@ Module( Name( ExprName { range: 689..690, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -1011,7 +1107,9 @@ Module( Name( ExprName { range: 697..699, - id: "no", + id: Name( + "no", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__parenthesized.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__parenthesized.py.snap index 8ac5d39e1e28e8..2a92c9c249c157 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__parenthesized.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__parenthesized.py.snap @@ -15,7 +15,9 @@ Module( value: Name( ExprName { range: 1..5, - id: "expr", + id: Name( + "expr", + ), ctx: Load, }, ), @@ -30,7 +32,9 @@ Module( func: Name( ExprName { range: 8..12, - id: "expr", + id: Name( + "expr", + ), ctx: Load, }, ), @@ -58,7 +62,9 @@ Module( func: Name( ExprName { range: 17..21, - id: "expr", + id: Name( + "expr", + ), ctx: Load, }, ), @@ -101,14 +107,18 @@ Module( Name( ExprName { range: 31..32, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 37..38, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -118,7 +128,9 @@ Module( Name( ExprName { range: 42..43, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -143,7 +155,9 @@ Module( parameter: Parameter { range: 53..54, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 53..54, }, annotation: None, @@ -159,7 +173,9 @@ Module( body: Name( ExprName { range: 56..57, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -176,7 +192,9 @@ Module( target: Name( ExprName { range: 60..61, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -202,7 +220,9 @@ Module( Name( ExprName { range: 75..76, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -220,7 +240,9 @@ Module( value: Name( ExprName { range: 90..91, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__set.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__set.py.snap index 38620ecf790596..ac2aea883a9bec 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__set.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__set.py.snap @@ -289,7 +289,9 @@ Module( target: Name( ExprName { range: 168..169, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -329,7 +331,9 @@ Module( target: Name( ExprName { range: 180..181, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -377,7 +381,9 @@ Module( target: Name( ExprName { range: 196..197, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -417,7 +423,9 @@ Module( value: Name( ExprName { range: 230..231, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -461,7 +469,9 @@ Module( left: Name( ExprName { range: 241..242, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -469,7 +479,9 @@ Module( right: Name( ExprName { range: 245..246, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -527,14 +539,18 @@ Module( Name( ExprName { range: 282..283, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 285..286, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -583,7 +599,9 @@ Module( Name( ExprName { range: 301..302, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -591,7 +609,9 @@ Module( value: Name( ExprName { range: 304..305, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -601,7 +621,9 @@ Module( value: Name( ExprName { range: 309..310, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__set_comprehension.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__set_comprehension.py.snap index 22272a00a019fe..e0908b112a9424 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__set_comprehension.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__set_comprehension.py.snap @@ -18,7 +18,9 @@ Module( elt: Name( ExprName { range: 1..2, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -28,14 +30,18 @@ Module( target: Name( ExprName { range: 7..8, - id: "i", + id: Name( + "i", + ), ctx: Store, }, ), iter: Name( ExprName { range: 12..14, - id: "ll", + id: Name( + "ll", + ), ctx: Load, }, ), @@ -56,7 +62,9 @@ Module( elt: Name( ExprName { range: 17..18, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -66,14 +74,18 @@ Module( target: Name( ExprName { range: 23..24, - id: "c", + id: Name( + "c", + ), ctx: Store, }, ), iter: Name( ExprName { range: 28..29, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), @@ -84,7 +96,9 @@ Module( left: Name( ExprName { range: 33..34, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -95,7 +109,9 @@ Module( Name( ExprName { range: 38..39, - id: "w", + id: Name( + "w", + ), ctx: Load, }, ), @@ -110,14 +126,18 @@ Module( Name( ExprName { range: 43..44, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), Name( ExprName { range: 49..51, - id: "yy", + id: Name( + "yy", + ), ctx: Load, }, ), @@ -127,7 +147,9 @@ Module( Name( ExprName { range: 55..56, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -148,7 +170,9 @@ Module( elt: Name( ExprName { range: 59..60, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -158,14 +182,18 @@ Module( target: Name( ExprName { range: 65..66, - id: "b", + id: Name( + "b", + ), ctx: Store, }, ), iter: Name( ExprName { range: 70..71, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -178,14 +206,18 @@ Module( Name( ExprName { range: 75..76, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), Name( ExprName { range: 81..82, - id: "e", + id: Name( + "e", + ), ctx: Load, }, ), @@ -200,14 +232,18 @@ Module( target: Name( ExprName { range: 87..88, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), iter: Name( ExprName { range: 92..93, - id: "j", + id: Name( + "j", + ), ctx: Load, }, ), @@ -218,7 +254,9 @@ Module( left: Name( ExprName { range: 97..98, - id: "k", + id: Name( + "k", + ), ctx: Load, }, ), @@ -229,7 +267,9 @@ Module( Name( ExprName { range: 101..102, - id: "h", + id: Name( + "h", + ), ctx: Load, }, ), @@ -253,7 +293,9 @@ Module( elt: Name( ExprName { range: 105..106, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -263,14 +305,18 @@ Module( target: Name( ExprName { range: 111..112, - id: "b", + id: Name( + "b", + ), ctx: Store, }, ), iter: Name( ExprName { range: 116..117, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -283,14 +329,18 @@ Module( Name( ExprName { range: 121..122, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), Name( ExprName { range: 127..128, - id: "e", + id: Name( + "e", + ), ctx: Load, }, ), @@ -305,14 +355,18 @@ Module( target: Name( ExprName { range: 139..140, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), iter: Name( ExprName { range: 144..145, - id: "j", + id: Name( + "j", + ), ctx: Load, }, ), @@ -323,7 +377,9 @@ Module( left: Name( ExprName { range: 149..150, - id: "k", + id: Name( + "k", + ), ctx: Load, }, ), @@ -334,7 +390,9 @@ Module( Name( ExprName { range: 153..154, - id: "h", + id: Name( + "h", + ), ctx: Load, }, ), @@ -358,7 +416,9 @@ Module( elt: Name( ExprName { range: 157..158, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -372,14 +432,18 @@ Module( Name( ExprName { range: 163..164, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), Name( ExprName { range: 166..167, - id: "b", + id: Name( + "b", + ), ctx: Store, }, ), @@ -391,7 +455,9 @@ Module( iter: Name( ExprName { range: 171..172, - id: "G", + id: Name( + "G", + ), ctx: Load, }, ), @@ -412,7 +478,9 @@ Module( elt: Name( ExprName { range: 313..314, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -422,7 +490,9 @@ Module( target: Name( ExprName { range: 319..320, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -433,7 +503,9 @@ Module( Name( ExprName { range: 331..332, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -457,7 +529,9 @@ Module( elt: Name( ExprName { range: 336..337, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -467,7 +541,9 @@ Module( target: Name( ExprName { range: 342..343, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -477,7 +553,9 @@ Module( value: Name( ExprName { range: 359..360, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -500,7 +578,9 @@ Module( elt: Name( ExprName { range: 364..365, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -510,7 +590,9 @@ Module( target: Name( ExprName { range: 370..371, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -527,7 +609,9 @@ Module( parameter: Parameter { range: 383..384, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 383..384, }, annotation: None, @@ -543,7 +627,9 @@ Module( body: Name( ExprName { range: 386..387, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -566,7 +652,9 @@ Module( elt: Name( ExprName { range: 391..392, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -576,14 +664,18 @@ Module( target: Name( ExprName { range: 397..398, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 402..406, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -595,7 +687,9 @@ Module( Name( ExprName { range: 417..418, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -619,7 +713,9 @@ Module( elt: Name( ExprName { range: 422..423, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -629,14 +725,18 @@ Module( target: Name( ExprName { range: 428..429, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 433..437, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -647,7 +747,9 @@ Module( value: Name( ExprName { range: 453..454, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -670,7 +772,9 @@ Module( elt: Name( ExprName { range: 458..459, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -680,14 +784,18 @@ Module( target: Name( ExprName { range: 464..465, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 469..473, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -705,7 +813,9 @@ Module( parameter: Parameter { range: 485..486, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 485..486, }, annotation: None, @@ -721,7 +831,9 @@ Module( body: Name( ExprName { range: 488..489, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__slice.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__slice.py.snap index dd3211144fa384..bda9e9030d82f5 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__slice.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__slice.py.snap @@ -18,7 +18,9 @@ Module( value: Name( ExprName { range: 23..24, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -44,7 +46,9 @@ Module( value: Name( ExprName { range: 28..29, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -79,7 +83,9 @@ Module( value: Name( ExprName { range: 34..35, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -114,7 +120,9 @@ Module( value: Name( ExprName { range: 40..41, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -158,7 +166,9 @@ Module( value: Name( ExprName { range: 47..48, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -184,7 +194,9 @@ Module( value: Name( ExprName { range: 53..54, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -219,7 +231,9 @@ Module( value: Name( ExprName { range: 60..61, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -254,7 +268,9 @@ Module( value: Name( ExprName { range: 67..68, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -298,7 +314,9 @@ Module( value: Name( ExprName { range: 75..76, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -333,7 +351,9 @@ Module( value: Name( ExprName { range: 82..83, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -377,7 +397,9 @@ Module( value: Name( ExprName { range: 90..91, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -421,7 +443,9 @@ Module( value: Name( ExprName { range: 98..99, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -474,7 +498,9 @@ Module( value: Name( ExprName { range: 127..128, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -484,7 +510,9 @@ Module( target: Name( ExprName { range: 129..130, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -512,7 +540,9 @@ Module( value: Name( ExprName { range: 137..138, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -526,7 +556,9 @@ Module( target: Name( ExprName { range: 140..141, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -559,7 +591,9 @@ Module( value: Name( ExprName { range: 150..151, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -573,7 +607,9 @@ Module( target: Name( ExprName { range: 152..153, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -606,7 +642,9 @@ Module( value: Name( ExprName { range: 202..203, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__starred.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__starred.py.snap index 2d9041f3a70f17..d1bf4968dcd525 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__starred.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__starred.py.snap @@ -18,7 +18,9 @@ Module( value: Name( ExprName { range: 1..2, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -39,7 +41,9 @@ Module( left: Name( ExprName { range: 5..6, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -71,12 +75,16 @@ Module( value: Name( ExprName { range: 13..14, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), attr: Identifier { - id: "attr", + id: Name( + "attr", + ), range: 15..19, }, ctx: Load, @@ -94,7 +102,9 @@ Module( Name( ExprName { range: 21..32, - id: "array_slice", + id: Name( + "array_slice", + ), ctx: Store, }, ), @@ -105,7 +115,9 @@ Module( value: Name( ExprName { range: 35..40, - id: "array", + id: Name( + "array", + ), ctx: Load, }, ), @@ -127,7 +139,9 @@ Module( value: Name( ExprName { range: 45..52, - id: "indexes", + id: Name( + "indexes", + ), ctx: Load, }, ), @@ -168,7 +182,9 @@ Module( value: Name( ExprName { range: 58..63, - id: "array", + id: Name( + "array", + ), ctx: Load, }, ), @@ -190,7 +206,9 @@ Module( value: Name( ExprName { range: 68..75, - id: "indexes", + id: Name( + "indexes", + ), ctx: Load, }, ), @@ -223,7 +241,9 @@ Module( value: Name( ExprName { range: 83..94, - id: "array_slice", + id: Name( + "array_slice", + ), ctx: Load, }, ), @@ -238,7 +258,9 @@ Module( value: Name( ExprName { range: 95..100, - id: "array", + id: Name( + "array", + ), ctx: Load, }, ), @@ -252,7 +274,9 @@ Module( value: Name( ExprName { range: 102..119, - id: "indexes_to_select", + id: Name( + "indexes_to_select", + ), ctx: Load, }, ), @@ -265,7 +289,9 @@ Module( value: Name( ExprName { range: 122..139, - id: "indexes_to_select", + id: Name( + "indexes_to_select", + ), ctx: Load, }, ), @@ -291,7 +317,9 @@ Module( value: Name( ExprName { range: 141..146, - id: "array", + id: Name( + "array", + ), ctx: Load, }, ), @@ -331,7 +359,9 @@ Module( value: Name( ExprName { range: 153..170, - id: "indexes_to_select", + id: Name( + "indexes_to_select", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__subscript.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__subscript.py.snap index c7f4cca392b9d8..bda890fafe040c 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__subscript.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__subscript.py.snap @@ -21,7 +21,9 @@ Module( value: Name( ExprName { range: 0..4, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -58,7 +60,9 @@ Module( value: Name( ExprName { range: 11..15, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -101,7 +105,9 @@ Module( value: Name( ExprName { range: 22..26, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -145,7 +151,9 @@ Module( value: Name( ExprName { range: 32..36, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -197,7 +205,9 @@ Module( value: Name( ExprName { range: 44..48, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -258,7 +268,9 @@ Module( value: Name( ExprName { range: 57..61, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -316,7 +328,9 @@ Module( Name( ExprName { range: 72..73, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -328,7 +342,9 @@ Module( left: Name( ExprName { range: 74..75, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -366,7 +382,9 @@ Module( value: Name( ExprName { range: 81..85, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -376,14 +394,18 @@ Module( target: Name( ExprName { range: 86..87, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), value: Name( ExprName { range: 91..92, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -403,7 +425,9 @@ Module( value: Name( ExprName { range: 94..98, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -455,7 +479,9 @@ Module( value: Name( ExprName { range: 107..111, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -506,7 +532,9 @@ Module( value: Name( ExprName { range: 121..125, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -517,7 +545,9 @@ Module( operand: Name( ExprName { range: 127..131, - id: "flag", + id: Name( + "flag", + ), ctx: Load, }, ), @@ -537,7 +567,9 @@ Module( value: Name( ExprName { range: 133..137, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -551,7 +583,9 @@ Module( target: Name( ExprName { range: 139..140, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), @@ -584,7 +618,9 @@ Module( value: Name( ExprName { range: 149..153, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -598,7 +634,9 @@ Module( target: Name( ExprName { range: 155..156, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), @@ -617,7 +655,9 @@ Module( Name( ExprName { range: 163..164, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -639,7 +679,9 @@ Module( value: Name( ExprName { range: 226..230, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -653,7 +695,9 @@ Module( value: Name( ExprName { range: 232..233, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -679,7 +723,9 @@ Module( value: Name( ExprName { range: 235..239, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -698,14 +744,18 @@ Module( Name( ExprName { range: 241..242, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 247..248, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -734,7 +784,9 @@ Module( value: Name( ExprName { range: 250..254, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -751,14 +803,18 @@ Module( target: Name( ExprName { range: 257..258, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), value: Name( ExprName { range: 262..263, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__tuple.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__tuple.py.snap index e425e62a839b6e..461b57cdaa59b3 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__tuple.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__tuple.py.snap @@ -75,7 +75,9 @@ Module( Name( ExprName { range: 39..40, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -96,14 +98,18 @@ Module( Name( ExprName { range: 44..45, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 47..48, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -124,14 +130,18 @@ Module( Name( ExprName { range: 51..52, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 54..55, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -152,14 +162,18 @@ Module( Name( ExprName { range: 60..61, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 63..64, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -180,7 +194,9 @@ Module( Name( ExprName { range: 90..91, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -201,14 +217,18 @@ Module( Name( ExprName { range: 93..94, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 96..97, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -229,14 +249,18 @@ Module( Name( ExprName { range: 98..99, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 101..102, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -260,7 +284,9 @@ Module( value: Name( ExprName { range: 127..128, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -284,7 +310,9 @@ Module( Name( ExprName { range: 130..131, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -294,7 +322,9 @@ Module( value: Name( ExprName { range: 134..135, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -324,7 +354,9 @@ Module( left: Name( ExprName { range: 137..138, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -332,7 +364,9 @@ Module( right: Name( ExprName { range: 141..142, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -350,7 +384,9 @@ Module( value: Name( ExprName { range: 151..152, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -401,7 +437,9 @@ Module( value: Name( ExprName { range: 164..165, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -425,7 +463,9 @@ Module( Name( ExprName { range: 169..170, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -435,7 +475,9 @@ Module( value: Name( ExprName { range: 173..174, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -465,7 +507,9 @@ Module( left: Name( ExprName { range: 178..179, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -473,7 +517,9 @@ Module( right: Name( ExprName { range: 182..183, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -491,7 +537,9 @@ Module( value: Name( ExprName { range: 192..193, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -542,7 +590,9 @@ Module( target: Name( ExprName { range: 225..226, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -573,7 +623,9 @@ Module( Name( ExprName { range: 235..236, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -583,7 +635,9 @@ Module( target: Name( ExprName { range: 238..239, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -614,7 +668,9 @@ Module( Name( ExprName { range: 247..248, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -624,7 +680,9 @@ Module( target: Name( ExprName { range: 250..251, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -641,7 +699,9 @@ Module( Name( ExprName { range: 258..259, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -662,7 +722,9 @@ Module( Name( ExprName { range: 261..262, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -672,7 +734,9 @@ Module( target: Name( ExprName { range: 265..266, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -689,7 +753,9 @@ Module( Name( ExprName { range: 274..275, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__unary_op.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__unary_op.py.snap index 6ea92294227a18..28925328079670 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__unary_op.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__unary_op.py.snap @@ -76,7 +76,9 @@ Module( operand: Name( ExprName { range: 22..23, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -197,7 +199,9 @@ Module( operand: Name( ExprName { range: 62..63, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -364,7 +368,9 @@ Module( operand: Name( ExprName { range: 216..217, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -373,7 +379,9 @@ Module( Name( ExprName { range: 222..223, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -395,7 +403,9 @@ Module( left: Name( ExprName { range: 231..232, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -403,7 +413,9 @@ Module( right: Name( ExprName { range: 235..236, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), @@ -418,7 +430,9 @@ Module( operand: Name( ExprName { range: 245..246, - id: "e", + id: Name( + "e", + ), ctx: Load, }, ), @@ -445,7 +459,9 @@ Module( target: Name( ExprName { range: 252..253, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -476,7 +492,9 @@ Module( left: Name( ExprName { range: 264..265, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -488,7 +506,9 @@ Module( operand: Name( ExprName { range: 273..274, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__yield.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__yield.py.snap index 8eda1ccf6082cb..25c7213a3d58c3 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__yield.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__yield.py.snap @@ -30,7 +30,9 @@ Module( Name( ExprName { range: 12..13, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -52,7 +54,9 @@ Module( left: Name( ExprName { range: 20..21, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -87,14 +91,18 @@ Module( Name( ExprName { range: 32..33, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 38..39, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -119,7 +127,9 @@ Module( func: Name( ExprName { range: 46..50, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -222,7 +232,9 @@ Module( Name( ExprName { range: 86..87, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -258,14 +270,18 @@ Module( Name( ExprName { range: 98..99, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 101..102, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -293,14 +309,18 @@ Module( Name( ExprName { range: 110..111, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 113..114, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -327,7 +347,9 @@ Module( left: Name( ExprName { range: 122..123, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -338,7 +360,9 @@ Module( Name( ExprName { range: 127..128, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -363,7 +387,9 @@ Module( target: Name( ExprName { range: 136..137, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -395,7 +421,9 @@ Module( value: Name( ExprName { range: 151..152, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -421,7 +449,9 @@ Module( Name( ExprName { range: 159..160, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -431,7 +461,9 @@ Module( value: Name( ExprName { range: 163..164, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -465,7 +497,9 @@ Module( value: Name( ExprName { range: 172..173, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -498,7 +532,9 @@ Module( left: Name( ExprName { range: 182..183, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -506,7 +542,9 @@ Module( right: Name( ExprName { range: 186..187, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__yield_from.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__yield_from.py.snap index d069483300c357..442e44e38af2e8 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__yield_from.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@expressions__yield_from.py.snap @@ -18,7 +18,9 @@ Module( value: Name( ExprName { range: 11..12, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -38,7 +40,9 @@ Module( left: Name( ExprName { range: 24..25, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -71,14 +75,18 @@ Module( Name( ExprName { range: 41..42, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 47..48, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -101,7 +109,9 @@ Module( func: Name( ExprName { range: 60..64, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -198,7 +208,9 @@ Module( Name( ExprName { range: 115..116, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -232,14 +244,18 @@ Module( Name( ExprName { range: 133..134, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 136..137, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -264,7 +280,9 @@ Module( left: Name( ExprName { range: 150..151, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -275,7 +293,9 @@ Module( Name( ExprName { range: 155..156, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -298,7 +318,9 @@ Module( target: Name( ExprName { range: 169..170, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -329,7 +351,9 @@ Module( Name( ExprName { range: 189..190, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -342,7 +366,9 @@ Module( left: Name( ExprName { range: 193..194, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -350,7 +376,9 @@ Module( right: Name( ExprName { range: 197..198, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@for_in_target_valid_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@for_in_target_valid_expr.py.snap index 04e9a2dd487de7..8d22a93e1f9c8f 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@for_in_target_valid_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@for_in_target_valid_expr.py.snap @@ -19,7 +19,9 @@ Module( value: Name( ExprName { range: 4..5, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), @@ -29,7 +31,9 @@ Module( left: Name( ExprName { range: 6..7, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -40,7 +44,9 @@ Module( Name( ExprName { range: 11..12, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -53,7 +59,9 @@ Module( iter: Name( ExprName { range: 17..23, - id: "target", + id: Name( + "target", + ), ctx: Load, }, ), @@ -85,7 +93,9 @@ Module( left: Name( ExprName { range: 34..35, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -96,7 +106,9 @@ Module( Name( ExprName { range: 39..40, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -117,7 +129,9 @@ Module( iter: Name( ExprName { range: 48..52, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), @@ -149,7 +163,9 @@ Module( left: Name( ExprName { range: 63..64, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -160,7 +176,9 @@ Module( Name( ExprName { range: 68..69, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -168,7 +186,9 @@ Module( }, ), attr: Identifier { - id: "attr", + id: Name( + "attr", + ), range: 71..75, }, ctx: Store, @@ -177,7 +197,9 @@ Module( iter: Name( ExprName { range: 79..83, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@from_import_no_space.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@from_import_no_space.py.snap index 6f6153b29e1e3a..4f80ffdeb3821a 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@from_import_no_space.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@from_import_no_space.py.snap @@ -17,7 +17,9 @@ Module( Alias { range: 12..13, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 12..13, }, asname: None, @@ -34,7 +36,9 @@ Module( Alias { range: 28..29, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 28..29, }, asname: None, diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@from_import_soft_keyword_module_name.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@from_import_soft_keyword_module_name.py.snap index 9ab3b52aba38ab..ad28900d9c32a6 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@from_import_soft_keyword_module_name.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@from_import_soft_keyword_module_name.py.snap @@ -14,7 +14,9 @@ Module( range: 0..25, module: Some( Identifier { - id: "match", + id: Name( + "match", + ), range: 5..10, }, ), @@ -22,7 +24,9 @@ Module( Alias { range: 18..25, name: Identifier { - id: "pattern", + id: Name( + "pattern", + ), range: 18..25, }, asname: None, @@ -36,7 +40,9 @@ Module( range: 26..46, module: Some( Identifier { - id: "type", + id: Name( + "type", + ), range: 31..35, }, ), @@ -44,7 +50,9 @@ Module( Alias { range: 43..46, name: Identifier { - id: "bar", + id: Name( + "bar", + ), range: 43..46, }, asname: None, @@ -58,7 +66,9 @@ Module( range: 47..71, module: Some( Identifier { - id: "case", + id: Name( + "case", + ), range: 52..56, }, ), @@ -66,7 +76,9 @@ Module( Alias { range: 64..71, name: Identifier { - id: "pattern", + id: Name( + "pattern", + ), range: 64..71, }, asname: None, @@ -80,7 +92,9 @@ Module( range: 72..103, module: Some( Identifier { - id: "match.type.case", + id: Name( + "match.type.case", + ), range: 77..92, }, ), @@ -88,7 +102,9 @@ Module( Alias { range: 100..103, name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 100..103, }, asname: None, diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@from_import_stmt_terminator.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@from_import_stmt_terminator.py.snap index 9cee45ecf22fec..5a438bce6dc14e 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@from_import_stmt_terminator.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@from_import_stmt_terminator.py.snap @@ -14,7 +14,9 @@ Module( range: 0..20, module: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 5..6, }, ), @@ -22,7 +24,9 @@ Module( Alias { range: 15..16, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 15..16, }, asname: None, @@ -30,7 +34,9 @@ Module( Alias { range: 18..19, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 18..19, }, asname: None, @@ -44,7 +50,9 @@ Module( range: 21..41, module: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 26..27, }, ), @@ -52,7 +60,9 @@ Module( Alias { range: 36..37, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 36..37, }, asname: None, @@ -60,7 +70,9 @@ Module( Alias { range: 39..40, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 39..40, }, asname: None, @@ -79,14 +91,18 @@ Module( Name( ExprName { range: 43..44, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 46..47, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -102,7 +118,9 @@ Module( range: 48..66, module: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 53..54, }, ), @@ -110,7 +128,9 @@ Module( Alias { range: 62..63, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 62..63, }, asname: None, @@ -118,7 +138,9 @@ Module( Alias { range: 65..66, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 65..66, }, asname: None, @@ -137,14 +159,18 @@ Module( Name( ExprName { range: 68..69, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 71..72, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -160,7 +186,9 @@ Module( range: 73..91, module: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 78..79, }, ), @@ -168,7 +196,9 @@ Module( Alias { range: 87..88, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 87..88, }, asname: None, @@ -176,7 +206,9 @@ Module( Alias { range: 90..91, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 90..91, }, asname: None, @@ -195,14 +227,18 @@ Module( Name( ExprName { range: 92..93, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 95..96, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@fstring_format_spec_terminator.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@fstring_format_spec_terminator.py.snap index 343825fcdb7371..58ec6938587b3f 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@fstring_format_spec_terminator.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@fstring_format_spec_terminator.py.snap @@ -33,7 +33,9 @@ Module( expression: Name( ExprName { range: 9..10, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -91,7 +93,9 @@ Module( expression: Name( ExprName { range: 29..30, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@function_def_parameter_range.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@function_def_parameter_range.py.snap index c447efe4e7facd..18e9898e50b5c1 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@function_def_parameter_range.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@function_def_parameter_range.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -28,14 +30,18 @@ Module( parameter: Parameter { range: 13..23, name: Identifier { - id: "first", + id: Name( + "first", + ), range: 13..18, }, annotation: Some( Name( ExprName { range: 20..23, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -48,14 +54,18 @@ Module( parameter: Parameter { range: 29..40, name: Identifier { - id: "second", + id: Name( + "second", + ), range: 29..35, }, annotation: Some( Name( ExprName { range: 37..40, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -72,7 +82,9 @@ Module( Name( ExprName { range: 47..50, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@function_def_parenthesized_return_types.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@function_def_parenthesized_return_types.py.snap index eb6c1f3cb195a5..256cdd4fe93b44 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@function_def_parenthesized_return_types.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@function_def_parenthesized_return_types.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -35,7 +37,9 @@ Module( Name( ExprName { range: 14..17, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -65,7 +69,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 29..32, }, type_params: None, @@ -85,14 +91,18 @@ Module( Name( ExprName { range: 39..42, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), Name( ExprName { range: 44..47, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@function_def_valid_return_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@function_def_valid_return_expr.py.snap index dce1c4cf133fbb..344b37c57766c5 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@function_def_valid_return_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@function_def_valid_return_expr.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -34,7 +36,9 @@ Module( left: Name( ExprName { range: 13..16, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -42,7 +46,9 @@ Module( right: Name( ExprName { range: 19..22, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -69,7 +75,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 32..35, }, type_params: None, @@ -95,7 +103,9 @@ Module( parameter: Parameter { range: 48..49, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 48..49, }, annotation: None, @@ -111,7 +121,9 @@ Module( body: Name( ExprName { range: 51..52, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -138,7 +150,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 62..65, }, type_params: None, @@ -158,7 +172,9 @@ Module( Name( ExprName { range: 78..79, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -186,7 +202,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 90..93, }, type_params: None, @@ -211,14 +229,18 @@ Module( body: Name( ExprName { range: 99..102, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 116..119, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@global_stmt.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@global_stmt.py.snap index 3231376754bf16..bea482e4e315b4 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@global_stmt.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@global_stmt.py.snap @@ -14,7 +14,9 @@ Module( range: 0..8, names: [ Identifier { - id: "x", + id: Name( + "x", + ), range: 7..8, }, ], @@ -25,15 +27,21 @@ Module( range: 9..23, names: [ Identifier { - id: "x", + id: Name( + "x", + ), range: 16..17, }, Identifier { - id: "y", + id: Name( + "y", + ), range: 19..20, }, Identifier { - id: "z", + id: Name( + "z", + ), range: 22..23, }, ], diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@import_as_name_soft_keyword.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@import_as_name_soft_keyword.py.snap index b4e8a5ae633e51..e5c9aac23cfcb2 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@import_as_name_soft_keyword.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@import_as_name_soft_keyword.py.snap @@ -16,12 +16,16 @@ Module( Alias { range: 7..19, name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 7..10, }, asname: Some( Identifier { - id: "match", + id: Name( + "match", + ), range: 14..19, }, ), @@ -36,12 +40,16 @@ Module( Alias { range: 27..38, name: Identifier { - id: "bar", + id: Name( + "bar", + ), range: 27..30, }, asname: Some( Identifier { - id: "case", + id: Name( + "case", + ), range: 34..38, }, ), @@ -56,12 +64,16 @@ Module( Alias { range: 46..57, name: Identifier { - id: "baz", + id: Name( + "baz", + ), range: 46..49, }, asname: Some( Identifier { - id: "type", + id: Name( + "type", + ), range: 53..57, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@import_stmt_terminator.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@import_stmt_terminator.py.snap index 7cdade0b918246..b6e00b7b54157d 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@import_stmt_terminator.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@import_stmt_terminator.py.snap @@ -16,7 +16,9 @@ Module( Alias { range: 7..8, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 7..8, }, asname: None, @@ -24,7 +26,9 @@ Module( Alias { range: 10..11, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 10..11, }, asname: None, @@ -39,7 +43,9 @@ Module( Alias { range: 20..21, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 20..21, }, asname: None, @@ -47,7 +53,9 @@ Module( Alias { range: 23..24, name: Identifier { - id: "d", + id: Name( + "d", + ), range: 23..24, }, asname: None, @@ -62,7 +70,9 @@ Module( Alias { range: 32..33, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 32..33, }, asname: None, @@ -70,7 +80,9 @@ Module( Alias { range: 35..36, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 35..36, }, asname: None, @@ -88,14 +100,18 @@ Module( Name( ExprName { range: 37..38, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), Name( ExprName { range: 40..41, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@lambda_with_valid_body.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@lambda_with_valid_body.py.snap index d86b646422a1b5..355f19121f1f80 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@lambda_with_valid_body.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@lambda_with_valid_body.py.snap @@ -25,7 +25,9 @@ Module( parameter: Parameter { range: 7..8, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 7..8, }, annotation: None, @@ -41,7 +43,9 @@ Module( body: Name( ExprName { range: 10..11, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -65,7 +69,9 @@ Module( parameter: Parameter { range: 19..20, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 19..20, }, annotation: None, @@ -90,14 +96,18 @@ Module( body: Name( ExprName { range: 22..23, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 37..38, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -123,7 +133,9 @@ Module( parameter: Parameter { range: 46..47, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 46..47, }, annotation: None, @@ -142,7 +154,9 @@ Module( value: Name( ExprName { range: 55..56, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -168,7 +182,9 @@ Module( parameter: Parameter { range: 64..65, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 64..65, }, annotation: None, @@ -194,7 +210,9 @@ Module( parameter: Parameter { range: 74..75, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 74..75, }, annotation: None, @@ -213,7 +231,9 @@ Module( left: Name( ExprName { range: 77..78, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -221,7 +241,9 @@ Module( right: Name( ExprName { range: 81..82, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -249,7 +271,9 @@ Module( parameter: Parameter { range: 90..91, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 90..91, }, annotation: None, @@ -269,7 +293,9 @@ Module( Name( ExprName { range: 100..101, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -300,7 +326,9 @@ Module( parameter: Parameter { range: 143..144, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 143..144, }, annotation: None, @@ -316,7 +344,9 @@ Module( body: Name( ExprName { range: 146..147, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -328,7 +358,9 @@ Module( value: Name( ExprName { range: 150..151, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_as_pattern.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_as_pattern.py.snap index 4fea0dcc1870c4..b59c908d157e84 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_as_pattern.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_as_pattern.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 6..9, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -28,7 +30,9 @@ Module( pattern: None, name: Some( Identifier { - id: "foo_bar", + id: Name( + "foo_bar", + ), range: 20..27, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_as_pattern_soft_keyword.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_as_pattern_soft_keyword.py.snap index eecf69925d9878..8571681604fcbe 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_as_pattern_soft_keyword.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_as_pattern_soft_keyword.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 6..9, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -28,7 +30,9 @@ Module( pattern: None, name: Some( Identifier { - id: "case", + id: Name( + "case", + ), range: 20..24, }, ), @@ -56,7 +60,9 @@ Module( pattern: None, name: Some( Identifier { - id: "match", + id: Name( + "match", + ), range: 39..44, }, ), @@ -84,7 +90,9 @@ Module( pattern: None, name: Some( Identifier { - id: "type", + id: Name( + "type", + ), range: 59..63, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_attr_pattern_soft_keyword.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_attr_pattern_soft_keyword.py.snap index fb3410108d3e76..01f73622015230 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_attr_pattern_soft_keyword.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_attr_pattern_soft_keyword.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 6..9, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -31,12 +33,16 @@ Module( value: Name( ExprName { range: 20..25, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), attr: Identifier { - id: "bar", + id: Name( + "bar", + ), range: 26..29, }, ctx: Load, @@ -69,12 +75,16 @@ Module( value: Name( ExprName { range: 44..48, - id: "case", + id: Name( + "case", + ), ctx: Load, }, ), attr: Identifier { - id: "bar", + id: Name( + "bar", + ), range: 49..52, }, ctx: Load, @@ -107,12 +117,16 @@ Module( value: Name( ExprName { range: 67..71, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), attr: Identifier { - id: "bar", + id: Name( + "bar", + ), range: 72..75, }, ctx: Load, @@ -160,47 +174,61 @@ Module( value: Name( ExprName { range: 90..95, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), attr: Identifier { - id: "case", + id: Name( + "case", + ), range: 96..100, }, ctx: Load, }, ), attr: Identifier { - id: "type", + id: Name( + "type", + ), range: 101..105, }, ctx: Load, }, ), attr: Identifier { - id: "bar", + id: Name( + "bar", + ), range: 106..109, }, ctx: Load, }, ), attr: Identifier { - id: "type", + id: Name( + "type", + ), range: 110..114, }, ctx: Load, }, ), attr: Identifier { - id: "case", + id: Name( + "case", + ), range: 115..119, }, ctx: Load, }, ), attr: Identifier { - id: "match", + id: Name( + "match", + ), range: 120..125, }, ctx: Load, diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_classify_as_identifier_1.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_classify_as_identifier_1.py.snap index 21dd833fc8031b..5cf937c3325559 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_classify_as_identifier_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_classify_as_identifier_1.py.snap @@ -18,7 +18,9 @@ Module( left: Name( ExprName { range: 0..5, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -29,7 +31,9 @@ Module( Name( ExprName { range: 13..17, - id: "case", + id: Name( + "case", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_classify_as_identifier_2.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_classify_as_identifier_2.py.snap index c2023f5c4ac3a2..5553de65aab5e5 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_classify_as_identifier_2.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_classify_as_identifier_2.py.snap @@ -15,7 +15,9 @@ Module( value: Name( ExprName { range: 0..5, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -30,7 +32,9 @@ Module( left: Name( ExprName { range: 6..11, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -41,7 +45,9 @@ Module( Name( ExprName { range: 15..18, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -60,14 +66,18 @@ Module( Name( ExprName { range: 20..23, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), Name( ExprName { range: 25..30, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -88,14 +98,18 @@ Module( Name( ExprName { range: 33..36, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), Name( ExprName { range: 38..43, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -115,14 +129,18 @@ Module( Name( ExprName { range: 46..49, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), Name( ExprName { range: 51..56, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -137,7 +155,9 @@ Module( value: Name( ExprName { range: 58..63, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -149,14 +169,18 @@ Module( target: Name( ExprName { range: 65..70, - id: "match", + id: Name( + "match", + ), ctx: Store, }, ), annotation: Name( ExprName { range: 72..75, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -174,7 +198,9 @@ Module( Name( ExprName { range: 76..81, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -194,12 +220,16 @@ Module( value: Name( ExprName { range: 83..88, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), attr: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 89..92, }, ctx: Load, @@ -216,7 +246,9 @@ Module( left: Name( ExprName { range: 93..98, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -224,7 +256,9 @@ Module( right: Name( ExprName { range: 101..104, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -241,7 +275,9 @@ Module( left: Name( ExprName { range: 105..110, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -249,7 +285,9 @@ Module( right: Name( ExprName { range: 114..117, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -268,14 +306,18 @@ Module( Name( ExprName { range: 118..123, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), Name( ExprName { range: 128..131, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -293,7 +335,9 @@ Module( left: Name( ExprName { range: 132..137, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -304,7 +348,9 @@ Module( Name( ExprName { range: 145..148, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_classify_as_keyword_1.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_classify_as_keyword_1.py.snap index b25b756c8cebae..9e191d55a4d131 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_classify_as_keyword_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_classify_as_keyword_1.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 6..9, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -233,7 +235,9 @@ Module( expression: Name( ExprName { range: 147..148, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -344,7 +348,9 @@ Module( operand: Name( ExprName { range: 205..208, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -422,7 +428,9 @@ Module( operand: Name( ExprName { range: 263..266, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -467,7 +475,9 @@ Module( func: Name( ExprName { range: 296..299, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -523,7 +533,9 @@ Module( parameter: Parameter { range: 332..335, name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 332..335, }, annotation: None, @@ -539,7 +551,9 @@ Module( body: Name( ExprName { range: 337..340, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_classify_as_keyword_2.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_classify_as_keyword_2.py.snap index 88a69846f4955f..e4d4ebba606a54 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_classify_as_keyword_2.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_classify_as_keyword_2.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 6..11, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -52,7 +54,9 @@ Module( subject: Name( ExprName { range: 35..39, - id: "case", + id: Name( + "case", + ), ctx: Load, }, ), @@ -89,7 +93,9 @@ Module( subject: Name( ExprName { range: 63..67, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_classify_as_keyword_or_identifier.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_classify_as_keyword_or_identifier.py.snap index 67f1d122bc1967..3c00bb5733cba6 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_classify_as_keyword_or_identifier.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_classify_as_keyword_or_identifier.py.snap @@ -18,7 +18,9 @@ Module( func: Name( ExprName { range: 0..5, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -112,7 +114,9 @@ Module( value: Name( ExprName { range: 68..73, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -201,7 +205,9 @@ Module( left: Name( ExprName { range: 134..139, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -209,7 +215,9 @@ Module( right: Name( ExprName { range: 142..145, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -226,7 +234,9 @@ Module( left: Name( ExprName { range: 160..165, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -234,7 +244,9 @@ Module( right: Name( ExprName { range: 168..171, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -252,7 +264,9 @@ Module( operand: Name( ExprName { range: 193..196, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_sequence_pattern_parentheses_terminator.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_sequence_pattern_parentheses_terminator.py.snap index 178abcfd533605..0bb8cf44f36068 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_sequence_pattern_parentheses_terminator.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_sequence_pattern_parentheses_terminator.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 6..13, - id: "subject", + id: Name( + "subject", + ), ctx: Load, }, ), @@ -32,7 +34,9 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 25..26, }, ), @@ -44,7 +48,9 @@ Module( pattern: None, name: Some( Identifier { - id: "b", + id: Name( + "b", + ), range: 28..29, }, ), @@ -79,7 +85,9 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 46..47, }, ), @@ -91,7 +99,9 @@ Module( pattern: None, name: Some( Identifier { - id: "b", + id: Name( + "b", + ), range: 49..50, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_sequence_pattern_terminator.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_sequence_pattern_terminator.py.snap index cf7c08be263d66..57bad0c329aebb 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_sequence_pattern_terminator.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_sequence_pattern_terminator.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 6..13, - id: "subject", + id: Name( + "subject", + ), ctx: Load, }, ), @@ -28,7 +30,9 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 24..25, }, ), @@ -56,7 +60,9 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 40..41, }, ), @@ -66,7 +72,9 @@ Module( Name( ExprName { range: 45..46, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -96,7 +104,9 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 61..62, }, ), @@ -108,7 +118,9 @@ Module( pattern: None, name: Some( Identifier { - id: "b", + id: Name( + "b", + ), range: 64..65, }, ), @@ -143,7 +155,9 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 80..81, }, ), @@ -155,7 +169,9 @@ Module( pattern: None, name: Some( Identifier { - id: "b", + id: Name( + "b", + ), range: 83..84, }, ), @@ -168,7 +184,9 @@ Module( Name( ExprName { range: 88..89, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_stmt_subject_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_stmt_subject_expr.py.snap index 8fa7c0e2b49adb..7f250505bbb896 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_stmt_subject_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_stmt_subject_expr.py.snap @@ -18,7 +18,9 @@ Module( target: Name( ExprName { range: 6..7, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -68,7 +70,9 @@ Module( target: Name( ExprName { range: 37..38, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -125,7 +129,9 @@ Module( left: Name( ExprName { range: 128..129, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -133,7 +139,9 @@ Module( right: Name( ExprName { range: 132..133, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -145,7 +153,9 @@ Module( Name( ExprName { range: 135..136, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -190,7 +200,9 @@ Module( value: Name( ExprName { range: 166..167, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_stmt_valid_guard_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_stmt_valid_guard_expr.py.snap index 0f30fcbe4dc7fa..22ceb099c74a0e 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_stmt_valid_guard_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@match_stmt_valid_guard_expr.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 6..7, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -28,7 +30,9 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name( + "y", + ), range: 18..19, }, ), @@ -41,7 +45,9 @@ Module( target: Name( ExprName { range: 23..24, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), @@ -78,7 +84,9 @@ Module( subject: Name( ExprName { range: 41..42, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -91,7 +99,9 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name( + "y", + ), range: 53..54, }, ), @@ -110,14 +120,18 @@ Module( body: Name( ExprName { range: 58..59, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 73..74, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -146,7 +160,9 @@ Module( subject: Name( ExprName { range: 86..87, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -159,7 +175,9 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name( + "y", + ), range: 98..99, }, ), @@ -179,7 +197,9 @@ Module( parameter: Parameter { range: 110..111, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 110..111, }, annotation: None, @@ -195,7 +215,9 @@ Module( body: Name( ExprName { range: 113..114, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -224,7 +246,9 @@ Module( subject: Name( ExprName { range: 126..127, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -237,7 +261,9 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name( + "y", + ), range: 138..139, }, ), @@ -251,7 +277,9 @@ Module( Name( ExprName { range: 150..151, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@nonlocal_stmt.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@nonlocal_stmt.py.snap index 279f8067355046..3981bb0db27703 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@nonlocal_stmt.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@nonlocal_stmt.py.snap @@ -14,7 +14,9 @@ Module( range: 0..10, names: [ Identifier { - id: "x", + id: Name( + "x", + ), range: 9..10, }, ], @@ -25,15 +27,21 @@ Module( range: 11..27, names: [ Identifier { - id: "x", + id: Name( + "x", + ), range: 20..21, }, Identifier { - id: "y", + id: Name( + "y", + ), range: 23..24, }, Identifier { - id: "z", + id: Name( + "z", + ), range: 26..27, }, ], diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@other__decorator.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@other__decorator.py.snap index 84bf123453bfc8..a0732cc928d41c 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@other__decorator.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@other__decorator.py.snap @@ -19,14 +19,18 @@ Module( expression: Name( ExprName { range: 1..19, - id: "function_decorator", + id: Name( + "function_decorator", + ), ctx: Load, }, ), }, ], name: Identifier { - id: "test", + id: Name( + "test", + ), range: 24..28, }, type_params: None, @@ -57,14 +61,18 @@ Module( expression: Name( ExprName { range: 44..59, - id: "class_decorator", + id: Name( + "class_decorator", + ), ctx: Load, }, ), }, ], name: Identifier { - id: "Test", + id: Name( + "Test", + ), range: 66..70, }, type_params: None, @@ -88,14 +96,18 @@ Module( expression: Name( ExprName { range: 84..93, - id: "decorator", + id: Name( + "decorator", + ), ctx: Load, }, ), }, ], name: Identifier { - id: "f", + id: Name( + "f", + ), range: 98..99, }, type_params: None, @@ -138,19 +150,25 @@ Module( value: Name( ExprName { range: 110..111, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), attr: Identifier { - id: "b", + id: Name( + "b", + ), range: 112..113, }, ctx: Load, }, ), attr: Identifier { - id: "c", + id: Name( + "c", + ), range: 114..115, }, ctx: Load, @@ -159,7 +177,9 @@ Module( }, ], name: Identifier { - id: "f", + id: Name( + "f", + ), range: 120..121, }, type_params: None, @@ -196,7 +216,9 @@ Module( expression: Name( ExprName { range: 132..133, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -212,19 +234,25 @@ Module( value: Name( ExprName { range: 135..136, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), attr: Identifier { - id: "b", + id: Name( + "b", + ), range: 137..138, }, ctx: Load, }, ), attr: Identifier { - id: "c", + id: Name( + "c", + ), range: 139..140, }, ctx: Load, @@ -233,7 +261,9 @@ Module( }, ], name: Identifier { - id: "f", + id: Name( + "f", + ), range: 145..146, }, type_params: None, @@ -269,7 +299,9 @@ Module( expression: Name( ExprName { range: 157..158, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -310,19 +342,25 @@ Module( value: Name( ExprName { range: 167..168, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), attr: Identifier { - id: "b", + id: Name( + "b", + ), range: 169..170, }, ctx: Load, }, ), attr: Identifier { - id: "c", + id: Name( + "c", + ), range: 171..172, }, ctx: Load, @@ -331,7 +369,9 @@ Module( }, ], name: Identifier { - id: "T", + id: Name( + "T", + ), range: 179..180, }, type_params: None, @@ -363,7 +403,9 @@ Module( target: Name( ExprName { range: 189..190, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -392,14 +434,18 @@ Module( body: Name( ExprName { range: 197..198, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 212..213, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -421,7 +467,9 @@ Module( parameter: Parameter { range: 222..223, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 222..223, }, annotation: None, @@ -437,7 +485,9 @@ Module( body: Name( ExprName { range: 225..226, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -454,14 +504,18 @@ Module( Name( ExprName { range: 228..229, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 234..235, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -478,7 +532,9 @@ Module( Name( ExprName { range: 244..245, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -498,7 +554,9 @@ Module( value: Name( ExprName { range: 250..251, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -511,7 +569,9 @@ Module( value: Name( ExprName { range: 254..255, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -526,7 +586,9 @@ Module( }, ], name: Identifier { - id: "f", + id: Name( + "f", + ), range: 261..262, }, type_params: None, @@ -566,7 +628,9 @@ Module( left: Name( ExprName { range: 361..362, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -574,7 +638,9 @@ Module( right: Name( ExprName { range: 364..365, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -583,7 +649,9 @@ Module( }, ], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 370..373, }, type_params: None, @@ -620,7 +688,9 @@ Module( expression: Name( ExprName { range: 384..385, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -630,14 +700,18 @@ Module( expression: Name( ExprName { range: 389..390, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), }, ], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 397..400, }, type_params: None, diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@param_with_annotation.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@param_with_annotation.py.snap index 3790baafca212e..6ee1f6877b6f6b 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@param_with_annotation.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@param_with_annotation.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -28,14 +30,18 @@ Module( parameter: Parameter { range: 8..16, name: Identifier { - id: "arg", + id: Name( + "arg", + ), range: 8..11, }, annotation: Some( Name( ExprName { range: 13..16, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -69,7 +75,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 27..30, }, type_params: None, @@ -82,7 +90,9 @@ Module( parameter: Parameter { range: 31..47, name: Identifier { - id: "arg", + id: Name( + "arg", + ), range: 31..34, }, annotation: Some( @@ -99,7 +109,9 @@ Module( parameter: Parameter { range: 43..44, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 43..44, }, annotation: None, @@ -115,7 +127,9 @@ Module( body: Name( ExprName { range: 46..47, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -151,7 +165,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 58..61, }, type_params: None, @@ -164,7 +180,9 @@ Module( parameter: Parameter { range: 62..76, name: Identifier { - id: "arg", + id: Name( + "arg", + ), range: 62..65, }, annotation: Some( @@ -175,7 +193,9 @@ Module( Name( ExprName { range: 74..75, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -212,7 +232,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 87..90, }, type_params: None, @@ -225,7 +247,9 @@ Module( parameter: Parameter { range: 91..106, name: Identifier { - id: "arg", + id: Name( + "arg", + ), range: 91..94, }, annotation: Some( @@ -235,14 +259,18 @@ Module( target: Name( ExprName { range: 97..98, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), value: Name( ExprName { range: 102..105, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@param_with_default.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@param_with_default.py.snap index 7064b7751dfbd1..53d97caf484364 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@param_with_default.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@param_with_default.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -28,7 +30,9 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 8..9, }, annotation: None, @@ -47,7 +51,9 @@ Module( parameter: Parameter { range: 17..18, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 17..18, }, annotation: None, @@ -63,7 +69,9 @@ Module( body: Name( ExprName { range: 20..21, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -97,7 +105,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 32..35, }, type_params: None, @@ -110,7 +120,9 @@ Module( parameter: Parameter { range: 36..37, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 36..37, }, annotation: None, @@ -171,7 +183,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 65..68, }, type_params: None, @@ -184,7 +198,9 @@ Module( parameter: Parameter { range: 69..70, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 69..70, }, annotation: None, @@ -196,7 +212,9 @@ Module( value: Name( ExprName { range: 77..78, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -230,7 +248,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 89..92, }, type_params: None, @@ -243,7 +263,9 @@ Module( parameter: Parameter { range: 93..94, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 93..94, }, annotation: None, @@ -256,7 +278,9 @@ Module( Name( ExprName { range: 102..103, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@param_with_star_annotation.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@param_with_star_annotation.py.snap index ca04a14fb094a4..72211b88102131 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@param_with_star_annotation.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@param_with_star_annotation.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -27,7 +29,9 @@ Module( Parameter { range: 8..25, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 9..13, }, annotation: Some( @@ -40,7 +44,9 @@ Module( left: Name( ExprName { range: 16..19, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -48,7 +54,9 @@ Module( right: Name( ExprName { range: 22..25, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -84,7 +92,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 36..39, }, type_params: None, @@ -96,7 +106,9 @@ Module( Parameter { range: 40..60, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 41..45, }, annotation: Some( @@ -111,14 +123,18 @@ Module( Name( ExprName { range: 49..52, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), Name( ExprName { range: 56..59, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@params_non_default_after_star.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@params_non_default_after_star.py.snap index 50612e88137c78..79ae3b3368abc3 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@params_non_default_after_star.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@params_non_default_after_star.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -28,7 +30,9 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 8..9, }, annotation: None, @@ -52,7 +56,9 @@ Module( parameter: Parameter { range: 17..18, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 17..18, }, annotation: None, @@ -64,7 +70,9 @@ Module( parameter: Parameter { range: 20..21, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 20..21, }, annotation: None, @@ -85,7 +93,9 @@ Module( parameter: Parameter { range: 26..27, name: Identifier { - id: "d", + id: Name( + "d", + ), range: 26..27, }, annotation: None, @@ -116,7 +126,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 38..41, }, type_params: None, @@ -129,7 +141,9 @@ Module( parameter: Parameter { range: 42..43, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 42..43, }, annotation: None, @@ -150,7 +164,9 @@ Module( Parameter { range: 48..53, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 49..53, }, annotation: None, @@ -162,7 +178,9 @@ Module( parameter: Parameter { range: 55..56, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 55..56, }, annotation: None, @@ -174,7 +192,9 @@ Module( parameter: Parameter { range: 58..59, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 58..59, }, annotation: None, @@ -195,7 +215,9 @@ Module( parameter: Parameter { range: 64..65, name: Identifier { - id: "d", + id: Name( + "d", + ), range: 64..65, }, annotation: None, diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@params_seen_keyword_only_param_after_star.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@params_seen_keyword_only_param_after_star.py.snap index 94fa821efab7ce..26fc9b73f2934b 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@params_seen_keyword_only_param_after_star.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@params_seen_keyword_only_param_after_star.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 4..7, }, type_params: None, @@ -30,7 +32,9 @@ Module( parameter: Parameter { range: 11..12, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 11..12, }, annotation: None, @@ -42,7 +46,9 @@ Module( Parameter { range: 14..22, name: Identifier { - id: "kwargs", + id: Name( + "kwargs", + ), range: 16..22, }, annotation: None, @@ -70,7 +76,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 33..36, }, type_params: None, @@ -85,7 +93,9 @@ Module( parameter: Parameter { range: 40..41, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 40..41, }, annotation: None, @@ -106,7 +116,9 @@ Module( Parameter { range: 46..54, name: Identifier { - id: "kwargs", + id: Name( + "kwargs", + ), range: 48..54, }, annotation: None, diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@simple_stmts_in_block.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@simple_stmts_in_block.py.snap index fcef98b46ea4e9..f4706f9d99b56c 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@simple_stmts_in_block.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@simple_stmts_in_block.py.snap @@ -102,7 +102,9 @@ Module( Name( ExprName { range: 78..79, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@simple_stmts_with_semicolons.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@simple_stmts_with_semicolons.py.snap index 5cc4fa62554101..0114d957c0ed0c 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@simple_stmts_with_semicolons.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@simple_stmts_with_semicolons.py.snap @@ -22,7 +22,9 @@ Module( Alias { range: 15..16, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 15..16, }, asname: None, @@ -35,7 +37,9 @@ Module( range: 18..33, module: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 23..24, }, ), @@ -43,7 +47,9 @@ Module( Alias { range: 32..33, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 32..33, }, asname: None, @@ -58,7 +64,9 @@ Module( value: Name( ExprName { range: 35..36, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -70,7 +78,9 @@ Module( name: Name( ExprName { range: 43..44, - id: "T", + id: Name( + "T", + ), ctx: Store, }, ), @@ -78,7 +88,9 @@ Module( value: Name( ExprName { range: 47..50, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__ambiguous_lpar_with_items.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__ambiguous_lpar_with_items.py.snap index b17e20da0f7ab4..203da74a951149 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__ambiguous_lpar_with_items.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__ambiguous_lpar_with_items.py.snap @@ -19,7 +19,9 @@ Module( context_expr: Name( ExprName { range: 594..598, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -50,7 +52,9 @@ Module( context_expr: Name( ExprName { range: 611..615, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -81,7 +85,9 @@ Module( context_expr: Name( ExprName { range: 656..660, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -112,7 +118,9 @@ Module( context_expr: Name( ExprName { range: 675..680, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), @@ -123,7 +131,9 @@ Module( context_expr: Name( ExprName { range: 682..687, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -154,7 +164,9 @@ Module( context_expr: Name( ExprName { range: 700..705, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), @@ -165,7 +177,9 @@ Module( context_expr: Name( ExprName { range: 707..712, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -196,7 +210,9 @@ Module( context_expr: Name( ExprName { range: 752..757, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), @@ -207,7 +223,9 @@ Module( context_expr: Name( ExprName { range: 761..766, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -218,7 +236,9 @@ Module( context_expr: Name( ExprName { range: 769..774, - id: "item3", + id: Name( + "item3", + ), ctx: Load, }, ), @@ -226,7 +246,9 @@ Module( Name( ExprName { range: 778..779, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -237,7 +259,9 @@ Module( context_expr: Name( ExprName { range: 782..787, - id: "item4", + id: Name( + "item4", + ), ctx: Load, }, ), @@ -272,14 +296,18 @@ Module( Name( ExprName { range: 802..807, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), Name( ExprName { range: 809..814, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -295,7 +323,9 @@ Module( context_expr: Name( ExprName { range: 817..822, - id: "item3", + id: Name( + "item3", + ), ctx: Load, }, ), @@ -330,14 +360,18 @@ Module( Name( ExprName { range: 836..837, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 839..840, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -350,7 +384,9 @@ Module( Name( ExprName { range: 845..846, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -381,7 +417,9 @@ Module( context_expr: Name( ExprName { range: 859..864, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), @@ -389,7 +427,9 @@ Module( Name( ExprName { range: 868..870, - id: "f1", + id: Name( + "f1", + ), ctx: Store, }, ), @@ -400,7 +440,9 @@ Module( context_expr: Name( ExprName { range: 872..877, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -408,7 +450,9 @@ Module( Name( ExprName { range: 881..883, - id: "f2", + id: Name( + "f2", + ), ctx: Store, }, ), @@ -439,7 +483,9 @@ Module( context_expr: Name( ExprName { range: 896..901, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), @@ -447,7 +493,9 @@ Module( Name( ExprName { range: 905..907, - id: "f1", + id: Name( + "f1", + ), ctx: Store, }, ), @@ -458,7 +506,9 @@ Module( context_expr: Name( ExprName { range: 909..914, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -466,7 +516,9 @@ Module( Name( ExprName { range: 918..920, - id: "f2", + id: Name( + "f2", + ), ctx: Store, }, ), @@ -500,7 +552,9 @@ Module( left: Name( ExprName { range: 959..963, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -549,7 +603,9 @@ Module( target: Name( ExprName { range: 984..988, - id: "item", + id: Name( + "item", + ), ctx: Store, }, ), @@ -597,7 +653,9 @@ Module( target: Name( ExprName { range: 1009..1013, - id: "item", + id: Name( + "item", + ), ctx: Store, }, ), @@ -650,7 +708,9 @@ Module( value: Name( ExprName { range: 1036..1040, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -692,7 +752,9 @@ Module( target: Name( ExprName { range: 1056..1061, - id: "item1", + id: Name( + "item1", + ), ctx: Store, }, ), @@ -713,7 +775,9 @@ Module( context_expr: Name( ExprName { range: 1070..1075, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -744,7 +808,9 @@ Module( context_expr: Name( ExprName { range: 1088..1093, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), @@ -752,7 +818,9 @@ Module( Name( ExprName { range: 1097..1098, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -766,7 +834,9 @@ Module( target: Name( ExprName { range: 1101..1106, - id: "item2", + id: Name( + "item2", + ), ctx: Store, }, ), @@ -810,7 +880,9 @@ Module( func: Name( ExprName { range: 1126..1129, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -851,7 +923,9 @@ Module( func: Name( ExprName { range: 1144..1147, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -892,7 +966,9 @@ Module( func: Name( ExprName { range: 1163..1166, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -907,7 +983,9 @@ Module( Name( ExprName { range: 1172..1173, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -950,7 +1028,9 @@ Module( expression: Name( ExprName { range: 1189..1193, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -1025,7 +1105,9 @@ Module( target: Name( ExprName { range: 1218..1222, - id: "item", + id: Name( + "item", + ), ctx: Store, }, ), @@ -1086,7 +1168,9 @@ Module( elt: Name( ExprName { range: 1245..1246, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1096,7 +1180,9 @@ Module( target: Name( ExprName { range: 1251..1252, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -1106,7 +1192,9 @@ Module( func: Name( ExprName { range: 1256..1261, - id: "range", + id: Name( + "range", + ), ctx: Load, }, ), @@ -1140,7 +1228,9 @@ Module( context_expr: Name( ExprName { range: 1268..1272, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -1171,7 +1261,9 @@ Module( context_expr: Name( ExprName { range: 1285..1289, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -1185,7 +1277,9 @@ Module( elt: Name( ExprName { range: 1292..1293, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1195,7 +1289,9 @@ Module( target: Name( ExprName { range: 1298..1299, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -1205,7 +1301,9 @@ Module( func: Name( ExprName { range: 1303..1308, - id: "range", + id: Name( + "range", + ), ctx: Load, }, ), @@ -1259,7 +1357,9 @@ Module( context_expr: Name( ExprName { range: 1326..1330, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -1273,7 +1373,9 @@ Module( elt: Name( ExprName { range: 1333..1334, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1283,7 +1385,9 @@ Module( target: Name( ExprName { range: 1339..1340, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -1293,7 +1397,9 @@ Module( func: Name( ExprName { range: 1344..1349, - id: "range", + id: Name( + "range", + ), ctx: Load, }, ), @@ -1327,7 +1433,9 @@ Module( context_expr: Name( ExprName { range: 1356..1360, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -1361,7 +1469,9 @@ Module( value: Name( ExprName { range: 1373..1377, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -1424,7 +1534,9 @@ Module( value: Name( ExprName { range: 1395..1399, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -1461,7 +1573,9 @@ Module( Name( ExprName { range: 1408..1409, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -1495,7 +1609,9 @@ Module( elt: Name( ExprName { range: 1423..1424, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1505,14 +1621,18 @@ Module( target: Name( ExprName { range: 1429..1430, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), iter: Name( ExprName { range: 1434..1438, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), @@ -1527,7 +1647,9 @@ Module( Name( ExprName { range: 1443..1444, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -1558,7 +1680,9 @@ Module( context_expr: Name( ExprName { range: 1669..1673, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -1566,7 +1690,9 @@ Module( Name( ExprName { range: 1678..1679, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -1600,7 +1726,9 @@ Module( target: Name( ExprName { range: 1691..1695, - id: "item", + id: Name( + "item", + ), ctx: Store, }, ), @@ -1644,7 +1772,9 @@ Module( target: Name( ExprName { range: 1714..1718, - id: "item", + id: Name( + "item", + ), ctx: Store, }, ), @@ -1662,7 +1792,9 @@ Module( Name( ExprName { range: 1729..1730, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -1696,7 +1828,9 @@ Module( target: Name( ExprName { range: 1744..1748, - id: "item", + id: Name( + "item", + ), ctx: Store, }, ), @@ -1740,7 +1874,9 @@ Module( target: Name( ExprName { range: 1769..1774, - id: "item1", + id: Name( + "item1", + ), ctx: Store, }, ), @@ -1761,7 +1897,9 @@ Module( context_expr: Name( ExprName { range: 1783..1788, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -1801,7 +1939,9 @@ Module( left: Name( ExprName { range: 1800..1804, - id: "root", + id: Name( + "root", + ), ctx: Load, }, ), @@ -1809,14 +1949,18 @@ Module( right: Name( ExprName { range: 1807..1815, - id: "filename", + id: Name( + "filename", + ), ctx: Load, }, ), }, ), attr: Identifier { - id: "read", + id: Name( + "read", + ), range: 1817..1821, }, ctx: Load, @@ -1865,7 +2009,9 @@ Module( left: Name( ExprName { range: 1857..1861, - id: "root", + id: Name( + "root", + ), ctx: Load, }, ), @@ -1873,14 +2019,18 @@ Module( right: Name( ExprName { range: 1864..1872, - id: "filename", + id: Name( + "filename", + ), ctx: Load, }, ), }, ), attr: Identifier { - id: "read", + id: Name( + "read", + ), range: 1874..1878, }, ctx: Load, @@ -1897,7 +2047,9 @@ Module( Name( ExprName { range: 1884..1885, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -1931,7 +2083,9 @@ Module( func: Name( ExprName { range: 1919..1922, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -1972,7 +2126,9 @@ Module( func: Name( ExprName { range: 1959..1962, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -1987,7 +2143,9 @@ Module( Name( ExprName { range: 1969..1970, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -2021,7 +2179,9 @@ Module( func: Name( ExprName { range: 2004..2007, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), @@ -2036,7 +2196,9 @@ Module( Name( ExprName { range: 2014..2015, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -2070,7 +2232,9 @@ Module( value: Name( ExprName { range: 2027..2031, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -2107,7 +2271,9 @@ Module( Name( ExprName { range: 2041..2042, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -2257,7 +2423,9 @@ Module( Name( ExprName { range: 2114..2115, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -2288,7 +2456,9 @@ Module( context_expr: Name( ExprName { range: 2149..2154, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), @@ -2299,7 +2469,9 @@ Module( context_expr: Name( ExprName { range: 2158..2163, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -2333,7 +2505,9 @@ Module( func: Name( ExprName { range: 2176..2180, - id: "open", + id: Name( + "open", + ), ctx: Load, }, ), @@ -2373,7 +2547,9 @@ Module( func: Name( ExprName { range: 2192..2196, - id: "open", + id: Name( + "open", + ), ctx: Load, }, ), @@ -2434,7 +2610,9 @@ Module( Name( ExprName { range: 2223..2224, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -2472,7 +2650,9 @@ Module( Name( ExprName { range: 2244..2245, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -2509,7 +2689,9 @@ Module( value: Name( ExprName { range: 2270..2271, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -2545,7 +2727,9 @@ Module( value: Name( ExprName { range: 2296..2297, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -2582,7 +2766,9 @@ Module( Name( ExprName { range: 2317..2318, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -2593,7 +2779,9 @@ Module( Name( ExprName { range: 2323..2324, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -2632,7 +2820,9 @@ Module( Name( ExprName { range: 2342..2343, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -2648,7 +2838,9 @@ Module( Name( ExprName { range: 2349..2350, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -2720,7 +2912,9 @@ Module( Name( ExprName { range: 2765..2766, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -2758,7 +2952,9 @@ Module( target: Name( ExprName { range: 2778..2782, - id: "item", + id: Name( + "item", + ), ctx: Store, }, ), @@ -2819,7 +3015,9 @@ Module( target: Name( ExprName { range: 2805..2809, - id: "item", + id: Name( + "item", + ), ctx: Store, }, ), @@ -2872,7 +3070,9 @@ Module( target: Name( ExprName { range: 2827..2832, - id: "item1", + id: Name( + "item1", + ), ctx: Store, }, ), @@ -2889,7 +3089,9 @@ Module( Name( ExprName { range: 2840..2845, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -2929,7 +3131,9 @@ Module( Name( ExprName { range: 2858..2863, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), @@ -2939,7 +3143,9 @@ Module( target: Name( ExprName { range: 2865..2870, - id: "item2", + id: Name( + "item2", + ), ctx: Store, }, ), @@ -2956,7 +3162,9 @@ Module( Name( ExprName { range: 2877..2882, - id: "item3", + id: Name( + "item3", + ), ctx: Load, }, ), @@ -2969,7 +3177,9 @@ Module( Name( ExprName { range: 2887..2888, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -3004,7 +3214,9 @@ Module( Name( ExprName { range: 2900..2904, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -3017,7 +3229,9 @@ Module( Name( ExprName { range: 2910..2911, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -3055,7 +3269,9 @@ Module( value: Name( ExprName { range: 2924..2928, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -3101,7 +3317,9 @@ Module( value: Name( ExprName { range: 2943..2947, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -3117,7 +3335,9 @@ Module( Name( ExprName { range: 2953..2954, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -3152,14 +3372,18 @@ Module( Name( ExprName { range: 2966..2971, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), Name( ExprName { range: 2973..2978, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -3172,7 +3396,9 @@ Module( Name( ExprName { range: 2983..2984, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -3207,14 +3433,18 @@ Module( Name( ExprName { range: 2996..3001, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), Name( ExprName { range: 3003..3008, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -3227,7 +3457,9 @@ Module( Name( ExprName { range: 3014..3015, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -3262,14 +3494,18 @@ Module( Name( ExprName { range: 3027..3032, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), Name( ExprName { range: 3034..3039, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -3285,7 +3521,9 @@ Module( context_expr: Name( ExprName { range: 3042..3047, - id: "item3", + id: Name( + "item3", + ), ctx: Load, }, ), @@ -3324,14 +3562,18 @@ Module( Name( ExprName { range: 3060..3065, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), Name( ExprName { range: 3067..3072, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -3343,7 +3585,9 @@ Module( Name( ExprName { range: 3075..3080, - id: "item3", + id: Name( + "item3", + ), ctx: Load, }, ), @@ -3356,7 +3600,9 @@ Module( Name( ExprName { range: 3085..3086, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -3391,7 +3637,9 @@ Module( Name( ExprName { range: 3098..3103, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), @@ -3407,7 +3655,9 @@ Module( context_expr: Name( ExprName { range: 3107..3112, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -3422,14 +3672,18 @@ Module( Name( ExprName { range: 3115..3120, - id: "item3", + id: Name( + "item3", + ), ctx: Load, }, ), Name( ExprName { range: 3122..3127, - id: "item4", + id: Name( + "item4", + ), ctx: Load, }, ), @@ -3442,7 +3696,9 @@ Module( Name( ExprName { range: 3132..3133, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -3477,14 +3733,18 @@ Module( Name( ExprName { range: 3145..3150, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), Name( ExprName { range: 3152..3157, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -3497,7 +3757,9 @@ Module( Name( ExprName { range: 3162..3164, - id: "f1", + id: Name( + "f1", + ), ctx: Store, }, ), @@ -3508,7 +3770,9 @@ Module( context_expr: Name( ExprName { range: 3166..3171, - id: "item3", + id: Name( + "item3", + ), ctx: Load, }, ), @@ -3516,7 +3780,9 @@ Module( Name( ExprName { range: 3175..3177, - id: "f2", + id: Name( + "f2", + ), ctx: Store, }, ), @@ -3551,7 +3817,9 @@ Module( Name( ExprName { range: 3189..3194, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), @@ -3561,7 +3829,9 @@ Module( value: Name( ExprName { range: 3197..3202, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -3604,7 +3874,9 @@ Module( Name( ExprName { range: 3215..3220, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), @@ -3614,7 +3886,9 @@ Module( value: Name( ExprName { range: 3223..3228, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -3630,7 +3904,9 @@ Module( Name( ExprName { range: 3233..3234, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -3668,7 +3944,9 @@ Module( target: Name( ExprName { range: 3246..3251, - id: "item1", + id: Name( + "item1", + ), ctx: Store, }, ), @@ -3688,7 +3966,9 @@ Module( value: Name( ExprName { range: 3260..3265, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -3734,7 +4014,9 @@ Module( target: Name( ExprName { range: 3279..3284, - id: "item1", + id: Name( + "item1", + ), ctx: Store, }, ), @@ -3754,7 +4036,9 @@ Module( value: Name( ExprName { range: 3294..3299, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -3796,7 +4080,9 @@ Module( elt: Name( ExprName { range: 3516..3517, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -3806,7 +4092,9 @@ Module( target: Name( ExprName { range: 3522..3523, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -3816,7 +4104,9 @@ Module( func: Name( ExprName { range: 3527..3532, - id: "range", + id: Name( + "range", + ), ctx: Load, }, ), @@ -3873,7 +4163,9 @@ Module( elt: Name( ExprName { range: 3549..3550, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -3883,7 +4175,9 @@ Module( target: Name( ExprName { range: 3561..3562, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -3893,7 +4187,9 @@ Module( func: Name( ExprName { range: 3566..3571, - id: "range", + id: Name( + "range", + ), ctx: Load, }, ), @@ -3950,7 +4246,9 @@ Module( elt: Name( ExprName { range: 3588..3589, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -3960,7 +4258,9 @@ Module( target: Name( ExprName { range: 3594..3595, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -3970,7 +4270,9 @@ Module( func: Name( ExprName { range: 3599..3604, - id: "range", + id: Name( + "range", + ), ctx: Load, }, ), @@ -4004,7 +4306,9 @@ Module( context_expr: Name( ExprName { range: 3611..3615, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__annotated_assignment.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__annotated_assignment.py.snap index e8e067797ddce7..6f96b2bb137232 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__annotated_assignment.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__annotated_assignment.py.snap @@ -15,14 +15,18 @@ Module( target: Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), annotation: Name( ExprName { range: 3..6, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -36,14 +40,18 @@ Module( target: Name( ExprName { range: 7..8, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), annotation: Name( ExprName { range: 10..13, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -66,7 +74,9 @@ Module( target: Name( ExprName { range: 19..20, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -102,7 +112,9 @@ Module( target: Name( ExprName { range: 29..30, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -115,14 +127,18 @@ Module( value: Name( ExprName { range: 32..37, - id: "tuple", + id: Name( + "tuple", + ), ctx: Load, }, ), slice: Name( ExprName { range: 38..41, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -133,7 +149,9 @@ Module( right: Name( ExprName { range: 45..48, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -167,7 +185,9 @@ Module( target: Name( ExprName { range: 56..57, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -183,14 +203,18 @@ Module( body: Name( ExprName { range: 59..62, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 76..79, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -215,7 +239,9 @@ Module( target: Name( ExprName { range: 84..85, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -232,7 +258,9 @@ Module( parameter: Parameter { range: 94..95, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 94..95, }, annotation: None, @@ -248,7 +276,9 @@ Module( body: Name( ExprName { range: 97..98, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__assert.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__assert.py.snap index 28fa1f948839fd..c39617ab43b024 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__assert.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__assert.py.snap @@ -50,7 +50,9 @@ Module( func: Name( ExprName { range: 20..24, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -75,14 +77,18 @@ Module( Name( ExprName { range: 34..35, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 40..41, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -108,7 +114,9 @@ Module( parameter: Parameter { range: 56..57, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 56..57, }, annotation: None, @@ -124,7 +132,9 @@ Module( body: Name( ExprName { range: 59..60, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -142,7 +152,9 @@ Module( value: Name( ExprName { range: 74..75, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -166,14 +178,18 @@ Module( body: Name( ExprName { range: 83..84, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 98..99, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -188,7 +204,9 @@ Module( test: Name( ExprName { range: 108..109, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -220,7 +238,9 @@ Module( test: Name( ExprName { range: 126..127, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -238,7 +258,9 @@ Module( parameter: Parameter { range: 136..137, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 136..137, }, annotation: None, @@ -254,7 +276,9 @@ Module( body: Name( ExprName { range: 139..140, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -269,7 +293,9 @@ Module( test: Name( ExprName { range: 148..149, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -280,7 +306,9 @@ Module( value: Name( ExprName { range: 157..158, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -295,7 +323,9 @@ Module( test: Name( ExprName { range: 166..167, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -312,14 +342,18 @@ Module( body: Name( ExprName { range: 169..170, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 184..185, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__assignment.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__assignment.py.snap index fc6bd9d7b8d5e7..dc175c7f1eafac 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__assignment.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__assignment.py.snap @@ -16,7 +16,9 @@ Module( Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -67,14 +69,18 @@ Module( Name( ExprName { range: 16..17, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), Name( ExprName { range: 19..20, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -130,14 +136,18 @@ Module( Name( ExprName { range: 36..37, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), Name( ExprName { range: 39..40, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -191,12 +201,16 @@ Module( value: Name( ExprName { range: 55..56, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), attr: Identifier { - id: "y", + id: Name( + "y", + ), range: 57..58, }, ctx: Store, @@ -248,14 +262,18 @@ Module( value: Name( ExprName { range: 72..73, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), slice: Name( ExprName { range: 74..75, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -309,7 +327,9 @@ Module( Name( ExprName { range: 91..92, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -319,7 +339,9 @@ Module( value: Name( ExprName { range: 95..96, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -377,7 +399,9 @@ Module( value: Name( ExprName { range: 260..263, - id: "foo", + id: Name( + "foo", + ), ctx: Store, }, ), @@ -406,21 +430,27 @@ Module( Name( ExprName { range: 271..272, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), Name( ExprName { range: 274..275, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), Name( ExprName { range: 277..278, - id: "z", + id: Name( + "z", + ), ctx: Store, }, ), @@ -474,21 +504,27 @@ Module( Name( ExprName { range: 294..295, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), Name( ExprName { range: 297..298, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), Name( ExprName { range: 300..301, - id: "z", + id: Name( + "z", + ), ctx: Store, }, ), @@ -543,7 +579,9 @@ Module( value: Name( ExprName { range: 315..316, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -616,7 +654,9 @@ Module( value: Name( ExprName { range: 431..432, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -741,12 +781,16 @@ Module( value: Name( ExprName { range: 555..558, - id: "foo", + id: Name( + "foo", + ), ctx: Load, }, ), attr: Identifier { - id: "bar", + id: Name( + "bar", + ), range: 559..562, }, ctx: Store, @@ -789,7 +833,9 @@ Module( }, ), attr: Identifier { - id: "y", + id: Name( + "y", + ), range: 675..676, }, ctx: Store, @@ -813,7 +859,9 @@ Module( Name( ExprName { range: 683..686, - id: "foo", + id: Name( + "foo", + ), ctx: Store, }, ), @@ -846,7 +894,9 @@ Module( value: Name( ExprName { range: 699..703, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -874,7 +924,9 @@ Module( value: Name( ExprName { range: 710..714, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -894,14 +946,18 @@ Module( Name( ExprName { range: 715..716, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), Name( ExprName { range: 718..719, - id: "b", + id: Name( + "b", + ), ctx: Store, }, ), @@ -914,7 +970,9 @@ Module( value: Name( ExprName { range: 722..724, - id: "ab", + id: Name( + "ab", + ), ctx: Load, }, ), @@ -927,14 +985,18 @@ Module( Name( ExprName { range: 725..726, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), Name( ExprName { range: 729..730, - id: "b", + id: Name( + "b", + ), ctx: Store, }, ), @@ -942,7 +1004,9 @@ Module( value: Name( ExprName { range: 733..734, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__augmented_assignment.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__augmented_assignment.py.snap index 1e995986d3491a..d0a26858fd1fc1 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__augmented_assignment.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__augmented_assignment.py.snap @@ -15,7 +15,9 @@ Module( target: Name( ExprName { range: 0..1, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -39,12 +41,16 @@ Module( value: Name( ExprName { range: 7..8, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), attr: Identifier { - id: "y", + id: Name( + "y", + ), range: 9..10, }, ctx: Store, @@ -95,14 +101,18 @@ Module( value: Name( ExprName { range: 24..25, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), slice: Name( ExprName { range: 26..27, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -151,7 +161,9 @@ Module( target: Name( ExprName { range: 86..87, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -172,7 +184,9 @@ Module( target: Name( ExprName { range: 93..94, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -193,7 +207,9 @@ Module( target: Name( ExprName { range: 100..101, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -214,7 +230,9 @@ Module( target: Name( ExprName { range: 107..108, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -235,7 +253,9 @@ Module( target: Name( ExprName { range: 114..115, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -256,7 +276,9 @@ Module( target: Name( ExprName { range: 122..123, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -277,7 +299,9 @@ Module( target: Name( ExprName { range: 129..130, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -298,7 +322,9 @@ Module( target: Name( ExprName { range: 137..138, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -319,7 +345,9 @@ Module( target: Name( ExprName { range: 144..145, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -340,7 +368,9 @@ Module( target: Name( ExprName { range: 151..152, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -361,7 +391,9 @@ Module( target: Name( ExprName { range: 158..159, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -382,7 +414,9 @@ Module( target: Name( ExprName { range: 166..167, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -403,7 +437,9 @@ Module( target: Name( ExprName { range: 174..175, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -424,7 +460,9 @@ Module( target: Name( ExprName { range: 190..191, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), @@ -438,7 +476,9 @@ Module( left: Name( ExprName { range: 197..198, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -446,7 +486,9 @@ Module( right: Name( ExprName { range: 201..202, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -459,7 +501,9 @@ Module( left: Name( ExprName { range: 206..207, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__class.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__class.py.snap index 0da461c58410c4..c1a77075a1fbe7 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__class.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__class.py.snap @@ -14,7 +14,9 @@ Module( range: 0..19, decorator_list: [], name: Identifier { - id: "Test", + id: Name( + "Test", + ), range: 6..10, }, type_params: None, @@ -38,7 +40,9 @@ Module( range: 22..80, decorator_list: [], name: Identifier { - id: "Test", + id: Name( + "Test", + ), range: 28..32, }, type_params: None, @@ -56,7 +60,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "__init__", + id: Name( + "__init__", + ), range: 48..56, }, type_params: None, @@ -69,7 +75,9 @@ Module( parameter: Parameter { range: 57..61, name: Identifier { - id: "self", + id: Name( + "self", + ), range: 57..61, }, annotation: None, @@ -99,7 +107,9 @@ Module( range: 83..116, decorator_list: [], name: Identifier { - id: "Test", + id: Name( + "Test", + ), range: 89..93, }, type_params: None, @@ -113,7 +123,9 @@ Module( value: Name( ExprName { range: 100..101, - id: "A", + id: Name( + "A", + ), ctx: Load, }, ), @@ -126,7 +138,9 @@ Module( range: 94..97, arg: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 94..95, }, ), @@ -145,7 +159,9 @@ Module( value: Name( ExprName { range: 105..106, - id: "k", + id: Name( + "k", + ), ctx: Load, }, ), @@ -172,7 +188,9 @@ Module( range: 119..168, decorator_list: [], name: Identifier { - id: "Test", + id: Name( + "Test", + ), range: 125..129, }, type_params: None, @@ -184,7 +202,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "method", + id: Name( + "method", + ), range: 139..145, }, type_params: None, @@ -209,14 +229,18 @@ Module( Name( ExprName { range: 157..158, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), Name( ExprName { range: 160..161, - id: "b", + id: Name( + "b", + ), ctx: Store, }, ), @@ -229,7 +253,9 @@ Module( value: Name( ExprName { range: 164..168, - id: "data", + id: Name( + "data", + ), ctx: Load, }, ), @@ -246,7 +272,9 @@ Module( range: 171..289, decorator_list: [], name: Identifier { - id: "Test", + id: Name( + "Test", + ), range: 177..181, }, type_params: None, @@ -257,14 +285,18 @@ Module( Name( ExprName { range: 182..183, - id: "A", + id: Name( + "A", + ), ctx: Load, }, ), Name( ExprName { range: 185..186, - id: "B", + id: Name( + "B", + ), ctx: Load, }, ), @@ -279,7 +311,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "__init__", + id: Name( + "__init__", + ), range: 197..205, }, type_params: None, @@ -292,7 +326,9 @@ Module( parameter: Parameter { range: 206..210, name: Identifier { - id: "self", + id: Name( + "self", + ), range: 206..210, }, annotation: None, @@ -320,7 +356,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "method_with_default", + id: Name( + "method_with_default", + ), range: 235..254, }, type_params: None, @@ -333,7 +371,9 @@ Module( parameter: Parameter { range: 255..259, name: Identifier { - id: "self", + id: Name( + "self", + ), range: 255..259, }, annotation: None, @@ -345,7 +385,9 @@ Module( parameter: Parameter { range: 261..264, name: Identifier { - id: "arg", + id: Name( + "arg", + ), range: 261..264, }, annotation: None, @@ -394,7 +436,9 @@ Module( range: 331..351, decorator_list: [], name: Identifier { - id: "Test", + id: Name( + "Test", + ), range: 337..341, }, type_params: Some( @@ -405,7 +449,9 @@ Module( TypeParamTypeVar { range: 342..343, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 342..343, }, bound: None, @@ -441,7 +487,9 @@ Module( range: 376..402, decorator_list: [], name: Identifier { - id: "Test", + id: Name( + "Test", + ), range: 382..386, }, type_params: Some( @@ -452,7 +500,9 @@ Module( TypeParamTypeVar { range: 387..394, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 387..388, }, bound: None, @@ -460,7 +510,9 @@ Module( Name( ExprName { range: 391..394, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -496,7 +548,9 @@ Module( range: 425..450, decorator_list: [], name: Identifier { - id: "Test", + id: Name( + "Test", + ), range: 431..435, }, type_params: Some( @@ -507,14 +561,18 @@ Module( TypeParamTypeVar { range: 436..442, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 436..437, }, bound: Some( Name( ExprName { range: 439..442, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -551,7 +609,9 @@ Module( range: 485..522, decorator_list: [], name: Identifier { - id: "Test", + id: Name( + "Test", + ), range: 491..495, }, type_params: Some( @@ -562,7 +622,9 @@ Module( TypeParamTypeVar { range: 496..514, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 496..497, }, bound: Some( @@ -572,7 +634,9 @@ Module( left: Name( ExprName { range: 499..502, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -580,7 +644,9 @@ Module( right: Name( ExprName { range: 505..508, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -591,7 +657,9 @@ Module( Name( ExprName { range: 511..514, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -627,7 +695,9 @@ Module( range: 551..585, decorator_list: [], name: Identifier { - id: "Test", + id: Name( + "Test", + ), range: 557..561, }, type_params: Some( @@ -638,7 +708,9 @@ Module( TypeParamTypeVar { range: 562..577, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 562..563, }, bound: Some( @@ -649,14 +721,18 @@ Module( Name( ExprName { range: 566..569, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), Name( ExprName { range: 571..576, - id: "bytes", + id: Name( + "bytes", + ), ctx: Load, }, ), @@ -698,7 +774,9 @@ Module( range: 606..629, decorator_list: [], name: Identifier { - id: "Test", + id: Name( + "Test", + ), range: 612..616, }, type_params: Some( @@ -709,7 +787,9 @@ Module( TypeParamTypeVar { range: 617..618, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 617..618, }, bound: None, @@ -720,7 +800,9 @@ Module( TypeParamTypeVar { range: 620..621, name: Identifier { - id: "U", + id: Name( + "U", + ), range: 620..621, }, bound: None, @@ -756,7 +838,9 @@ Module( range: 648..672, decorator_list: [], name: Identifier { - id: "Test", + id: Name( + "Test", + ), range: 654..658, }, type_params: Some( @@ -767,7 +851,9 @@ Module( TypeParamTypeVar { range: 659..660, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 659..660, }, bound: None, @@ -778,7 +864,9 @@ Module( TypeParamTypeVar { range: 662..663, name: Identifier { - id: "U", + id: Name( + "U", + ), range: 662..663, }, bound: None, @@ -814,7 +902,9 @@ Module( range: 689..711, decorator_list: [], name: Identifier { - id: "Test", + id: Name( + "Test", + ), range: 695..699, }, type_params: Some( @@ -825,7 +915,9 @@ Module( TypeParamTypeVarTuple { range: 700..703, name: Identifier { - id: "Ts", + id: Name( + "Ts", + ), range: 701..703, }, default: None, @@ -860,7 +952,9 @@ Module( range: 741..789, decorator_list: [], name: Identifier { - id: "Test", + id: Name( + "Test", + ), range: 747..751, }, type_params: Some( @@ -871,7 +965,9 @@ Module( TypeParamTypeVarTuple { range: 752..781, name: Identifier { - id: "Ts", + id: Name( + "Ts", + ), range: 753..755, }, default: Some( @@ -881,7 +977,9 @@ Module( value: Name( ExprName { range: 758..764, - id: "Unpack", + id: Name( + "Unpack", + ), ctx: Load, }, ), @@ -891,7 +989,9 @@ Module( value: Name( ExprName { range: 765..770, - id: "tuple", + id: Name( + "tuple", + ), ctx: Load, }, ), @@ -902,14 +1002,18 @@ Module( Name( ExprName { range: 771..774, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), Name( ExprName { range: 776..779, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -956,7 +1060,9 @@ Module( range: 827..868, decorator_list: [], name: Identifier { - id: "Test", + id: Name( + "Test", + ), range: 833..837, }, type_params: Some( @@ -967,7 +1073,9 @@ Module( TypeParamTypeVarTuple { range: 838..860, name: Identifier { - id: "Ts", + id: Name( + "Ts", + ), range: 839..841, }, default: Some( @@ -980,7 +1088,9 @@ Module( value: Name( ExprName { range: 845..850, - id: "tuple", + id: Name( + "tuple", + ), ctx: Load, }, ), @@ -991,14 +1101,18 @@ Module( Name( ExprName { range: 851..854, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), Name( ExprName { range: 856..859, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -1045,7 +1159,9 @@ Module( range: 882..904, decorator_list: [], name: Identifier { - id: "Test", + id: Name( + "Test", + ), range: 888..892, }, type_params: Some( @@ -1056,7 +1172,9 @@ Module( TypeParamParamSpec { range: 893..896, name: Identifier { - id: "P", + id: Name( + "P", + ), range: 895..896, }, default: None, @@ -1091,7 +1209,9 @@ Module( range: 931..966, decorator_list: [], name: Identifier { - id: "Test", + id: Name( + "Test", + ), range: 937..941, }, type_params: Some( @@ -1102,7 +1222,9 @@ Module( TypeParamParamSpec { range: 942..958, name: Identifier { - id: "P", + id: Name( + "P", + ), range: 944..945, }, default: Some( @@ -1113,14 +1235,18 @@ Module( Name( ExprName { range: 949..952, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), Name( ExprName { range: 954..957, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -1160,7 +1286,9 @@ Module( range: 982..1022, decorator_list: [], name: Identifier { - id: "Test", + id: Name( + "Test", + ), range: 988..992, }, type_params: Some( @@ -1171,7 +1299,9 @@ Module( TypeParamTypeVar { range: 993..994, name: Identifier { - id: "X", + id: Name( + "X", + ), range: 993..994, }, bound: None, @@ -1182,14 +1312,18 @@ Module( TypeParamTypeVar { range: 996..1002, name: Identifier { - id: "Y", + id: Name( + "Y", + ), range: 996..997, }, bound: Some( Name( ExprName { range: 999..1002, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -1201,7 +1335,9 @@ Module( TypeParamTypeVarTuple { range: 1004..1006, name: Identifier { - id: "U", + id: Name( + "U", + ), range: 1005..1006, }, default: None, @@ -1211,7 +1347,9 @@ Module( TypeParamParamSpec { range: 1008..1011, name: Identifier { - id: "P", + id: Name( + "P", + ), range: 1010..1011, }, default: None, diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__delete.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__delete.py.snap index 68494f46813724..c675ca303cc932 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__delete.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__delete.py.snap @@ -16,7 +16,9 @@ Module( Name( ExprName { range: 4..5, - id: "x", + id: Name( + "x", + ), ctx: Del, }, ), @@ -30,7 +32,9 @@ Module( Name( ExprName { range: 11..12, - id: "x", + id: Name( + "x", + ), ctx: Del, }, ), @@ -44,14 +48,18 @@ Module( Name( ExprName { range: 18..19, - id: "a", + id: Name( + "a", + ), ctx: Del, }, ), Name( ExprName { range: 21..22, - id: "b", + id: Name( + "b", + ), ctx: Del, }, ), @@ -65,7 +73,9 @@ Module( Name( ExprName { range: 28..29, - id: "a", + id: Name( + "a", + ), ctx: Del, }, ), @@ -76,14 +86,18 @@ Module( Name( ExprName { range: 32..33, - id: "b", + id: Name( + "b", + ), ctx: Del, }, ), Name( ExprName { range: 35..36, - id: "c", + id: Name( + "c", + ), ctx: Del, }, ), @@ -95,7 +109,9 @@ Module( Name( ExprName { range: 39..40, - id: "d", + id: Name( + "d", + ), ctx: Del, }, ), @@ -113,14 +129,18 @@ Module( Name( ExprName { range: 46..47, - id: "a", + id: Name( + "a", + ), ctx: Del, }, ), Name( ExprName { range: 49..50, - id: "b", + id: Name( + "b", + ), ctx: Del, }, ), @@ -142,7 +162,9 @@ Module( Name( ExprName { range: 57..58, - id: "a", + id: Name( + "a", + ), ctx: Del, }, ), @@ -153,14 +175,18 @@ Module( Name( ExprName { range: 61..62, - id: "b", + id: Name( + "b", + ), ctx: Del, }, ), Name( ExprName { range: 64..65, - id: "c", + id: Name( + "c", + ), ctx: Del, }, ), @@ -171,7 +197,9 @@ Module( Name( ExprName { range: 68..69, - id: "d", + id: Name( + "d", + ), ctx: Del, }, ), @@ -192,12 +220,16 @@ Module( value: Name( ExprName { range: 75..76, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), attr: Identifier { - id: "y", + id: Name( + "y", + ), range: 77..78, }, ctx: Del, @@ -216,14 +248,18 @@ Module( value: Name( ExprName { range: 83..84, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), slice: Name( ExprName { range: 85..86, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -244,7 +280,9 @@ Module( Name( ExprName { range: 98..99, - id: "x", + id: Name( + "x", + ), ctx: Del, }, ), @@ -254,12 +292,16 @@ Module( value: Name( ExprName { range: 105..106, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), attr: Identifier { - id: "y", + id: Name( + "y", + ), range: 107..108, }, ctx: Del, @@ -271,14 +313,18 @@ Module( value: Name( ExprName { range: 114..115, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), slice: Name( ExprName { range: 116..117, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__for.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__for.py.snap index 2eaca10f37a7cf..b87de765539d12 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__for.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__for.py.snap @@ -16,14 +16,18 @@ Module( target: Name( ExprName { range: 4..10, - id: "target", + id: Name( + "target", + ), ctx: Store, }, ), iter: Name( ExprName { range: 14..18, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), @@ -44,7 +48,9 @@ Module( target: Name( ExprName { range: 34..40, - id: "target", + id: Name( + "target", + ), ctx: Store, }, ), @@ -101,12 +107,16 @@ Module( value: Name( ExprName { range: 69..75, - id: "target", + id: Name( + "target", + ), ctx: Load, }, ), attr: Identifier { - id: "attr", + id: Name( + "attr", + ), range: 76..80, }, ctx: Store, @@ -118,7 +128,9 @@ Module( func: Name( ExprName { range: 84..88, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -149,7 +161,9 @@ Module( value: Name( ExprName { range: 106..112, - id: "target", + id: Name( + "target", + ), ctx: Load, }, ), @@ -170,12 +184,16 @@ Module( value: Name( ExprName { range: 119..120, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), attr: Identifier { - id: "attr", + id: Name( + "attr", + ), range: 121..125, }, ctx: Load, @@ -198,7 +216,9 @@ Module( target: Name( ExprName { range: 141..147, - id: "target", + id: Name( + "target", + ), ctx: Store, }, ), @@ -208,7 +228,9 @@ Module( left: Name( ExprName { range: 151..152, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -219,7 +241,9 @@ Module( Name( ExprName { range: 156..157, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -243,7 +267,9 @@ Module( target: Name( ExprName { range: 173..179, - id: "target", + id: Name( + "target", + ), ctx: Store, }, ), @@ -255,14 +281,18 @@ Module( Name( ExprName { range: 183..184, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 189..190, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -290,21 +320,27 @@ Module( Name( ExprName { range: 206..207, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), Name( ExprName { range: 209..210, - id: "b", + id: Name( + "b", + ), ctx: Store, }, ), Name( ExprName { range: 212..213, - id: "c", + id: Name( + "c", + ), ctx: Store, }, ), @@ -316,7 +352,9 @@ Module( iter: Name( ExprName { range: 218..222, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), @@ -341,14 +379,18 @@ Module( Name( ExprName { range: 239..240, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), Name( ExprName { range: 242..243, - id: "b", + id: Name( + "b", + ), ctx: Store, }, ), @@ -360,7 +402,9 @@ Module( iter: Name( ExprName { range: 248..252, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), @@ -381,7 +425,9 @@ Module( target: Name( ExprName { range: 268..274, - id: "target", + id: Name( + "target", + ), ctx: Store, }, ), @@ -394,12 +440,16 @@ Module( value: Name( ExprName { range: 279..280, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), attr: Identifier { - id: "attr", + id: Name( + "attr", + ), range: 281..285, }, ctx: Load, @@ -425,7 +475,9 @@ Module( target: Name( ExprName { range: 301..307, - id: "target", + id: Name( + "target", + ), ctx: Store, }, ), @@ -473,7 +525,9 @@ Module( value: Name( ExprName { range: 334..340, - id: "target", + id: Name( + "target", + ), ctx: Store, }, ), @@ -487,21 +541,27 @@ Module( Name( ExprName { range: 344..345, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 347..348, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), Name( ExprName { range: 350..351, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -533,7 +593,9 @@ Module( target: Name( ExprName { range: 383..389, - id: "target", + id: Name( + "target", + ), ctx: Store, }, ), @@ -546,7 +608,9 @@ Module( left: Name( ExprName { range: 394..395, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -554,7 +618,9 @@ Module( right: Name( ExprName { range: 398..399, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -585,7 +651,9 @@ Module( target: Name( ExprName { range: 409..415, - id: "target", + id: Name( + "target", + ), ctx: Store, }, ), @@ -598,7 +666,9 @@ Module( value: Name( ExprName { range: 426..427, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -629,7 +699,9 @@ Module( target: Name( ExprName { range: 437..443, - id: "target", + id: Name( + "target", + ), ctx: Store, }, ), @@ -639,7 +711,9 @@ Module( value: Name( ExprName { range: 453..454, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -667,7 +741,9 @@ Module( target: Name( ExprName { range: 464..470, - id: "target", + id: Name( + "target", + ), ctx: Store, }, ), @@ -684,7 +760,9 @@ Module( parameter: Parameter { range: 481..482, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 481..482, }, annotation: None, @@ -700,7 +778,9 @@ Module( body: Name( ExprName { range: 484..485, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -728,7 +808,9 @@ Module( target: Name( ExprName { range: 495..501, - id: "target", + id: Name( + "target", + ), ctx: Store, }, ), @@ -744,14 +826,18 @@ Module( body: Name( ExprName { range: 505..506, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 520..521, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -778,7 +864,9 @@ Module( test: Name( ExprName { range: 531..532, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -790,14 +878,18 @@ Module( target: Name( ExprName { range: 542..548, - id: "target", + id: Name( + "target", + ), ctx: Store, }, ), iter: Name( ExprName { range: 552..556, - id: "iter", + id: Name( + "iter", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__from_import.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__from_import.py.snap index 4e64f74abfb30d..0fa534e9ec864b 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__from_import.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__from_import.py.snap @@ -14,7 +14,9 @@ Module( range: 0..15, module: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 5..6, }, ), @@ -22,7 +24,9 @@ Module( Alias { range: 14..15, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 14..15, }, asname: None, @@ -39,7 +43,9 @@ Module( Alias { range: 41..42, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 41..42, }, asname: None, @@ -53,7 +59,9 @@ Module( range: 43..85, module: Some( Identifier { - id: "foo.bar", + id: Name( + "foo.bar", + ), range: 48..55, }, ), @@ -61,12 +69,16 @@ Module( Alias { range: 63..71, name: Identifier { - id: "baz", + id: Name( + "baz", + ), range: 63..66, }, asname: Some( Identifier { - id: "b", + id: Name( + "b", + ), range: 70..71, }, ), @@ -74,12 +86,16 @@ Module( Alias { range: 73..85, name: Identifier { - id: "FooBar", + id: Name( + "FooBar", + ), range: 73..79, }, asname: Some( Identifier { - id: "fb", + id: Name( + "fb", + ), range: 83..85, }, ), @@ -93,7 +109,9 @@ Module( range: 86..102, module: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 92..93, }, ), @@ -101,7 +119,9 @@ Module( Alias { range: 101..102, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 101..102, }, asname: None, @@ -118,7 +138,9 @@ Module( Alias { range: 119..120, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 119..120, }, asname: None, @@ -135,7 +157,9 @@ Module( Alias { range: 160..161, name: Identifier { - id: "d", + id: Name( + "d", + ), range: 160..161, }, asname: None, @@ -149,7 +173,9 @@ Module( range: 162..207, module: Some( Identifier { - id: "a.b.c", + id: Name( + "a.b.c", + ), range: 193..198, }, ), @@ -157,7 +183,9 @@ Module( Alias { range: 206..207, name: Identifier { - id: "d", + id: Name( + "d", + ), range: 206..207, }, asname: None, @@ -171,7 +199,9 @@ Module( range: 208..242, module: Some( Identifier { - id: "module", + id: Name( + "module", + ), range: 213..219, }, ), @@ -179,7 +209,9 @@ Module( Alias { range: 228..229, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 228..229, }, asname: None, @@ -187,12 +219,16 @@ Module( Alias { range: 231..237, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 231..232, }, asname: Some( Identifier { - id: "B", + id: Name( + "B", + ), range: 236..237, }, ), @@ -200,7 +236,9 @@ Module( Alias { range: 239..240, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 239..240, }, asname: None, @@ -214,7 +252,9 @@ Module( range: 243..258, module: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 248..249, }, ), @@ -222,7 +262,9 @@ Module( Alias { range: 257..258, name: Identifier { - id: "*", + id: Name( + "*", + ), range: 257..258, }, asname: None, diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__function.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__function.py.snap index 3f741ebf3321d0..389e2ad962c22d 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__function.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__function.py.snap @@ -15,7 +15,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "no_parameters", + id: Name( + "no_parameters", + ), range: 4..17, }, type_params: None, @@ -43,7 +45,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "positional_parameters", + id: Name( + "positional_parameters", + ), range: 36..57, }, type_params: None, @@ -56,7 +60,9 @@ Module( parameter: Parameter { range: 58..59, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 58..59, }, annotation: None, @@ -68,7 +74,9 @@ Module( parameter: Parameter { range: 61..62, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 61..62, }, annotation: None, @@ -80,7 +88,9 @@ Module( parameter: Parameter { range: 64..65, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 64..65, }, annotation: None, @@ -108,7 +118,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "positional_parameters_with_default_values", + id: Name( + "positional_parameters_with_default_values", + ), range: 83..124, }, type_params: None, @@ -121,7 +133,9 @@ Module( parameter: Parameter { range: 125..126, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 125..126, }, annotation: None, @@ -133,7 +147,9 @@ Module( parameter: Parameter { range: 128..129, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 128..129, }, annotation: None, @@ -154,7 +170,9 @@ Module( parameter: Parameter { range: 134..135, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 134..135, }, annotation: None, @@ -191,7 +209,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "positional_parameters_with_default_values2", + id: Name( + "positional_parameters_with_default_values2", + ), range: 156..198, }, type_params: None, @@ -203,7 +223,9 @@ Module( parameter: Parameter { range: 199..200, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 199..200, }, annotation: None, @@ -215,7 +237,9 @@ Module( parameter: Parameter { range: 202..203, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 202..203, }, annotation: None, @@ -238,7 +262,9 @@ Module( parameter: Parameter { range: 211..212, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 211..212, }, annotation: None, @@ -275,7 +301,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "positional_only_and_positional_parameters", + id: Name( + "positional_only_and_positional_parameters", + ), range: 233..274, }, type_params: None, @@ -287,7 +315,9 @@ Module( parameter: Parameter { range: 275..276, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 275..276, }, annotation: None, @@ -301,7 +331,9 @@ Module( parameter: Parameter { range: 281..282, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 281..282, }, annotation: None, @@ -313,7 +345,9 @@ Module( parameter: Parameter { range: 284..285, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 284..285, }, annotation: None, @@ -341,7 +375,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "pos_args_with_defaults_and_varargs_and_kwargs", + id: Name( + "pos_args_with_defaults_and_varargs_and_kwargs", + ), range: 303..348, }, type_params: None, @@ -353,7 +389,9 @@ Module( parameter: Parameter { range: 349..350, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 349..350, }, annotation: None, @@ -365,7 +403,9 @@ Module( parameter: Parameter { range: 352..353, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 352..353, }, annotation: None, @@ -388,7 +428,9 @@ Module( parameter: Parameter { range: 361..362, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 361..362, }, annotation: None, @@ -409,7 +451,9 @@ Module( Parameter { range: 367..372, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 368..372, }, annotation: None, @@ -420,7 +464,9 @@ Module( Parameter { range: 374..382, name: Identifier { - id: "kwargs", + id: Name( + "kwargs", + ), range: 376..382, }, annotation: None, @@ -443,7 +489,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "keyword_only_parameters", + id: Name( + "keyword_only_parameters", + ), range: 400..423, }, type_params: None, @@ -458,7 +506,9 @@ Module( parameter: Parameter { range: 427..428, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 427..428, }, annotation: None, @@ -470,7 +520,9 @@ Module( parameter: Parameter { range: 430..431, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 430..431, }, annotation: None, @@ -482,7 +534,9 @@ Module( parameter: Parameter { range: 433..434, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 433..434, }, annotation: None, @@ -508,7 +562,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "keyword_only_parameters_with_defaults", + id: Name( + "keyword_only_parameters_with_defaults", + ), range: 452..489, }, type_params: None, @@ -523,7 +579,9 @@ Module( parameter: Parameter { range: 493..494, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 493..494, }, annotation: None, @@ -535,7 +593,9 @@ Module( parameter: Parameter { range: 496..497, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 496..497, }, annotation: None, @@ -556,7 +616,9 @@ Module( parameter: Parameter { range: 502..503, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 502..503, }, annotation: None, @@ -591,7 +653,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "kw_only_args_with_defaults_and_varargs", + id: Name( + "kw_only_args_with_defaults_and_varargs", + ), range: 524..562, }, type_params: None, @@ -603,7 +667,9 @@ Module( Parameter { range: 563..568, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 564..568, }, annotation: None, @@ -615,7 +681,9 @@ Module( parameter: Parameter { range: 570..571, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 570..571, }, annotation: None, @@ -627,7 +695,9 @@ Module( parameter: Parameter { range: 573..574, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 573..574, }, annotation: None, @@ -648,7 +718,9 @@ Module( parameter: Parameter { range: 579..580, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 579..580, }, annotation: None, @@ -683,7 +755,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "kw_only_args_with_defaults_and_kwargs", + id: Name( + "kw_only_args_with_defaults_and_kwargs", + ), range: 601..638, }, type_params: None, @@ -698,7 +772,9 @@ Module( parameter: Parameter { range: 642..643, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 642..643, }, annotation: None, @@ -710,7 +786,9 @@ Module( parameter: Parameter { range: 645..646, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 645..646, }, annotation: None, @@ -731,7 +809,9 @@ Module( parameter: Parameter { range: 651..652, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 651..652, }, annotation: None, @@ -752,7 +832,9 @@ Module( Parameter { range: 657..665, name: Identifier { - id: "kwargs", + id: Name( + "kwargs", + ), range: 659..665, }, annotation: None, @@ -775,7 +857,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "kw_only_args_with_defaults_and_varargs_and_kwargs", + id: Name( + "kw_only_args_with_defaults_and_varargs_and_kwargs", + ), range: 683..732, }, type_params: None, @@ -787,7 +871,9 @@ Module( Parameter { range: 733..738, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 734..738, }, annotation: None, @@ -799,7 +885,9 @@ Module( parameter: Parameter { range: 740..741, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 740..741, }, annotation: None, @@ -811,7 +899,9 @@ Module( parameter: Parameter { range: 743..744, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 743..744, }, annotation: None, @@ -832,7 +922,9 @@ Module( parameter: Parameter { range: 749..750, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 749..750, }, annotation: None, @@ -853,7 +945,9 @@ Module( Parameter { range: 755..763, name: Identifier { - id: "kwargs", + id: Name( + "kwargs", + ), range: 757..763, }, annotation: None, @@ -876,7 +970,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "pos_and_kw_only_args", + id: Name( + "pos_and_kw_only_args", + ), range: 781..801, }, type_params: None, @@ -888,7 +984,9 @@ Module( parameter: Parameter { range: 802..803, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 802..803, }, annotation: None, @@ -900,7 +998,9 @@ Module( parameter: Parameter { range: 805..806, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 805..806, }, annotation: None, @@ -914,7 +1014,9 @@ Module( parameter: Parameter { range: 811..812, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 811..812, }, annotation: None, @@ -929,7 +1031,9 @@ Module( parameter: Parameter { range: 817..818, name: Identifier { - id: "d", + id: Name( + "d", + ), range: 817..818, }, annotation: None, @@ -941,7 +1045,9 @@ Module( parameter: Parameter { range: 820..821, name: Identifier { - id: "e", + id: Name( + "e", + ), range: 820..821, }, annotation: None, @@ -953,7 +1059,9 @@ Module( parameter: Parameter { range: 823..824, name: Identifier { - id: "f", + id: Name( + "f", + ), range: 823..824, }, annotation: None, @@ -979,7 +1087,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "pos_and_kw_only_args_with_defaults", + id: Name( + "pos_and_kw_only_args_with_defaults", + ), range: 842..876, }, type_params: None, @@ -991,7 +1101,9 @@ Module( parameter: Parameter { range: 877..878, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 877..878, }, annotation: None, @@ -1003,7 +1115,9 @@ Module( parameter: Parameter { range: 880..881, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 880..881, }, annotation: None, @@ -1017,7 +1131,9 @@ Module( parameter: Parameter { range: 886..887, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 886..887, }, annotation: None, @@ -1032,7 +1148,9 @@ Module( parameter: Parameter { range: 892..893, name: Identifier { - id: "d", + id: Name( + "d", + ), range: 892..893, }, annotation: None, @@ -1044,7 +1162,9 @@ Module( parameter: Parameter { range: 895..896, name: Identifier { - id: "e", + id: Name( + "e", + ), range: 895..896, }, annotation: None, @@ -1065,7 +1185,9 @@ Module( parameter: Parameter { range: 901..902, name: Identifier { - id: "f", + id: Name( + "f", + ), range: 901..902, }, annotation: None, @@ -1100,7 +1222,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "pos_and_kw_only_args_with_defaults_and_varargs", + id: Name( + "pos_and_kw_only_args_with_defaults_and_varargs", + ), range: 923..969, }, type_params: None, @@ -1112,7 +1236,9 @@ Module( parameter: Parameter { range: 970..971, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 970..971, }, annotation: None, @@ -1124,7 +1250,9 @@ Module( parameter: Parameter { range: 973..974, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 973..974, }, annotation: None, @@ -1138,7 +1266,9 @@ Module( parameter: Parameter { range: 979..980, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 979..980, }, annotation: None, @@ -1150,7 +1280,9 @@ Module( Parameter { range: 982..987, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 983..987, }, annotation: None, @@ -1162,7 +1294,9 @@ Module( parameter: Parameter { range: 989..990, name: Identifier { - id: "d", + id: Name( + "d", + ), range: 989..990, }, annotation: None, @@ -1174,7 +1308,9 @@ Module( parameter: Parameter { range: 992..993, name: Identifier { - id: "e", + id: Name( + "e", + ), range: 992..993, }, annotation: None, @@ -1195,7 +1331,9 @@ Module( parameter: Parameter { range: 998..999, name: Identifier { - id: "f", + id: Name( + "f", + ), range: 998..999, }, annotation: None, @@ -1230,7 +1368,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "pos_and_kw_only_args_with_defaults_and_kwargs", + id: Name( + "pos_and_kw_only_args_with_defaults_and_kwargs", + ), range: 1020..1065, }, type_params: None, @@ -1242,7 +1382,9 @@ Module( parameter: Parameter { range: 1071..1072, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 1071..1072, }, annotation: None, @@ -1254,7 +1396,9 @@ Module( parameter: Parameter { range: 1074..1075, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 1074..1075, }, annotation: None, @@ -1268,7 +1412,9 @@ Module( parameter: Parameter { range: 1080..1081, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 1080..1081, }, annotation: None, @@ -1283,7 +1429,9 @@ Module( parameter: Parameter { range: 1086..1087, name: Identifier { - id: "d", + id: Name( + "d", + ), range: 1086..1087, }, annotation: None, @@ -1295,7 +1443,9 @@ Module( parameter: Parameter { range: 1089..1090, name: Identifier { - id: "e", + id: Name( + "e", + ), range: 1089..1090, }, annotation: None, @@ -1316,7 +1466,9 @@ Module( parameter: Parameter { range: 1095..1096, name: Identifier { - id: "f", + id: Name( + "f", + ), range: 1095..1096, }, annotation: None, @@ -1337,7 +1489,9 @@ Module( Parameter { range: 1101..1109, name: Identifier { - id: "kwargs", + id: Name( + "kwargs", + ), range: 1103..1109, }, annotation: None, @@ -1360,7 +1514,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "pos_and_kw_only_args_with_defaults_and_varargs_and_kwargs", + id: Name( + "pos_and_kw_only_args_with_defaults_and_varargs_and_kwargs", + ), range: 1128..1185, }, type_params: None, @@ -1372,7 +1528,9 @@ Module( parameter: Parameter { range: 1191..1192, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 1191..1192, }, annotation: None, @@ -1384,7 +1542,9 @@ Module( parameter: Parameter { range: 1194..1195, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 1194..1195, }, annotation: None, @@ -1398,7 +1558,9 @@ Module( parameter: Parameter { range: 1200..1201, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 1200..1201, }, annotation: None, @@ -1410,7 +1572,9 @@ Module( Parameter { range: 1203..1208, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 1204..1208, }, annotation: None, @@ -1422,7 +1586,9 @@ Module( parameter: Parameter { range: 1210..1211, name: Identifier { - id: "d", + id: Name( + "d", + ), range: 1210..1211, }, annotation: None, @@ -1434,7 +1600,9 @@ Module( parameter: Parameter { range: 1213..1214, name: Identifier { - id: "e", + id: Name( + "e", + ), range: 1213..1214, }, annotation: None, @@ -1455,7 +1623,9 @@ Module( parameter: Parameter { range: 1219..1220, name: Identifier { - id: "f", + id: Name( + "f", + ), range: 1219..1220, }, annotation: None, @@ -1476,7 +1646,9 @@ Module( Parameter { range: 1225..1233, name: Identifier { - id: "kwargs", + id: Name( + "kwargs", + ), range: 1227..1233, }, annotation: None, @@ -1499,7 +1671,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "positional_and_keyword_parameters", + id: Name( + "positional_and_keyword_parameters", + ), range: 1252..1285, }, type_params: None, @@ -1512,7 +1686,9 @@ Module( parameter: Parameter { range: 1286..1287, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 1286..1287, }, annotation: None, @@ -1524,7 +1700,9 @@ Module( parameter: Parameter { range: 1289..1290, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 1289..1290, }, annotation: None, @@ -1536,7 +1714,9 @@ Module( parameter: Parameter { range: 1292..1293, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 1292..1293, }, annotation: None, @@ -1551,7 +1731,9 @@ Module( parameter: Parameter { range: 1298..1299, name: Identifier { - id: "d", + id: Name( + "d", + ), range: 1298..1299, }, annotation: None, @@ -1563,7 +1745,9 @@ Module( parameter: Parameter { range: 1301..1302, name: Identifier { - id: "e", + id: Name( + "e", + ), range: 1301..1302, }, annotation: None, @@ -1575,7 +1759,9 @@ Module( parameter: Parameter { range: 1304..1305, name: Identifier { - id: "f", + id: Name( + "f", + ), range: 1304..1305, }, annotation: None, @@ -1601,7 +1787,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "positional_and_keyword_parameters_with_defaults", + id: Name( + "positional_and_keyword_parameters_with_defaults", + ), range: 1323..1370, }, type_params: None, @@ -1614,7 +1802,9 @@ Module( parameter: Parameter { range: 1371..1372, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 1371..1372, }, annotation: None, @@ -1626,7 +1816,9 @@ Module( parameter: Parameter { range: 1374..1375, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 1374..1375, }, annotation: None, @@ -1638,7 +1830,9 @@ Module( parameter: Parameter { range: 1377..1378, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 1377..1378, }, annotation: None, @@ -1653,7 +1847,9 @@ Module( parameter: Parameter { range: 1383..1384, name: Identifier { - id: "d", + id: Name( + "d", + ), range: 1383..1384, }, annotation: None, @@ -1665,7 +1861,9 @@ Module( parameter: Parameter { range: 1386..1387, name: Identifier { - id: "e", + id: Name( + "e", + ), range: 1386..1387, }, annotation: None, @@ -1686,7 +1884,9 @@ Module( parameter: Parameter { range: 1392..1393, name: Identifier { - id: "f", + id: Name( + "f", + ), range: 1392..1393, }, annotation: None, @@ -1721,7 +1921,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "positional_and_keyword_parameters_with_defaults_and_varargs", + id: Name( + "positional_and_keyword_parameters_with_defaults_and_varargs", + ), range: 1414..1473, }, type_params: None, @@ -1734,7 +1936,9 @@ Module( parameter: Parameter { range: 1479..1480, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 1479..1480, }, annotation: None, @@ -1746,7 +1950,9 @@ Module( parameter: Parameter { range: 1482..1483, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 1482..1483, }, annotation: None, @@ -1758,7 +1964,9 @@ Module( parameter: Parameter { range: 1485..1486, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 1485..1486, }, annotation: None, @@ -1770,7 +1978,9 @@ Module( Parameter { range: 1488..1493, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 1489..1493, }, annotation: None, @@ -1782,7 +1992,9 @@ Module( parameter: Parameter { range: 1495..1496, name: Identifier { - id: "d", + id: Name( + "d", + ), range: 1495..1496, }, annotation: None, @@ -1794,7 +2006,9 @@ Module( parameter: Parameter { range: 1498..1499, name: Identifier { - id: "e", + id: Name( + "e", + ), range: 1498..1499, }, annotation: None, @@ -1815,7 +2029,9 @@ Module( parameter: Parameter { range: 1504..1505, name: Identifier { - id: "f", + id: Name( + "f", + ), range: 1504..1505, }, annotation: None, @@ -1850,7 +2066,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "positional_and_keyword_parameters_with_defaults_and_varargs_and_kwargs", + id: Name( + "positional_and_keyword_parameters_with_defaults_and_varargs_and_kwargs", + ), range: 1527..1597, }, type_params: None, @@ -1863,7 +2081,9 @@ Module( parameter: Parameter { range: 1603..1604, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 1603..1604, }, annotation: None, @@ -1875,7 +2095,9 @@ Module( parameter: Parameter { range: 1606..1607, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 1606..1607, }, annotation: None, @@ -1887,7 +2109,9 @@ Module( parameter: Parameter { range: 1609..1610, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 1609..1610, }, annotation: None, @@ -1899,7 +2123,9 @@ Module( Parameter { range: 1612..1617, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 1613..1617, }, annotation: None, @@ -1911,7 +2137,9 @@ Module( parameter: Parameter { range: 1619..1620, name: Identifier { - id: "d", + id: Name( + "d", + ), range: 1619..1620, }, annotation: None, @@ -1923,7 +2151,9 @@ Module( parameter: Parameter { range: 1622..1623, name: Identifier { - id: "e", + id: Name( + "e", + ), range: 1622..1623, }, annotation: None, @@ -1944,7 +2174,9 @@ Module( parameter: Parameter { range: 1628..1629, name: Identifier { - id: "f", + id: Name( + "f", + ), range: 1628..1629, }, annotation: None, @@ -1965,7 +2197,9 @@ Module( Parameter { range: 1634..1642, name: Identifier { - id: "kwargs", + id: Name( + "kwargs", + ), range: 1636..1642, }, annotation: None, @@ -1988,7 +2222,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "func", + id: Name( + "func", + ), range: 1707..1711, }, type_params: Some( @@ -1999,7 +2235,9 @@ Module( TypeParamTypeVar { range: 1712..1713, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 1712..1713, }, bound: None, @@ -2018,14 +2256,18 @@ Module( parameter: Parameter { range: 1715..1719, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 1715..1716, }, annotation: Some( Name( ExprName { range: 1718..1719, - id: "T", + id: Name( + "T", + ), ctx: Load, }, ), @@ -2042,7 +2284,9 @@ Module( Name( ExprName { range: 1724..1725, - id: "T", + id: Name( + "T", + ), ctx: Load, }, ), @@ -2062,7 +2306,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "func", + id: Name( + "func", + ), range: 1742..1746, }, type_params: Some( @@ -2073,14 +2319,18 @@ Module( TypeParamTypeVar { range: 1747..1753, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 1747..1748, }, bound: Some( Name( ExprName { range: 1750..1753, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -2100,14 +2350,18 @@ Module( parameter: Parameter { range: 1755..1759, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 1755..1756, }, annotation: Some( Name( ExprName { range: 1758..1759, - id: "T", + id: Name( + "T", + ), ctx: Load, }, ), @@ -2124,7 +2378,9 @@ Module( Name( ExprName { range: 1764..1765, - id: "T", + id: Name( + "T", + ), ctx: Load, }, ), @@ -2144,7 +2400,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "func", + id: Name( + "func", + ), range: 1782..1786, }, type_params: Some( @@ -2155,7 +2413,9 @@ Module( TypeParamTypeVar { range: 1787..1802, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 1787..1788, }, bound: Some( @@ -2166,14 +2426,18 @@ Module( Name( ExprName { range: 1791..1794, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), Name( ExprName { range: 1796..1801, - id: "bytes", + id: Name( + "bytes", + ), ctx: Load, }, ), @@ -2198,14 +2462,18 @@ Module( parameter: Parameter { range: 1804..1808, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 1804..1805, }, annotation: Some( Name( ExprName { range: 1807..1808, - id: "T", + id: Name( + "T", + ), ctx: Load, }, ), @@ -2222,7 +2490,9 @@ Module( Name( ExprName { range: 1813..1814, - id: "T", + id: Name( + "T", + ), ctx: Load, }, ), @@ -2242,7 +2512,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "func", + id: Name( + "func", + ), range: 1831..1835, }, type_params: Some( @@ -2253,7 +2525,9 @@ Module( TypeParamTypeVarTuple { range: 1836..1839, name: Identifier { - id: "Ts", + id: Name( + "Ts", + ), range: 1837..1839, }, default: None, @@ -2270,7 +2544,9 @@ Module( Parameter { range: 1841..1848, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 1842..1843, }, annotation: Some( @@ -2280,7 +2556,9 @@ Module( value: Name( ExprName { range: 1846..1848, - id: "Ts", + id: Name( + "Ts", + ), ctx: Load, }, ), @@ -2300,7 +2578,9 @@ Module( value: Name( ExprName { range: 1853..1858, - id: "Tuple", + id: Name( + "Tuple", + ), ctx: Load, }, ), @@ -2314,7 +2594,9 @@ Module( value: Name( ExprName { range: 1860..1862, - id: "Ts", + id: Name( + "Ts", + ), ctx: Load, }, ), @@ -2345,7 +2627,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "func", + id: Name( + "func", + ), range: 1880..1884, }, type_params: Some( @@ -2356,7 +2640,9 @@ Module( TypeParamParamSpec { range: 1885..1888, name: Identifier { - id: "P", + id: Name( + "P", + ), range: 1887..1888, }, default: None, @@ -2373,7 +2659,9 @@ Module( Parameter { range: 1890..1903, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 1891..1895, }, annotation: Some( @@ -2383,12 +2671,16 @@ Module( value: Name( ExprName { range: 1897..1898, - id: "P", + id: Name( + "P", + ), ctx: Load, }, ), attr: Identifier { - id: "args", + id: Name( + "args", + ), range: 1899..1903, }, ctx: Load, @@ -2402,7 +2694,9 @@ Module( Parameter { range: 1905..1923, name: Identifier { - id: "kwargs", + id: Name( + "kwargs", + ), range: 1907..1913, }, annotation: Some( @@ -2412,12 +2706,16 @@ Module( value: Name( ExprName { range: 1915..1916, - id: "P", + id: Name( + "P", + ), ctx: Load, }, ), attr: Identifier { - id: "kwargs", + id: Name( + "kwargs", + ), range: 1917..1923, }, ctx: Load, @@ -2443,7 +2741,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "func", + id: Name( + "func", + ), range: 1941..1945, }, type_params: Some( @@ -2454,7 +2754,9 @@ Module( TypeParamTypeVar { range: 1946..1947, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 1946..1947, }, bound: None, @@ -2465,14 +2767,18 @@ Module( TypeParamTypeVar { range: 1949..1955, name: Identifier { - id: "U", + id: Name( + "U", + ), range: 1949..1950, }, bound: Some( Name( ExprName { range: 1952..1955, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -2484,7 +2790,9 @@ Module( TypeParamTypeVarTuple { range: 1957..1960, name: Identifier { - id: "Ts", + id: Name( + "Ts", + ), range: 1958..1960, }, default: None, @@ -2494,7 +2802,9 @@ Module( TypeParamParamSpec { range: 1962..1965, name: Identifier { - id: "P", + id: Name( + "P", + ), range: 1964..1965, }, default: None, @@ -2527,7 +2837,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "ellipsis", + id: Name( + "ellipsis", + ), range: 1985..1993, }, type_params: None, @@ -2560,7 +2872,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "multiple_statements", + id: Name( + "multiple_statements", + ), range: 2007..2026, }, type_params: None, @@ -2576,7 +2890,9 @@ Module( Name( ExprName { range: 2032..2035, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -2591,7 +2907,9 @@ Module( func: Name( ExprName { range: 2041..2045, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -2628,7 +2946,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 2071..2074, }, type_params: None, @@ -2640,7 +2960,9 @@ Module( Parameter { range: 2075..2080, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 2076..2080, }, annotation: None, @@ -2665,7 +2987,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 2098..2101, }, type_params: None, @@ -2679,7 +3003,9 @@ Module( Parameter { range: 2102..2110, name: Identifier { - id: "kwargs", + id: Name( + "kwargs", + ), range: 2104..2110, }, annotation: None, @@ -2702,7 +3028,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 2128..2131, }, type_params: None, @@ -2714,7 +3042,9 @@ Module( Parameter { range: 2132..2137, name: Identifier { - id: "args", + id: Name( + "args", + ), range: 2133..2137, }, annotation: None, @@ -2725,7 +3055,9 @@ Module( Parameter { range: 2139..2147, name: Identifier { - id: "kwargs", + id: Name( + "kwargs", + ), range: 2141..2147, }, annotation: None, @@ -2748,7 +3080,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 2165..2168, }, type_params: None, @@ -2760,7 +3094,9 @@ Module( parameter: Parameter { range: 2169..2170, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 2169..2170, }, annotation: None, @@ -2789,7 +3125,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 2191..2194, }, type_params: None, @@ -2801,7 +3139,9 @@ Module( parameter: Parameter { range: 2195..2196, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 2195..2196, }, annotation: None, @@ -2815,7 +3155,9 @@ Module( parameter: Parameter { range: 2201..2202, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 2201..2202, }, annotation: None, @@ -2843,7 +3185,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 2220..2223, }, type_params: None, @@ -2855,7 +3199,9 @@ Module( parameter: Parameter { range: 2224..2225, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 2224..2225, }, annotation: None, @@ -2893,7 +3239,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 2249..2252, }, type_params: None, @@ -2905,7 +3253,9 @@ Module( parameter: Parameter { range: 2253..2254, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 2253..2254, }, annotation: None, @@ -2917,7 +3267,9 @@ Module( parameter: Parameter { range: 2256..2257, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 2256..2257, }, annotation: None, @@ -2933,7 +3285,9 @@ Module( parameter: Parameter { range: 2265..2266, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 2265..2266, }, annotation: None, @@ -2959,7 +3313,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 2284..2287, }, type_params: None, @@ -2972,7 +3328,9 @@ Module( parameter: Parameter { range: 2288..2290, name: Identifier { - id: "kw", + id: Name( + "kw", + ), range: 2288..2290, }, annotation: None, @@ -2996,7 +3354,9 @@ Module( parameter: Parameter { range: 2297..2298, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 2297..2298, }, annotation: None, @@ -3022,7 +3382,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 2316..2319, }, type_params: None, @@ -3035,14 +3397,18 @@ Module( parameter: Parameter { range: 2320..2326, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 2320..2321, }, annotation: Some( Name( ExprName { range: 2323..2326, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -3055,7 +3421,9 @@ Module( parameter: Parameter { range: 2328..2336, name: Identifier { - id: "y", + id: Name( + "y", + ), range: 2328..2329, }, annotation: Some( @@ -3086,7 +3454,9 @@ Module( parameter: Parameter { range: 2338..2346, name: Identifier { - id: "z", + id: Name( + "z", + ), range: 2338..2339, }, annotation: Some( @@ -3137,7 +3507,9 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name( + "foo", + ), range: 2364..2367, }, type_params: None, @@ -3150,7 +3522,9 @@ Module( parameter: Parameter { range: 2368..2372, name: Identifier { - id: "self", + id: Name( + "self", + ), range: 2368..2372, }, annotation: None, @@ -3162,7 +3536,9 @@ Module( parameter: Parameter { range: 2374..2375, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 2374..2375, }, annotation: None, @@ -3183,7 +3559,9 @@ Module( parameter: Parameter { range: 2379..2380, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 2379..2380, }, annotation: None, @@ -3204,7 +3582,9 @@ Module( parameter: Parameter { range: 2384..2385, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 2384..2385, }, annotation: None, diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__if.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__if.py.snap index f0c41f6ce0472d..dcbf2be44a7e1a 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__if.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__if.py.snap @@ -132,7 +132,9 @@ Module( left: Name( ExprName { range: 56..57, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -184,7 +186,9 @@ Module( test: Name( ExprName { range: 90..91, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -202,7 +206,9 @@ Module( Name( ExprName { range: 107..108, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -234,14 +240,18 @@ Module( Name( ExprName { range: 122..123, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 128..129, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -290,7 +300,9 @@ Module( Name( ExprName { range: 163..164, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -314,7 +326,9 @@ Module( Name( ExprName { range: 179..180, - id: "d", + id: Name( + "d", + ), ctx: Load, }, ), @@ -345,7 +359,9 @@ Module( func: Name( ExprName { range: 200..201, - id: "f", + id: Name( + "f", + ), ctx: Load, }, ), @@ -372,14 +388,18 @@ Module( target: Name( ExprName { range: 232..233, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), value: Name( ExprName { range: 237..238, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -407,14 +427,18 @@ Module( target: Name( ExprName { range: 249..250, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), value: Name( ExprName { range: 254..255, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -453,7 +477,9 @@ Module( parameter: Parameter { range: 271..272, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 271..272, }, annotation: None, @@ -469,7 +495,9 @@ Module( body: Name( ExprName { range: 274..275, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -504,7 +532,9 @@ Module( parameter: Parameter { range: 293..294, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 293..294, }, annotation: None, @@ -520,7 +550,9 @@ Module( body: Name( ExprName { range: 296..297, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -552,7 +584,9 @@ Module( value: Name( ExprName { range: 312..313, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -580,7 +614,9 @@ Module( value: Name( ExprName { range: 330..331, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -613,7 +649,9 @@ Module( Name( ExprName { range: 347..348, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -643,7 +681,9 @@ Module( Name( ExprName { range: 367..368, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__import.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__import.py.snap index 1a201d6f122ce9..9a0c3805c12bd6 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__import.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__import.py.snap @@ -16,7 +16,9 @@ Module( Alias { range: 7..8, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 7..8, }, asname: None, @@ -31,7 +33,9 @@ Module( Alias { range: 16..21, name: Identifier { - id: "a.b.c", + id: Name( + "a.b.c", + ), range: 16..21, }, asname: None, @@ -46,12 +50,16 @@ Module( Alias { range: 29..39, name: Identifier { - id: "a.b.c", + id: Name( + "a.b.c", + ), range: 29..34, }, asname: Some( Identifier { - id: "d", + id: Name( + "d", + ), range: 38..39, }, ), @@ -66,7 +74,9 @@ Module( Alias { range: 47..48, name: Identifier { - id: "a", + id: Name( + "a", + ), range: 47..48, }, asname: None, @@ -74,7 +84,9 @@ Module( Alias { range: 50..51, name: Identifier { - id: "b", + id: Name( + "b", + ), range: 50..51, }, asname: None, @@ -82,7 +94,9 @@ Module( Alias { range: 53..54, name: Identifier { - id: "c", + id: Name( + "c", + ), range: 53..54, }, asname: None, @@ -97,12 +111,16 @@ Module( Alias { range: 62..74, name: Identifier { - id: "foo.bar", + id: Name( + "foo.bar", + ), range: 62..69, }, asname: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 73..74, }, ), @@ -110,12 +128,16 @@ Module( Alias { range: 76..91, name: Identifier { - id: "a.b.c.d", + id: Name( + "a.b.c.d", + ), range: 76..83, }, asname: Some( Identifier { - id: "abcd", + id: Name( + "abcd", + ), range: 87..91, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__match.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__match.py.snap index c28a10dae8260e..7ac6a1dbb6460f 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__match.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__match.py.snap @@ -15,7 +15,9 @@ Module( subject: Name( ExprName { range: 73..74, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -51,7 +53,9 @@ Module( Name( ExprName { range: 98..99, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -77,7 +81,9 @@ Module( subject: Name( ExprName { range: 132..133, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -90,7 +96,9 @@ Module( cls: Name( ExprName { range: 144..149, - id: "bytes", + id: Name( + "bytes", + ), ctx: Load, }, ), @@ -103,7 +111,9 @@ Module( pattern: None, name: Some( Identifier { - id: "z", + id: Name( + "z", + ), range: 150..151, }, ), @@ -123,7 +133,9 @@ Module( Name( ExprName { range: 162..163, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -149,7 +161,9 @@ Module( subject: Name( ExprName { range: 196..197, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -187,7 +201,9 @@ Module( Name( ExprName { range: 224..225, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -237,7 +253,9 @@ Module( Name( ExprName { range: 255..256, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -339,7 +357,9 @@ Module( Name( ExprName { range: 324..325, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -363,7 +383,9 @@ Module( subject: Name( ExprName { range: 361..362, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -452,7 +474,9 @@ Module( Name( ExprName { range: 398..399, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -478,7 +502,9 @@ Module( subject: Name( ExprName { range: 451..452, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -575,7 +601,9 @@ Module( subject: Name( ExprName { range: 552..553, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -650,7 +678,9 @@ Module( Name( ExprName { range: 589..590, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -884,7 +914,9 @@ Module( Name( ExprName { range: 682..683, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -918,7 +950,9 @@ Module( Name( ExprName { range: 709..710, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -944,7 +978,9 @@ Module( subject: Name( ExprName { range: 743..744, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -988,7 +1024,9 @@ Module( Name( ExprName { range: 777..778, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -1014,7 +1052,9 @@ Module( subject: Name( ExprName { range: 811..812, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1050,7 +1090,9 @@ Module( Name( ExprName { range: 836..837, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -1152,7 +1194,9 @@ Module( Name( ExprName { range: 905..906, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -1176,7 +1220,9 @@ Module( subject: Name( ExprName { range: 942..943, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1200,7 +1246,9 @@ Module( Name( ExprName { range: 959..960, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1213,7 +1261,9 @@ Module( Name( ExprName { range: 970..971, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -1239,7 +1289,9 @@ Module( subject: Name( ExprName { range: 1004..1005, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1286,7 +1338,9 @@ Module( Name( ExprName { range: 1032..1033, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -1345,7 +1399,9 @@ Module( Name( ExprName { range: 1063..1064, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -1371,7 +1427,9 @@ Module( patterns: [], rest: Some( Identifier { - id: "z", + id: Name( + "z", + ), range: 1081..1082, }, ), @@ -1386,7 +1444,9 @@ Module( Name( ExprName { range: 1093..1094, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -1415,7 +1475,9 @@ Module( func: Name( ExprName { range: 1127..1130, - id: "Seq", + id: Name( + "Seq", + ), ctx: Load, }, ), @@ -1451,7 +1513,9 @@ Module( Name( ExprName { range: 1157..1158, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -1477,7 +1541,9 @@ Module( subject: Name( ExprName { range: 1191..1192, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1506,7 +1572,9 @@ Module( Name( ExprName { range: 1214..1215, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -1547,7 +1615,9 @@ Module( Name( ExprName { range: 1240..1241, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -1573,7 +1643,9 @@ Module( subject: Name( ExprName { range: 1274..1275, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1610,7 +1682,9 @@ Module( pattern: None, name: Some( Identifier { - id: "bar", + id: Name( + "bar", + ), range: 1294..1297, }, ), @@ -1629,7 +1703,9 @@ Module( Name( ExprName { range: 1308..1309, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -1637,7 +1713,9 @@ Module( value: Name( ExprName { range: 1312..1315, - id: "bar", + id: Name( + "bar", + ), ctx: Load, }, ), @@ -1722,7 +1800,9 @@ Module( range: 1371..1373, name: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 1372..1373, }, ), @@ -1753,7 +1833,9 @@ Module( Name( ExprName { range: 1387..1388, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -1779,7 +1861,9 @@ Module( subject: Name( ExprName { range: 1421..1422, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1815,7 +1899,9 @@ Module( Name( ExprName { range: 1446..1447, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -1874,7 +1960,9 @@ Module( target: Name( ExprName { range: 1472..1473, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -1884,7 +1972,9 @@ Module( value: Name( ExprName { range: 1477..1478, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1919,7 +2009,9 @@ Module( Name( ExprName { range: 1493..1494, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -1980,7 +2072,9 @@ Module( Name( ExprName { range: 1524..1525, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -2006,7 +2100,9 @@ Module( subject: Name( ExprName { range: 1558..1559, - id: "w", + id: Name( + "w", + ), ctx: Load, }, ), @@ -2023,7 +2119,9 @@ Module( pattern: None, name: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 1571..1572, }, ), @@ -2035,7 +2133,9 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name( + "y", + ), range: 1574..1575, }, ), @@ -2059,7 +2159,9 @@ Module( Name( ExprName { range: 1590..1591, - id: "z", + id: Name( + "z", + ), ctx: Store, }, ), @@ -2085,7 +2187,9 @@ Module( subject: Name( ExprName { range: 1624..1625, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -2135,7 +2239,9 @@ Module( Name( ExprName { range: 1659..1660, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -2165,7 +2271,9 @@ Module( Name( ExprName { range: 1694..1695, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -2187,7 +2295,9 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name( + "y", + ), range: 1709..1710, }, ), @@ -2205,7 +2315,9 @@ Module( Name( ExprName { range: 1721..1722, - id: "z", + id: Name( + "z", + ), ctx: Store, }, ), @@ -2231,7 +2343,9 @@ Module( subject: Name( ExprName { range: 1755..1756, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -2253,26 +2367,34 @@ Module( value: Name( ExprName { range: 1767..1768, - id: "A", + id: Name( + "A", + ), ctx: Load, }, ), attr: Identifier { - id: "B", + id: Name( + "B", + ), range: 1769..1770, }, ctx: Load, }, ), attr: Identifier { - id: "C", + id: Name( + "C", + ), range: 1771..1772, }, ctx: Load, }, ), attr: Identifier { - id: "D", + id: Name( + "D", + ), range: 1773..1774, }, ctx: Load, @@ -2289,7 +2411,9 @@ Module( Name( ExprName { range: 1784..1785, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -2315,7 +2439,9 @@ Module( subject: Name( ExprName { range: 1818..1819, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -2337,7 +2463,9 @@ Module( Name( ExprName { range: 1844..1845, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -2363,7 +2491,9 @@ Module( subject: Name( ExprName { range: 1878..1879, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -2392,7 +2522,9 @@ Module( Name( ExprName { range: 1901..1902, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -2418,7 +2550,9 @@ Module( subject: Name( ExprName { range: 1935..1936, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -2440,7 +2574,9 @@ Module( Name( ExprName { range: 1962..1963, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -2466,7 +2602,9 @@ Module( subject: Name( ExprName { range: 1996..1997, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -2488,7 +2626,9 @@ Module( Name( ExprName { range: 2020..2021, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -2546,7 +2686,9 @@ Module( Name( ExprName { range: 2049..2050, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -2597,7 +2739,9 @@ Module( Name( ExprName { range: 2076..2077, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -2623,7 +2767,9 @@ Module( subject: Name( ExprName { range: 2110..2111, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -2636,7 +2782,9 @@ Module( pattern: None, name: Some( Identifier { - id: "z", + id: Name( + "z", + ), range: 2122..2123, }, ), @@ -2651,7 +2799,9 @@ Module( Name( ExprName { range: 2133..2134, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -2677,7 +2827,9 @@ Module( subject: Name( ExprName { range: 2167..2168, - id: "w", + id: Name( + "w", + ), ctx: Load, }, ), @@ -2694,7 +2846,9 @@ Module( pattern: None, name: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 2180..2181, }, ), @@ -2706,7 +2860,9 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name( + "y", + ), range: 2183..2184, }, ), @@ -2717,7 +2873,9 @@ Module( range: 2186..2191, name: Some( Identifier { - id: "rest", + id: Name( + "rest", + ), range: 2187..2191, }, ), @@ -2735,7 +2893,9 @@ Module( Name( ExprName { range: 2202..2203, - id: "z", + id: Name( + "z", + ), ctx: Store, }, ), @@ -2761,7 +2921,9 @@ Module( subject: Name( ExprName { range: 2236..2237, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -2792,7 +2954,9 @@ Module( ), name: Some( Identifier { - id: "z", + id: Name( + "z", + ), range: 2254..2255, }, ), @@ -2818,7 +2982,9 @@ Module( ), name: Some( Identifier { - id: "z", + id: Name( + "z", + ), range: 2265..2266, }, ), @@ -2844,7 +3010,9 @@ Module( ), name: Some( Identifier { - id: "z", + id: Name( + "z", + ), range: 2276..2277, }, ), @@ -2860,7 +3028,9 @@ Module( left: Name( ExprName { range: 2282..2283, - id: "z", + id: Name( + "z", + ), ctx: Load, }, ), @@ -2874,7 +3044,9 @@ Module( left: Name( ExprName { range: 2287..2288, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -2901,7 +3073,9 @@ Module( Name( ExprName { range: 2302..2303, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -2927,7 +3101,9 @@ Module( subject: Name( ExprName { range: 2336..2337, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -3002,7 +3178,9 @@ Module( Name( ExprName { range: 2373..2374, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -3236,7 +3414,9 @@ Module( Name( ExprName { range: 2467..2468, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -3270,7 +3450,9 @@ Module( Name( ExprName { range: 2494..2495, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -3351,7 +3533,9 @@ Module( range: 2551..2553, name: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 2552..2553, }, ), @@ -3369,7 +3553,9 @@ Module( Name( ExprName { range: 2563..2564, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -3437,7 +3623,9 @@ Module( range: 2617..2619, name: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 2618..2619, }, ), @@ -3468,7 +3656,9 @@ Module( Name( ExprName { range: 2633..2634, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -3498,7 +3688,9 @@ Module( Name( ExprName { range: 2667..2668, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -3520,7 +3712,9 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name( + "y", + ), range: 2680..2681, }, ), @@ -3538,7 +3732,9 @@ Module( Name( ExprName { range: 2692..2693, - id: "z", + id: Name( + "z", + ), ctx: Store, }, ), @@ -3568,14 +3764,18 @@ Module( Name( ExprName { range: 2726..2727, - id: "w", + id: Name( + "w", + ), ctx: Load, }, ), Name( ExprName { range: 2729..2730, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -3597,7 +3797,9 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name( + "y", + ), range: 2741..2742, }, ), @@ -3609,7 +3811,9 @@ Module( pattern: None, name: Some( Identifier { - id: "z", + id: Name( + "z", + ), range: 2744..2745, }, ), @@ -3627,7 +3831,9 @@ Module( Name( ExprName { range: 2755..2756, - id: "v", + id: Name( + "v", + ), ctx: Store, }, ), @@ -3660,14 +3866,18 @@ Module( target: Name( ExprName { range: 2789..2790, - id: "w", + id: Name( + "w", + ), ctx: Store, }, ), value: Name( ExprName { range: 2794..2795, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -3695,7 +3905,9 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name( + "y", + ), range: 2807..2808, }, ), @@ -3704,7 +3916,9 @@ Module( ), name: Some( Identifier { - id: "v", + id: Name( + "v", + ), range: 2812..2813, }, ), @@ -3722,7 +3936,9 @@ Module( Name( ExprName { range: 2824..2825, - id: "z", + id: Name( + "z", + ), ctx: Store, }, ), @@ -3748,7 +3964,9 @@ Module( subject: Name( ExprName { range: 2837..2838, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -3773,7 +3991,9 @@ Module( expression: Name( ExprName { range: 2935..2936, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -3858,7 +4078,9 @@ Module( patterns: [], rest: Some( Identifier { - id: "rest", + id: Name( + "rest", + ), range: 2993..2997, }, ), @@ -3875,7 +4097,9 @@ Module( func: Name( ExprName { range: 3014..3019, - id: "print", + id: Name( + "print", + ), ctx: Load, }, ), @@ -3885,7 +4109,9 @@ Module( Name( ExprName { range: 3020..3024, - id: "rest", + id: Name( + "rest", + ), ctx: Load, }, ), @@ -3992,7 +4218,9 @@ Module( cls: Name( ExprName { range: 3079..3082, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -4015,7 +4243,9 @@ Module( ), name: Some( Identifier { - id: "label", + id: Name( + "label", + ), range: 3095..3100, }, ), @@ -4036,7 +4266,9 @@ Module( func: Name( ExprName { range: 3117..3122, - id: "print", + id: Name( + "print", + ), ctx: Load, }, ), @@ -4046,7 +4278,9 @@ Module( Name( ExprName { range: 3123..3128, - id: "label", + id: Name( + "label", + ), ctx: Load, }, ), @@ -4068,7 +4302,9 @@ Module( subject: Name( ExprName { range: 3136..3137, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -4117,7 +4353,9 @@ Module( Name( ExprName { range: 3165..3166, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -4143,7 +4381,9 @@ Module( subject: Name( ExprName { range: 3177..3178, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -4192,7 +4432,9 @@ Module( Name( ExprName { range: 3206..3207, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -4218,7 +4460,9 @@ Module( subject: Name( ExprName { range: 3218..3219, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -4254,7 +4498,9 @@ Module( Name( ExprName { range: 3244..3245, - id: "y", + id: Name( + "y", + ), ctx: Store, }, ), @@ -4284,7 +4530,9 @@ Module( Name( ExprName { range: 3256..3257, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -4302,7 +4550,9 @@ Module( pattern: None, name: Some( Identifier { - id: "z", + id: Name( + "z", + ), range: 3269..3270, }, ), @@ -4330,14 +4580,18 @@ Module( Name( ExprName { range: 3291..3292, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 3294..3295, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -4355,7 +4609,9 @@ Module( pattern: None, name: Some( Identifier { - id: "z", + id: Name( + "z", + ), range: 3306..3307, }, ), @@ -4383,14 +4639,18 @@ Module( Name( ExprName { range: 3328..3329, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 3331..3332, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -4408,7 +4668,9 @@ Module( pattern: None, name: Some( Identifier { - id: "z", + id: Name( + "z", + ), range: 3344..3345, }, ), @@ -4432,7 +4694,9 @@ Module( subject: Name( ExprName { range: 3391..3392, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -4512,7 +4776,9 @@ Module( subject: Name( ExprName { range: 3503..3504, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -4528,12 +4794,16 @@ Module( value: Name( ExprName { range: 3515..3516, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), attr: Identifier { - id: "b", + id: Name( + "b", + ), range: 3517..3518, }, ctx: Load, @@ -4569,19 +4839,25 @@ Module( value: Name( ExprName { range: 3541..3542, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), attr: Identifier { - id: "b", + id: Name( + "b", + ), range: 3543..3544, }, ctx: Load, }, ), attr: Identifier { - id: "c", + id: Name( + "c", + ), range: 3545..3546, }, ctx: Load, @@ -4956,7 +5232,9 @@ Module( subject: Name( ExprName { range: 3846..3847, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -5108,12 +5386,16 @@ Module( value: Name( ExprName { range: 3911..3912, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), attr: Identifier { - id: "b", + id: Name( + "b", + ), range: 3913..3914, }, ctx: Load, @@ -5147,7 +5429,9 @@ Module( subject: Name( ExprName { range: 3952..3953, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -5160,7 +5444,9 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 3964..3965, }, ), @@ -5192,7 +5478,9 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 3988..3989, }, ), @@ -5201,7 +5489,9 @@ Module( ), name: Some( Identifier { - id: "b", + id: Name( + "b", + ), range: 3993..3994, }, ), @@ -5263,7 +5553,9 @@ Module( ), name: Some( Identifier { - id: "two", + id: Name( + "two", + ), range: 4026..4029, }, ), @@ -5320,7 +5612,9 @@ Module( ), name: Some( Identifier { - id: "sum", + id: Name( + "sum", + ), range: 4062..4065, }, ), @@ -5355,12 +5649,16 @@ Module( value: Name( ExprName { range: 4088..4089, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), attr: Identifier { - id: "b", + id: Name( + "b", + ), range: 4090..4091, }, ctx: Load, @@ -5371,7 +5669,9 @@ Module( ), name: Some( Identifier { - id: "ab", + id: Name( + "ab", + ), range: 4095..4097, }, ), @@ -5430,7 +5730,9 @@ Module( ), name: Some( Identifier { - id: "x", + id: Name( + "x", + ), range: 4149..4150, }, ), @@ -5459,7 +5761,9 @@ Module( subject: Name( ExprName { range: 4194..4195, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -5628,7 +5932,9 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 4278..4279, }, ), @@ -5649,12 +5955,16 @@ Module( value: Name( ExprName { range: 4287..4288, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), attr: Identifier { - id: "b", + id: Name( + "b", + ), range: 4289..4290, }, ctx: Load, @@ -5709,7 +6019,9 @@ Module( ), name: Some( Identifier { - id: "X", + id: Name( + "X", + ), range: 4320..4321, }, ), @@ -5721,7 +6033,9 @@ Module( pattern: None, name: Some( Identifier { - id: "b", + id: Name( + "b", + ), range: 4323..4324, }, ), @@ -5733,7 +6047,9 @@ Module( ), name: Some( Identifier { - id: "S", + id: Name( + "S", + ), range: 4329..4330, }, ), @@ -5944,7 +6260,9 @@ Module( subject: Name( ExprName { range: 4466..4467, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -5960,7 +6278,9 @@ Module( range: 4478..4480, name: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 4479..4480, }, ), @@ -6049,7 +6369,9 @@ Module( range: 4537..4542, name: Some( Identifier { - id: "rest", + id: Name( + "rest", + ), range: 4538..4542, }, ), @@ -6136,7 +6458,9 @@ Module( subject: Name( ExprName { range: 4617..4618, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -6149,7 +6473,9 @@ Module( cls: Name( ExprName { range: 4629..4634, - id: "Point", + id: Name( + "Point", + ), ctx: Load, }, ), @@ -6188,19 +6514,25 @@ Module( value: Name( ExprName { range: 4659..4660, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), attr: Identifier { - id: "b", + id: Name( + "b", + ), range: 4661..4662, }, ctx: Load, }, ), attr: Identifier { - id: "Point", + id: Name( + "Point", + ), range: 4663..4668, }, ctx: Load, @@ -6235,7 +6567,9 @@ Module( cls: Name( ExprName { range: 4693..4700, - id: "Point2D", + id: Name( + "Point2D", + ), ctx: Load, }, ), @@ -6246,7 +6580,9 @@ Module( PatternKeyword { range: 4701..4704, attr: Identifier { - id: "x", + id: Name( + "x", + ), range: 4701..4702, }, pattern: MatchValue( @@ -6289,7 +6625,9 @@ Module( cls: Name( ExprName { range: 4728..4735, - id: "Point2D", + id: Name( + "Point2D", + ), ctx: Load, }, ), @@ -6300,7 +6638,9 @@ Module( PatternKeyword { range: 4736..4739, attr: Identifier { - id: "x", + id: Name( + "x", + ), range: 4736..4737, }, pattern: MatchValue( @@ -6320,7 +6660,9 @@ Module( PatternKeyword { range: 4741..4744, attr: Identifier { - id: "y", + id: Name( + "y", + ), range: 4741..4742, }, pattern: MatchValue( @@ -6363,7 +6705,9 @@ Module( cls: Name( ExprName { range: 4769..4776, - id: "Point2D", + id: Name( + "Point2D", + ), ctx: Load, }, ), @@ -6423,7 +6767,9 @@ Module( cls: Name( ExprName { range: 4805..4812, - id: "Point2D", + id: Name( + "Point2D", + ), ctx: Load, }, ), @@ -6468,7 +6814,9 @@ Module( PatternKeyword { range: 4821..4824, attr: Identifier { - id: "y", + id: Name( + "y", + ), range: 4821..4822, }, pattern: MatchValue( @@ -6511,7 +6859,9 @@ Module( cls: Name( ExprName { range: 4848..4855, - id: "Point2D", + id: Name( + "Point2D", + ), ctx: Load, }, ), @@ -6522,7 +6872,9 @@ Module( PatternKeyword { range: 4856..4864, attr: Identifier { - id: "x", + id: Name( + "x", + ), range: 4856..4857, }, pattern: MatchSequence( @@ -6562,7 +6914,9 @@ Module( PatternKeyword { range: 4866..4869, attr: Identifier { - id: "y", + id: Name( + "y", + ), range: 4866..4867, }, pattern: MatchValue( @@ -6609,14 +6963,18 @@ Module( target: Name( ExprName { range: 4913..4914, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), value: Name( ExprName { range: 4918..4919, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -6701,7 +7059,9 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 4964..4965, }, ), @@ -6743,7 +7103,9 @@ Module( ], rest: Some( Identifier { - id: "rest", + id: Name( + "rest", + ), range: 4983..4987, }, ), @@ -6772,7 +7134,9 @@ Module( subject: Name( ExprName { range: 5025..5026, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -6785,7 +7149,9 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name( + "a", + ), range: 5037..5038, }, ), @@ -6798,14 +7164,18 @@ Module( target: Name( ExprName { range: 5042..5043, - id: "b", + id: Name( + "b", + ), ctx: Store, }, ), value: Name( ExprName { range: 5047..5048, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -6833,7 +7203,9 @@ Module( pattern: None, name: Some( Identifier { - id: "e", + id: Name( + "e", + ), range: 5063..5064, }, ), @@ -6899,7 +7271,9 @@ Module( left: Name( ExprName { range: 5108..5113, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -6907,7 +7281,9 @@ Module( right: Name( ExprName { range: 5115..5116, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -6917,7 +7293,9 @@ Module( right: Name( ExprName { range: 5119..5120, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -6926,7 +7304,9 @@ Module( Name( ExprName { range: 5122..5123, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -6950,7 +7330,9 @@ Module( left: Name( ExprName { range: 5149..5154, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -6961,7 +7343,9 @@ Module( left: Name( ExprName { range: 5157..5158, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -6969,7 +7353,9 @@ Module( right: Name( ExprName { range: 5161..5162, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -6980,7 +7366,9 @@ Module( Name( ExprName { range: 5165..5166, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -7000,7 +7388,9 @@ Module( func: Name( ExprName { range: 5192..5197, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -7016,7 +7406,9 @@ Module( left: Name( ExprName { range: 5200..5201, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -7024,7 +7416,9 @@ Module( right: Name( ExprName { range: 5204..5205, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -7036,7 +7430,9 @@ Module( Name( ExprName { range: 5207..5208, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -7059,7 +7455,9 @@ Module( left: Name( ExprName { range: 5236..5241, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -7070,7 +7468,9 @@ Module( left: Name( ExprName { range: 5243..5244, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -7078,7 +7478,9 @@ Module( right: Name( ExprName { range: 5247..5248, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -7090,7 +7492,9 @@ Module( right: Name( ExprName { range: 5251..5252, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -7110,7 +7514,9 @@ Module( left: Name( ExprName { range: 5279..5284, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -7121,7 +7527,9 @@ Module( left: Name( ExprName { range: 5287..5288, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -7129,7 +7537,9 @@ Module( right: Name( ExprName { range: 5291..5292, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -7141,7 +7551,9 @@ Module( right: Name( ExprName { range: 5296..5297, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -7164,7 +7576,9 @@ Module( func: Name( ExprName { range: 5324..5329, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -7178,7 +7592,9 @@ Module( operand: Name( ExprName { range: 5332..5333, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -7193,7 +7609,9 @@ Module( right: Name( ExprName { range: 5337..5338, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -7203,7 +7621,9 @@ Module( right: Name( ExprName { range: 5341..5342, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -7223,7 +7643,9 @@ Module( func: Name( ExprName { range: 5370..5375, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -7235,7 +7657,9 @@ Module( }, ), attr: Identifier { - id: "a", + id: Name( + "a", + ), range: 5379..5380, }, ctx: Load, @@ -7255,7 +7679,9 @@ Module( func: Name( ExprName { range: 5397..5402, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -7276,7 +7702,9 @@ Module( }, ), attr: Identifier { - id: "a", + id: Name( + "a", + ), range: 5408..5409, }, ctx: Load, @@ -7296,7 +7724,9 @@ Module( func: Name( ExprName { range: 5428..5433, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -7317,7 +7747,9 @@ Module( }, ), attr: Identifier { - id: "a", + id: Name( + "a", + ), range: 5440..5441, }, ctx: Load, @@ -7337,14 +7769,18 @@ Module( value: Name( ExprName { range: 5460..5465, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), slice: Name( ExprName { range: 5467..5468, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -7352,7 +7788,9 @@ Module( }, ), attr: Identifier { - id: "b", + id: Name( + "b", + ), range: 5470..5471, }, ctx: Load, @@ -7372,7 +7810,9 @@ Module( value: Name( ExprName { range: 5489..5494, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -7383,7 +7823,9 @@ Module( Name( ExprName { range: 5496..5497, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -7396,7 +7838,9 @@ Module( }, ), attr: Identifier { - id: "b", + id: Name( + "b", + ), range: 5500..5501, }, ctx: Load, @@ -7416,7 +7860,9 @@ Module( value: Name( ExprName { range: 5542..5547, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -7427,7 +7873,9 @@ Module( Name( ExprName { range: 5550..5551, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -7440,7 +7888,9 @@ Module( }, ), attr: Identifier { - id: "b", + id: Name( + "b", + ), range: 5555..5556, }, ctx: Load, @@ -7460,7 +7910,9 @@ Module( func: Name( ExprName { range: 5577..5582, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -7478,7 +7930,9 @@ Module( Name( ExprName { range: 5585..5586, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -7487,7 +7941,9 @@ Module( Name( ExprName { range: 5592..5593, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -7509,7 +7965,9 @@ Module( target: Name( ExprName { range: 5617..5622, - id: "match", + id: Name( + "match", + ), ctx: Store, }, ), @@ -7539,7 +7997,9 @@ Module( subject: Name( ExprName { range: 5640..5645, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -7602,7 +8062,9 @@ Module( Name( ExprName { range: 5689..5694, - id: "match", + id: Name( + "match", + ), ctx: Store, }, ), @@ -7620,7 +8082,9 @@ Module( parameter: Parameter { range: 5704..5709, name: Identifier { - id: "query", + id: Name( + "query", + ), range: 5704..5709, }, annotation: None, @@ -7639,7 +8103,9 @@ Module( left: Name( ExprName { range: 5711..5716, - id: "query", + id: Name( + "query", + ), ctx: Load, }, ), @@ -7650,7 +8116,9 @@ Module( Name( ExprName { range: 5720..5725, - id: "event", + id: Name( + "event", + ), ctx: Load, }, ), @@ -7670,7 +8138,9 @@ Module( func: Name( ExprName { range: 5726..5731, - id: "print", + id: Name( + "print", + ), ctx: Load, }, ), @@ -7683,7 +8153,9 @@ Module( func: Name( ExprName { range: 5732..5737, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__raise.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__raise.py.snap index ec27a9479aafe6..81365a8fbd2a7c 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__raise.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__raise.py.snap @@ -23,7 +23,9 @@ Module( Name( ExprName { range: 20..21, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -42,14 +44,18 @@ Module( Name( ExprName { range: 29..30, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 32..33, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -108,14 +114,18 @@ Module( Name( ExprName { range: 53..54, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 59..60, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -143,7 +153,9 @@ Module( parameter: Parameter { range: 74..75, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 74..75, }, annotation: None, @@ -159,7 +171,9 @@ Module( body: Name( ExprName { range: 77..78, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -179,7 +193,9 @@ Module( value: Name( ExprName { range: 91..92, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -205,14 +221,18 @@ Module( body: Name( ExprName { range: 99..100, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 114..115, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -229,7 +249,9 @@ Module( Name( ExprName { range: 144..145, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -238,7 +260,9 @@ Module( Name( ExprName { range: 151..152, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -252,7 +276,9 @@ Module( Name( ExprName { range: 159..160, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -265,14 +291,18 @@ Module( Name( ExprName { range: 167..168, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 170..171, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -291,7 +321,9 @@ Module( Name( ExprName { range: 179..180, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -333,7 +365,9 @@ Module( Name( ExprName { range: 198..199, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -347,14 +381,18 @@ Module( Name( ExprName { range: 205..206, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), Name( ExprName { range: 211..212, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -371,7 +409,9 @@ Module( Name( ExprName { range: 219..220, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -390,7 +430,9 @@ Module( parameter: Parameter { range: 233..234, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 233..234, }, annotation: None, @@ -406,7 +448,9 @@ Module( body: Name( ExprName { range: 236..237, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -422,7 +466,9 @@ Module( Name( ExprName { range: 244..245, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -434,7 +480,9 @@ Module( value: Name( ExprName { range: 257..258, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -450,7 +498,9 @@ Module( Name( ExprName { range: 265..266, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -468,14 +518,18 @@ Module( body: Name( ExprName { range: 272..273, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 287..288, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__return.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__return.py.snap index 056479e9184d91..97c4de01c54cda 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__return.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__return.py.snap @@ -22,7 +22,9 @@ Module( Name( ExprName { range: 14..15, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -39,7 +41,9 @@ Module( value: Name( ExprName { range: 24..25, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -62,7 +66,9 @@ Module( left: Name( ExprName { range: 34..35, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -70,7 +76,9 @@ Module( right: Name( ExprName { range: 38..39, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -96,7 +104,9 @@ Module( value: Name( ExprName { range: 48..49, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -109,7 +119,9 @@ Module( value: Name( ExprName { range: 52..53, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -134,7 +146,9 @@ Module( target: Name( ExprName { range: 62..63, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -175,14 +189,18 @@ Module( Name( ExprName { range: 89..90, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 95..96, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -267,7 +285,9 @@ Module( func: Name( ExprName { range: 130..134, - id: "call", + id: Name( + "call", + ), ctx: Load, }, ), @@ -294,12 +314,16 @@ Module( value: Name( ExprName { range: 144..148, - id: "attr", + id: Name( + "attr", + ), ctx: Load, }, ), attr: Identifier { - id: "value", + id: Name( + "value", + ), range: 149..154, }, ctx: Load, @@ -325,7 +349,9 @@ Module( value: Name( ExprName { range: 170..171, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -351,7 +377,9 @@ Module( parameter: Parameter { range: 186..187, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 186..187, }, annotation: None, @@ -367,7 +395,9 @@ Module( body: Name( ExprName { range: 189..190, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__simple.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__simple.py.snap index 257c1d0bc4f8b8..bd83a96ecf9ae0 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__simple.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__simple.py.snap @@ -25,7 +25,9 @@ Module( test: Name( ExprName { range: 80..81, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -126,21 +128,27 @@ Module( test: Name( ExprName { range: 125..126, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), body: Name( ExprName { range: 120..121, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 132..133, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -154,7 +162,9 @@ Module( test: Name( ExprName { range: 138..139, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -165,7 +175,9 @@ Module( value: Name( ExprName { range: 141..142, - id: "B", + id: Name( + "B", + ), ctx: Load, }, ), @@ -178,7 +190,9 @@ Module( Name( ExprName { range: 148..149, - id: "A", + id: Name( + "A", + ), ctx: Del, }, ), @@ -197,7 +211,9 @@ Module( value: Name( ExprName { range: 156..157, - id: "C", + id: Name( + "C", + ), ctx: Load, }, ), @@ -214,7 +230,9 @@ Module( test: Name( ExprName { range: 161..162, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -229,7 +247,9 @@ Module( Name( ExprName { range: 170..171, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__try.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__try.py.snap index c7da1fecb2dfd8..bc1a39b9c9e06b 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__try.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__try.py.snap @@ -73,14 +73,18 @@ Module( Name( ExprName { range: 50..60, - id: "Exception1", + id: Name( + "Exception1", + ), ctx: Load, }, ), ), name: Some( Identifier { - id: "e", + id: Name( + "e", + ), range: 64..65, }, ), @@ -105,14 +109,18 @@ Module( Name( ExprName { range: 82..92, - id: "Exception2", + id: Name( + "Exception2", + ), ctx: Load, }, ), ), name: Some( Identifier { - id: "e", + id: Name( + "e", + ), range: 96..97, }, ), @@ -159,14 +167,18 @@ Module( Name( ExprName { range: 128..137, - id: "Exception", + id: Name( + "Exception", + ), ctx: Load, }, ), ), name: Some( Identifier { - id: "e", + id: Name( + "e", + ), range: 141..142, }, ), @@ -433,14 +445,18 @@ Module( Name( ExprName { range: 388..394, - id: "GroupA", + id: Name( + "GroupA", + ), ctx: Load, }, ), ), name: Some( Identifier { - id: "eg", + id: Name( + "eg", + ), range: 398..400, }, ), @@ -465,7 +481,9 @@ Module( Name( ExprName { range: 418..432, - id: "ExceptionGroup", + id: Name( + "ExceptionGroup", + ), ctx: Load, }, ), @@ -505,7 +523,9 @@ Module( func: Name( ExprName { range: 458..468, - id: "ValueError", + id: Name( + "ValueError", + ), ctx: Load, }, ), @@ -538,14 +558,18 @@ Module( Name( ExprName { range: 479..488, - id: "TypeError", + id: Name( + "TypeError", + ), ctx: Load, }, ), ), name: Some( Identifier { - id: "e", + id: Name( + "e", + ), range: 492..493, }, ), @@ -559,7 +583,9 @@ Module( func: Name( ExprName { range: 499..504, - id: "print", + id: Name( + "print", + ), ctx: Load, }, ), @@ -590,7 +616,9 @@ Module( func: Name( ExprName { range: 515..519, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -600,7 +628,9 @@ Module( Name( ExprName { range: 520..521, - id: "e", + id: Name( + "e", + ), ctx: Load, }, ), @@ -643,14 +673,18 @@ Module( Name( ExprName { range: 533..540, - id: "OSError", + id: Name( + "OSError", + ), ctx: Load, }, ), ), name: Some( Identifier { - id: "e", + id: Name( + "e", + ), range: 544..545, }, ), @@ -664,7 +698,9 @@ Module( func: Name( ExprName { range: 551..556, - id: "print", + id: Name( + "print", + ), ctx: Load, }, ), @@ -695,7 +731,9 @@ Module( func: Name( ExprName { range: 567..571, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -705,7 +743,9 @@ Module( Name( ExprName { range: 572..573, - id: "e", + id: Name( + "e", + ), ctx: Load, }, ), @@ -761,7 +801,9 @@ Module( func: Name( ExprName { range: 594..608, - id: "ExceptionGroup", + id: Name( + "ExceptionGroup", + ), ctx: Load, }, ), @@ -796,7 +838,9 @@ Module( func: Name( ExprName { range: 616..626, - id: "ValueError", + id: Name( + "ValueError", + ), ctx: Load, }, ), @@ -822,7 +866,9 @@ Module( func: Name( ExprName { range: 631..640, - id: "TypeError", + id: Name( + "TypeError", + ), ctx: Load, }, ), @@ -848,7 +894,9 @@ Module( func: Name( ExprName { range: 645..652, - id: "OSError", + id: Name( + "OSError", + ), ctx: Load, }, ), @@ -874,7 +922,9 @@ Module( func: Name( ExprName { range: 657..664, - id: "OSError", + id: Name( + "OSError", + ), ctx: Load, }, ), @@ -916,14 +966,18 @@ Module( Name( ExprName { range: 678..687, - id: "TypeError", + id: Name( + "TypeError", + ), ctx: Load, }, ), ), name: Some( Identifier { - id: "e", + id: Name( + "e", + ), range: 691..692, }, ), @@ -937,7 +991,9 @@ Module( func: Name( ExprName { range: 698..703, - id: "print", + id: Name( + "print", + ), ctx: Load, }, ), @@ -968,7 +1024,9 @@ Module( func: Name( ExprName { range: 714..718, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -978,7 +1036,9 @@ Module( Name( ExprName { range: 719..720, - id: "e", + id: Name( + "e", + ), ctx: Load, }, ), @@ -1007,12 +1067,16 @@ Module( value: Name( ExprName { range: 736..737, - id: "e", + id: Name( + "e", + ), ctx: Load, }, ), attr: Identifier { - id: "exceptions", + id: Name( + "exceptions", + ), range: 738..748, }, ctx: Load, @@ -1052,14 +1116,18 @@ Module( Name( ExprName { range: 760..767, - id: "OSError", + id: Name( + "OSError", + ), ctx: Load, }, ), ), name: Some( Identifier { - id: "e", + id: Name( + "e", + ), range: 771..772, }, ), @@ -1073,7 +1141,9 @@ Module( func: Name( ExprName { range: 778..783, - id: "print", + id: Name( + "print", + ), ctx: Load, }, ), @@ -1104,7 +1174,9 @@ Module( func: Name( ExprName { range: 794..798, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -1114,7 +1186,9 @@ Module( Name( ExprName { range: 799..800, - id: "e", + id: Name( + "e", + ), ctx: Load, }, ), @@ -1143,12 +1217,16 @@ Module( value: Name( ExprName { range: 816..817, - id: "e", + id: Name( + "e", + ), ctx: Load, }, ), attr: Identifier { - id: "exceptions", + id: Name( + "exceptions", + ), range: 818..828, }, ctx: Load, @@ -1322,7 +1400,9 @@ Module( left: Name( ExprName { range: 947..948, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -1330,7 +1410,9 @@ Module( right: Name( ExprName { range: 951..952, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -1359,14 +1441,18 @@ Module( Name( ExprName { range: 970..971, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 976..977, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -1394,7 +1480,9 @@ Module( value: Name( ExprName { range: 1001..1002, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1428,7 +1516,9 @@ Module( parameter: Parameter { range: 1027..1028, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 1027..1028, }, annotation: None, @@ -1444,7 +1534,9 @@ Module( body: Name( ExprName { range: 1030..1031, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -1477,14 +1569,18 @@ Module( body: Name( ExprName { range: 1049..1050, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 1064..1065, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__type.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__type.py.snap index ba6f64dc5c900b..cf3137784a58fa 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__type.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__type.py.snap @@ -15,7 +15,9 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -23,7 +25,9 @@ Module( value: Name( ExprName { range: 9..12, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -35,7 +39,9 @@ Module( name: Name( ExprName { range: 18..19, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -46,7 +52,9 @@ Module( left: Name( ExprName { range: 22..25, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -54,7 +62,9 @@ Module( right: Name( ExprName { range: 28..31, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -68,7 +78,9 @@ Module( name: Name( ExprName { range: 37..38, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -79,7 +91,9 @@ Module( left: Name( ExprName { range: 41..44, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -112,7 +126,9 @@ Module( name: Name( ExprName { range: 66..67, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -124,7 +140,9 @@ Module( TypeParamTypeVar { range: 68..69, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 68..69, }, bound: None, @@ -140,7 +158,9 @@ Module( left: Name( ExprName { range: 73..74, - id: "T", + id: Name( + "T", + ), ctx: Load, }, ), @@ -151,7 +171,9 @@ Module( value: Name( ExprName { range: 77..81, - id: "list", + id: Name( + "list", + ), ctx: Load, }, ), @@ -161,14 +183,18 @@ Module( value: Name( ExprName { range: 82..83, - id: "X", + id: Name( + "X", + ), ctx: Load, }, ), slice: Name( ExprName { range: 84..85, - id: "T", + id: Name( + "T", + ), ctx: Load, }, ), @@ -188,7 +214,9 @@ Module( name: Name( ExprName { range: 106..107, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -200,7 +228,9 @@ Module( TypeParamTypeVar { range: 108..109, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 108..109, }, bound: None, @@ -213,7 +243,9 @@ Module( value: Name( ExprName { range: 113..116, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -225,7 +257,9 @@ Module( name: Name( ExprName { range: 122..123, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -237,7 +271,9 @@ Module( TypeParamTypeVar { range: 124..125, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 124..125, }, bound: None, @@ -256,14 +292,18 @@ Module( value: Name( ExprName { range: 129..133, - id: "list", + id: Name( + "list", + ), ctx: Load, }, ), slice: Name( ExprName { range: 134..135, - id: "T", + id: Name( + "T", + ), ctx: Load, }, ), @@ -277,14 +317,18 @@ Module( value: Name( ExprName { range: 139..142, - id: "set", + id: Name( + "set", + ), ctx: Load, }, ), slice: Name( ExprName { range: 143..144, - id: "T", + id: Name( + "T", + ), ctx: Load, }, ), @@ -301,7 +345,9 @@ Module( name: Name( ExprName { range: 151..152, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -313,7 +359,9 @@ Module( TypeParamTypeVar { range: 153..154, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 153..154, }, bound: None, @@ -324,7 +372,9 @@ Module( TypeParamTypeVarTuple { range: 156..159, name: Identifier { - id: "Ts", + id: Name( + "Ts", + ), range: 157..159, }, default: None, @@ -334,7 +384,9 @@ Module( TypeParamParamSpec { range: 161..164, name: Identifier { - id: "P", + id: Name( + "P", + ), range: 163..164, }, default: None, @@ -350,21 +402,27 @@ Module( Name( ExprName { range: 169..170, - id: "T", + id: Name( + "T", + ), ctx: Load, }, ), Name( ExprName { range: 172..174, - id: "Ts", + id: Name( + "Ts", + ), ctx: Load, }, ), Name( ExprName { range: 176..177, - id: "P", + id: Name( + "P", + ), ctx: Load, }, ), @@ -381,7 +439,9 @@ Module( name: Name( ExprName { range: 184..185, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -393,14 +453,18 @@ Module( TypeParamTypeVar { range: 186..192, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 186..187, }, bound: Some( Name( ExprName { range: 189..192, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -412,7 +476,9 @@ Module( TypeParamTypeVarTuple { range: 194..197, name: Identifier { - id: "Ts", + id: Name( + "Ts", + ), range: 195..197, }, default: None, @@ -422,7 +488,9 @@ Module( TypeParamParamSpec { range: 199..202, name: Identifier { - id: "P", + id: Name( + "P", + ), range: 201..202, }, default: None, @@ -438,21 +506,27 @@ Module( Name( ExprName { range: 207..208, - id: "T", + id: Name( + "T", + ), ctx: Load, }, ), Name( ExprName { range: 210..212, - id: "Ts", + id: Name( + "Ts", + ), ctx: Load, }, ), Name( ExprName { range: 214..215, - id: "P", + id: Name( + "P", + ), ctx: Load, }, ), @@ -469,7 +543,9 @@ Module( name: Name( ExprName { range: 222..223, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -481,7 +557,9 @@ Module( TypeParamTypeVar { range: 224..237, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 224..225, }, bound: Some( @@ -492,14 +570,18 @@ Module( Name( ExprName { range: 228..231, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), Name( ExprName { range: 233..236, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -516,7 +598,9 @@ Module( TypeParamTypeVarTuple { range: 239..242, name: Identifier { - id: "Ts", + id: Name( + "Ts", + ), range: 240..242, }, default: None, @@ -526,7 +610,9 @@ Module( TypeParamParamSpec { range: 244..247, name: Identifier { - id: "P", + id: Name( + "P", + ), range: 246..247, }, default: None, @@ -542,21 +628,27 @@ Module( Name( ExprName { range: 252..253, - id: "T", + id: Name( + "T", + ), ctx: Load, }, ), Name( ExprName { range: 255..257, - id: "Ts", + id: Name( + "Ts", + ), ctx: Load, }, ), Name( ExprName { range: 259..260, - id: "P", + id: Name( + "P", + ), ctx: Load, }, ), @@ -573,7 +665,9 @@ Module( name: Name( ExprName { range: 267..268, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -585,7 +679,9 @@ Module( TypeParamTypeVar { range: 269..276, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 269..270, }, bound: None, @@ -593,7 +689,9 @@ Module( Name( ExprName { range: 273..276, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -609,7 +707,9 @@ Module( left: Name( ExprName { range: 280..281, - id: "T", + id: Name( + "T", + ), ctx: Load, }, ), @@ -617,7 +717,9 @@ Module( right: Name( ExprName { range: 284..287, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -631,7 +733,9 @@ Module( name: Name( ExprName { range: 293..294, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -643,7 +747,9 @@ Module( TypeParamTypeVar { range: 295..313, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 295..296, }, bound: Some( @@ -653,7 +759,9 @@ Module( left: Name( ExprName { range: 298..301, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -661,7 +769,9 @@ Module( right: Name( ExprName { range: 304..307, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -672,7 +782,9 @@ Module( Name( ExprName { range: 310..313, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -691,7 +803,9 @@ Module( left: Name( ExprName { range: 317..318, - id: "T", + id: Name( + "T", + ), ctx: Load, }, ), @@ -699,7 +813,9 @@ Module( right: Name( ExprName { range: 321..324, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -709,7 +825,9 @@ Module( right: Name( ExprName { range: 327..330, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -723,7 +841,9 @@ Module( name: Name( ExprName { range: 336..337, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -735,7 +855,9 @@ Module( TypeParamTypeVarTuple { range: 338..360, name: Identifier { - id: "Ts", + id: Name( + "Ts", + ), range: 339..341, }, default: Some( @@ -748,7 +870,9 @@ Module( value: Name( ExprName { range: 345..350, - id: "tuple", + id: Name( + "tuple", + ), ctx: Load, }, ), @@ -759,14 +883,18 @@ Module( Name( ExprName { range: 351..354, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), Name( ExprName { range: 356..359, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -793,7 +921,9 @@ Module( value: Name( ExprName { range: 364..369, - id: "tuple", + id: Name( + "tuple", + ), ctx: Load, }, ), @@ -804,7 +934,9 @@ Module( Name( ExprName { range: 370..373, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -814,7 +946,9 @@ Module( value: Name( ExprName { range: 376..378, - id: "Ts", + id: Name( + "Ts", + ), ctx: Load, }, ), @@ -824,7 +958,9 @@ Module( Name( ExprName { range: 380..383, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -844,7 +980,9 @@ Module( name: Name( ExprName { range: 390..391, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -856,7 +994,9 @@ Module( TypeParamParamSpec { range: 392..408, name: Identifier { - id: "P", + id: Name( + "P", + ), range: 394..395, }, default: Some( @@ -867,14 +1007,18 @@ Module( Name( ExprName { range: 399..402, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), Name( ExprName { range: 404..407, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -894,7 +1038,9 @@ Module( value: Name( ExprName { range: 412..420, - id: "Callable", + id: Name( + "Callable", + ), ctx: Load, }, ), @@ -905,14 +1051,18 @@ Module( Name( ExprName { range: 421..422, - id: "P", + id: Name( + "P", + ), ctx: Load, }, ), Name( ExprName { range: 424..427, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -932,7 +1082,9 @@ Module( name: Name( ExprName { range: 464..468, - id: "type", + id: Name( + "type", + ), ctx: Store, }, ), @@ -940,7 +1092,9 @@ Module( value: Name( ExprName { range: 471..474, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -952,7 +1106,9 @@ Module( name: Name( ExprName { range: 480..485, - id: "match", + id: Name( + "match", + ), ctx: Store, }, ), @@ -960,7 +1116,9 @@ Module( value: Name( ExprName { range: 488..491, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -972,7 +1130,9 @@ Module( name: Name( ExprName { range: 497..501, - id: "case", + id: Name( + "case", + ), ctx: Store, }, ), @@ -980,7 +1140,9 @@ Module( value: Name( ExprName { range: 504..507, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -992,7 +1154,9 @@ Module( name: Name( ExprName { range: 538..541, - id: "foo", + id: Name( + "foo", + ), ctx: Store, }, ), @@ -1000,7 +1164,9 @@ Module( value: Name( ExprName { range: 544..548, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -1012,7 +1178,9 @@ Module( name: Name( ExprName { range: 554..557, - id: "foo", + id: Name( + "foo", + ), ctx: Store, }, ), @@ -1020,7 +1188,9 @@ Module( value: Name( ExprName { range: 560..565, - id: "match", + id: Name( + "match", + ), ctx: Load, }, ), @@ -1032,7 +1202,9 @@ Module( name: Name( ExprName { range: 571..574, - id: "foo", + id: Name( + "foo", + ), ctx: Store, }, ), @@ -1040,7 +1212,9 @@ Module( value: Name( ExprName { range: 577..581, - id: "case", + id: Name( + "case", + ), ctx: Load, }, ), @@ -1052,7 +1226,9 @@ Module( name: Name( ExprName { range: 613..614, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -1060,7 +1236,9 @@ Module( value: Name( ExprName { range: 617..620, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -1072,7 +1250,9 @@ Module( name: Name( ExprName { range: 626..627, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -1080,7 +1260,9 @@ Module( value: Name( ExprName { range: 633..636, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -1092,7 +1274,9 @@ Module( name: Name( ExprName { range: 642..643, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -1100,7 +1284,9 @@ Module( value: Name( ExprName { range: 649..652, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -1112,7 +1298,9 @@ Module( name: Name( ExprName { range: 658..659, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -1120,7 +1308,9 @@ Module( value: Name( ExprName { range: 668..671, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -1132,7 +1322,9 @@ Module( name: Name( ExprName { range: 685..686, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -1144,7 +1336,9 @@ Module( TypeParamTypeVar { range: 687..688, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 687..688, }, bound: None, @@ -1157,7 +1351,9 @@ Module( value: Name( ExprName { range: 692..693, - id: "T", + id: Name( + "T", + ), ctx: Load, }, ), @@ -1169,7 +1365,9 @@ Module( name: Name( ExprName { range: 699..700, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -1181,7 +1379,9 @@ Module( TypeParamTypeVar { range: 708..709, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 708..709, }, bound: None, @@ -1194,7 +1394,9 @@ Module( value: Name( ExprName { range: 713..714, - id: "T", + id: Name( + "T", + ), ctx: Load, }, ), @@ -1206,7 +1408,9 @@ Module( name: Name( ExprName { range: 720..721, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -1218,7 +1422,9 @@ Module( TypeParamTypeVar { range: 722..723, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 722..723, }, bound: None, @@ -1231,7 +1437,9 @@ Module( value: Name( ExprName { range: 733..734, - id: "T", + id: Name( + "T", + ), ctx: Load, }, ), @@ -1243,7 +1451,9 @@ Module( name: Name( ExprName { range: 761..762, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -1251,7 +1461,9 @@ Module( value: Name( ExprName { range: 765..768, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -1263,7 +1475,9 @@ Module( name: Name( ExprName { range: 775..776, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -1271,7 +1485,9 @@ Module( value: Name( ExprName { range: 779..782, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -1283,7 +1499,9 @@ Module( name: Name( ExprName { range: 789..790, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -1291,7 +1509,9 @@ Module( value: Name( ExprName { range: 793..797, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -1302,7 +1522,9 @@ Module( range: 798..819, decorator_list: [], name: Identifier { - id: "X", + id: Name( + "X", + ), range: 804..805, }, type_params: None, @@ -1314,7 +1536,9 @@ Module( name: Name( ExprName { range: 812..813, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -1322,7 +1546,9 @@ Module( value: Name( ExprName { range: 816..819, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -1337,7 +1563,9 @@ Module( name: Name( ExprName { range: 826..831, - id: "Point", + id: Name( + "Point", + ), ctx: Store, }, ), @@ -1348,7 +1576,9 @@ Module( value: Name( ExprName { range: 834..839, - id: "tuple", + id: Name( + "tuple", + ), ctx: Load, }, ), @@ -1359,14 +1589,18 @@ Module( Name( ExprName { range: 840..845, - id: "float", + id: Name( + "float", + ), ctx: Load, }, ), Name( ExprName { range: 847..852, - id: "float", + id: Name( + "float", + ), ctx: Load, }, ), @@ -1386,7 +1620,9 @@ Module( name: Name( ExprName { range: 859..864, - id: "Point", + id: Name( + "Point", + ), ctx: Store, }, ), @@ -1398,7 +1634,9 @@ Module( TypeParamTypeVar { range: 865..866, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 865..866, }, bound: None, @@ -1414,7 +1652,9 @@ Module( value: Name( ExprName { range: 870..875, - id: "tuple", + id: Name( + "tuple", + ), ctx: Load, }, ), @@ -1425,14 +1665,18 @@ Module( Name( ExprName { range: 876..877, - id: "T", + id: Name( + "T", + ), ctx: Load, }, ), Name( ExprName { range: 879..880, - id: "T", + id: Name( + "T", + ), ctx: Load, }, ), @@ -1452,7 +1696,9 @@ Module( name: Name( ExprName { range: 887..894, - id: "IntFunc", + id: Name( + "IntFunc", + ), ctx: Store, }, ), @@ -1464,7 +1710,9 @@ Module( TypeParamParamSpec { range: 895..898, name: Identifier { - id: "P", + id: Name( + "P", + ), range: 897..898, }, default: None, @@ -1479,7 +1727,9 @@ Module( value: Name( ExprName { range: 902..910, - id: "Callable", + id: Name( + "Callable", + ), ctx: Load, }, ), @@ -1490,14 +1740,18 @@ Module( Name( ExprName { range: 911..912, - id: "P", + id: Name( + "P", + ), ctx: Load, }, ), Name( ExprName { range: 914..917, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -1517,7 +1771,9 @@ Module( name: Name( ExprName { range: 937..949, - id: "LabeledTuple", + id: Name( + "LabeledTuple", + ), ctx: Store, }, ), @@ -1529,7 +1785,9 @@ Module( TypeParamTypeVarTuple { range: 950..953, name: Identifier { - id: "Ts", + id: Name( + "Ts", + ), range: 951..953, }, default: None, @@ -1544,7 +1802,9 @@ Module( value: Name( ExprName { range: 957..962, - id: "tuple", + id: Name( + "tuple", + ), ctx: Load, }, ), @@ -1555,7 +1815,9 @@ Module( Name( ExprName { range: 963..966, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -1565,7 +1827,9 @@ Module( value: Name( ExprName { range: 969..971, - id: "Ts", + id: Name( + "Ts", + ), ctx: Load, }, ), @@ -1588,7 +1852,9 @@ Module( name: Name( ExprName { range: 994..1010, - id: "HashableSequence", + id: Name( + "HashableSequence", + ), ctx: Store, }, ), @@ -1600,14 +1866,18 @@ Module( TypeParamTypeVar { range: 1011..1022, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 1011..1012, }, bound: Some( Name( ExprName { range: 1014..1022, - id: "Hashable", + id: Name( + "Hashable", + ), ctx: Load, }, ), @@ -1624,14 +1894,18 @@ Module( value: Name( ExprName { range: 1026..1034, - id: "Sequence", + id: Name( + "Sequence", + ), ctx: Load, }, ), slice: Name( ExprName { range: 1035..1036, - id: "T", + id: Name( + "T", + ), ctx: Load, }, ), @@ -1646,7 +1920,9 @@ Module( name: Name( ExprName { range: 1065..1081, - id: "IntOrStrSequence", + id: Name( + "IntOrStrSequence", + ), ctx: Store, }, ), @@ -1658,7 +1934,9 @@ Module( TypeParamTypeVar { range: 1082..1095, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 1082..1083, }, bound: Some( @@ -1669,14 +1947,18 @@ Module( Name( ExprName { range: 1086..1089, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), Name( ExprName { range: 1091..1094, - id: "str", + id: Name( + "str", + ), ctx: Load, }, ), @@ -1698,14 +1980,18 @@ Module( value: Name( ExprName { range: 1099..1107, - id: "Sequence", + id: Name( + "Sequence", + ), ctx: Load, }, ), slice: Name( ExprName { range: 1108..1109, - id: "T", + id: Name( + "T", + ), ctx: Load, }, ), @@ -1730,7 +2016,9 @@ Module( left: Name( ExprName { range: 1164..1168, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -1738,7 +2026,9 @@ Module( right: Name( ExprName { range: 1170..1171, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -1748,7 +2038,9 @@ Module( right: Name( ExprName { range: 1174..1175, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -1757,7 +2049,9 @@ Module( Name( ExprName { range: 1177..1178, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -1781,7 +2075,9 @@ Module( left: Name( ExprName { range: 1203..1207, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -1792,7 +2088,9 @@ Module( left: Name( ExprName { range: 1210..1211, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -1800,7 +2098,9 @@ Module( right: Name( ExprName { range: 1214..1215, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -1811,7 +2111,9 @@ Module( Name( ExprName { range: 1218..1219, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -1831,7 +2133,9 @@ Module( func: Name( ExprName { range: 1244..1248, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -1847,7 +2151,9 @@ Module( left: Name( ExprName { range: 1251..1252, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -1855,7 +2161,9 @@ Module( right: Name( ExprName { range: 1255..1256, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -1867,7 +2175,9 @@ Module( Name( ExprName { range: 1258..1259, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -1890,7 +2200,9 @@ Module( left: Name( ExprName { range: 1286..1290, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -1901,7 +2213,9 @@ Module( left: Name( ExprName { range: 1292..1293, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -1909,7 +2223,9 @@ Module( right: Name( ExprName { range: 1296..1297, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -1921,7 +2237,9 @@ Module( right: Name( ExprName { range: 1300..1301, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -1941,7 +2259,9 @@ Module( left: Name( ExprName { range: 1327..1331, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -1952,7 +2272,9 @@ Module( left: Name( ExprName { range: 1334..1335, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -1960,7 +2282,9 @@ Module( right: Name( ExprName { range: 1338..1339, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -1972,7 +2296,9 @@ Module( right: Name( ExprName { range: 1343..1344, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -1995,7 +2321,9 @@ Module( func: Name( ExprName { range: 1370..1374, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -2009,7 +2337,9 @@ Module( operand: Name( ExprName { range: 1377..1378, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -2024,7 +2354,9 @@ Module( right: Name( ExprName { range: 1382..1383, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -2034,7 +2366,9 @@ Module( right: Name( ExprName { range: 1386..1387, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -2054,7 +2388,9 @@ Module( func: Name( ExprName { range: 1414..1418, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -2066,7 +2402,9 @@ Module( }, ), attr: Identifier { - id: "a", + id: Name( + "a", + ), range: 1422..1423, }, ctx: Load, @@ -2086,7 +2424,9 @@ Module( func: Name( ExprName { range: 1439..1443, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -2107,7 +2447,9 @@ Module( }, ), attr: Identifier { - id: "a", + id: Name( + "a", + ), range: 1449..1450, }, ctx: Load, @@ -2127,7 +2469,9 @@ Module( func: Name( ExprName { range: 1468..1472, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -2148,7 +2492,9 @@ Module( }, ), attr: Identifier { - id: "a", + id: Name( + "a", + ), range: 1479..1480, }, ctx: Load, @@ -2168,14 +2514,18 @@ Module( value: Name( ExprName { range: 1498..1502, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), slice: Name( ExprName { range: 1504..1505, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -2183,7 +2533,9 @@ Module( }, ), attr: Identifier { - id: "b", + id: Name( + "b", + ), range: 1507..1508, }, ctx: Load, @@ -2203,7 +2555,9 @@ Module( value: Name( ExprName { range: 1525..1529, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -2214,7 +2568,9 @@ Module( Name( ExprName { range: 1531..1532, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -2227,7 +2583,9 @@ Module( }, ), attr: Identifier { - id: "b", + id: Name( + "b", + ), range: 1535..1536, }, ctx: Load, @@ -2247,7 +2605,9 @@ Module( value: Name( ExprName { range: 1575..1579, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -2258,7 +2618,9 @@ Module( Name( ExprName { range: 1582..1583, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -2271,7 +2633,9 @@ Module( }, ), attr: Identifier { - id: "b", + id: Name( + "b", + ), range: 1587..1588, }, ctx: Load, @@ -2291,7 +2655,9 @@ Module( func: Name( ExprName { range: 1608..1612, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -2309,7 +2675,9 @@ Module( Name( ExprName { range: 1615..1616, - id: "a", + id: Name( + "a", + ), ctx: Load, }, ), @@ -2318,7 +2686,9 @@ Module( Name( ExprName { range: 1622..1623, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -2340,7 +2710,9 @@ Module( target: Name( ExprName { range: 1646..1650, - id: "type", + id: Name( + "type", + ), ctx: Store, }, ), @@ -2371,7 +2743,9 @@ Module( Name( ExprName { range: 1662..1666, - id: "type", + id: Name( + "type", + ), ctx: Store, }, ), @@ -2389,7 +2763,9 @@ Module( parameter: Parameter { range: 1676..1681, name: Identifier { - id: "query", + id: Name( + "query", + ), range: 1676..1681, }, annotation: None, @@ -2408,7 +2784,9 @@ Module( left: Name( ExprName { range: 1683..1688, - id: "query", + id: Name( + "query", + ), ctx: Load, }, ), @@ -2419,7 +2797,9 @@ Module( Name( ExprName { range: 1692..1697, - id: "event", + id: Name( + "event", + ), ctx: Load, }, ), @@ -2439,7 +2819,9 @@ Module( func: Name( ExprName { range: 1698..1703, - id: "print", + id: Name( + "print", + ), ctx: Load, }, ), @@ -2452,7 +2834,9 @@ Module( func: Name( ExprName { range: 1704..1708, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -2488,7 +2872,9 @@ Module( func: Name( ExprName { range: 1714..1718, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -2498,7 +2884,9 @@ Module( Name( ExprName { range: 1719..1723, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -2516,7 +2904,9 @@ Module( Name( ExprName { range: 1725..1726, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), @@ -2527,7 +2917,9 @@ Module( left: Name( ExprName { range: 1732..1736, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -2538,7 +2930,9 @@ Module( Name( ExprName { range: 1740..1741, - id: "C", + id: Name( + "C", + ), ctx: Load, }, ), @@ -2554,7 +2948,9 @@ Module( Name( ExprName { range: 1744..1745, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), @@ -2565,7 +2961,9 @@ Module( func: Name( ExprName { range: 1751..1755, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -2575,7 +2973,9 @@ Module( Name( ExprName { range: 1756..1757, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -2595,7 +2995,9 @@ Module( func: Name( ExprName { range: 1761..1765, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), @@ -2607,14 +3009,18 @@ Module( range: 1769..1776, arg: Some( Identifier { - id: "X", + id: Name( + "X", + ), range: 1769..1770, }, ), value: Name( ExprName { range: 1773..1776, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -2632,7 +3038,9 @@ Module( Name( ExprName { range: 1779..1783, - id: "type", + id: Name( + "type", + ), ctx: Store, }, ), @@ -2654,14 +3062,18 @@ Module( Name( ExprName { range: 1788..1792, - id: "type", + id: Name( + "type", + ), ctx: Store, }, ), Name( ExprName { range: 1795..1796, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), @@ -2683,14 +3095,18 @@ Module( Name( ExprName { range: 1801..1802, - id: "x", + id: Name( + "x", + ), ctx: Store, }, ), Name( ExprName { range: 1805..1809, - id: "type", + id: Name( + "type", + ), ctx: Store, }, ), @@ -2721,7 +3137,9 @@ Module( parameter: Parameter { range: 1821..1822, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 1821..1822, }, annotation: None, @@ -2737,7 +3155,9 @@ Module( body: Name( ExprName { range: 1824..1828, - id: "type", + id: Name( + "type", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__while.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__while.py.snap index c0c307dccd81e9..42bbd1ac4b80e6 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__while.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__while.py.snap @@ -15,7 +15,9 @@ Module( test: Name( ExprName { range: 6..7, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -48,7 +50,9 @@ Module( left: Name( ExprName { range: 25..26, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -70,7 +74,9 @@ Module( Name( ExprName { range: 36..37, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -109,14 +115,18 @@ Module( Name( ExprName { range: 69..70, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), Name( ExprName { range: 75..76, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -143,7 +153,9 @@ Module( func: Name( ExprName { range: 90..95, - id: "print", + id: Name( + "print", + ), ctx: Load, }, ), @@ -186,7 +198,9 @@ Module( func: Name( ExprName { range: 123..128, - id: "print", + id: Name( + "print", + ), ctx: Load, }, ), @@ -240,14 +254,18 @@ Module( target: Name( ExprName { range: 160..161, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), value: Name( ExprName { range: 165..166, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -282,14 +300,18 @@ Module( target: Name( ExprName { range: 179..180, - id: "a", + id: Name( + "a", + ), ctx: Store, }, ), value: Name( ExprName { range: 184..185, - id: "b", + id: Name( + "b", + ), ctx: Load, }, ), @@ -298,7 +320,9 @@ Module( Name( ExprName { range: 191..192, - id: "c", + id: Name( + "c", + ), ctx: Load, }, ), @@ -336,7 +360,9 @@ Module( parameter: Parameter { range: 211..212, name: Identifier { - id: "x", + id: Name( + "x", + ), range: 211..212, }, annotation: None, @@ -352,7 +378,9 @@ Module( body: Name( ExprName { range: 214..215, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -382,7 +410,9 @@ Module( value: Name( ExprName { range: 233..234, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), @@ -419,7 +449,9 @@ Module( test: Name( ExprName { range: 260..261, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__with.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__with.py.snap index cbd06ce99322ed..05fe0b87ad83da 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__with.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__with.py.snap @@ -19,7 +19,9 @@ Module( context_expr: Name( ExprName { range: 142..146, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -50,7 +52,9 @@ Module( context_expr: Name( ExprName { range: 157..161, - id: "item", + id: Name( + "item", + ), ctx: Load, }, ), @@ -58,7 +62,9 @@ Module( Name( ExprName { range: 165..166, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -89,7 +95,9 @@ Module( context_expr: Name( ExprName { range: 177..182, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), @@ -100,7 +108,9 @@ Module( context_expr: Name( ExprName { range: 184..189, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -131,7 +141,9 @@ Module( context_expr: Name( ExprName { range: 200..205, - id: "item1", + id: Name( + "item1", + ), ctx: Load, }, ), @@ -139,7 +151,9 @@ Module( Name( ExprName { range: 209..211, - id: "f1", + id: Name( + "f1", + ), ctx: Store, }, ), @@ -150,7 +164,9 @@ Module( context_expr: Name( ExprName { range: 213..218, - id: "item2", + id: Name( + "item2", + ), ctx: Load, }, ), @@ -158,7 +174,9 @@ Module( Name( ExprName { range: 222..224, - id: "f2", + id: Name( + "f2", + ), ctx: Store, }, ), @@ -198,14 +216,18 @@ Module( body: Name( ExprName { range: 236..237, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 251..252, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -247,14 +269,18 @@ Module( body: Name( ExprName { range: 263..264, - id: "x", + id: Name( + "x", + ), ctx: Load, }, ), orelse: Name( ExprName { range: 278..279, - id: "y", + id: Name( + "y", + ), ctx: Load, }, ), @@ -264,7 +290,9 @@ Module( Name( ExprName { range: 283..284, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -298,7 +326,9 @@ Module( func: Name( ExprName { range: 318..322, - id: "open", + id: Name( + "open", + ), ctx: Load, }, ), @@ -313,7 +343,9 @@ Module( Name( ExprName { range: 328..329, - id: "f", + id: Name( + "f", + ), ctx: Store, }, ), @@ -347,7 +379,9 @@ Module( func: Name( ExprName { range: 340..344, - id: "open", + id: Name( + "open", + ), ctx: Load, }, ), @@ -365,12 +399,16 @@ Module( value: Name( ExprName { range: 350..351, - id: "f", + id: Name( + "f", + ), ctx: Load, }, ), attr: Identifier { - id: "attr", + id: Name( + "attr", + ), range: 352..356, }, ctx: Store, diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@type_param_param_spec.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@type_param_param_spec.py.snap index 5b26b475fce6c7..8d3c11d9aa916e 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@type_param_param_spec.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@type_param_param_spec.py.snap @@ -15,7 +15,9 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -27,7 +29,9 @@ Module( TypeParamParamSpec { range: 7..10, name: Identifier { - id: "P", + id: Name( + "P", + ), range: 9..10, }, default: None, @@ -39,7 +43,9 @@ Module( value: Name( ExprName { range: 14..17, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -51,7 +57,9 @@ Module( name: Name( ExprName { range: 23..24, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -63,14 +71,18 @@ Module( TypeParamParamSpec { range: 25..34, name: Identifier { - id: "P", + id: Name( + "P", + ), range: 27..28, }, default: Some( Name( ExprName { range: 31..34, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -83,7 +95,9 @@ Module( value: Name( ExprName { range: 38..41, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -95,7 +109,9 @@ Module( name: Name( ExprName { range: 47..48, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -107,7 +123,9 @@ Module( TypeParamTypeVar { range: 49..50, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 49..50, }, bound: None, @@ -118,7 +136,9 @@ Module( TypeParamParamSpec { range: 52..55, name: Identifier { - id: "P", + id: Name( + "P", + ), range: 54..55, }, default: None, @@ -130,7 +150,9 @@ Module( value: Name( ExprName { range: 59..62, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -142,7 +164,9 @@ Module( name: Name( ExprName { range: 68..69, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -154,7 +178,9 @@ Module( TypeParamTypeVar { range: 70..71, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 70..71, }, bound: None, @@ -165,14 +191,18 @@ Module( TypeParamParamSpec { range: 73..82, name: Identifier { - id: "P", + id: Name( + "P", + ), range: 75..76, }, default: Some( Name( ExprName { range: 79..82, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -185,7 +215,9 @@ Module( value: Name( ExprName { range: 86..89, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@type_param_type_var.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@type_param_type_var.py.snap index 4477747d42dd89..c9f23cc3f20331 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@type_param_type_var.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@type_param_type_var.py.snap @@ -15,7 +15,9 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -27,7 +29,9 @@ Module( TypeParamTypeVar { range: 7..8, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 7..8, }, bound: None, @@ -40,7 +44,9 @@ Module( value: Name( ExprName { range: 12..15, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -52,7 +58,9 @@ Module( name: Name( ExprName { range: 21..22, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -64,7 +72,9 @@ Module( TypeParamTypeVar { range: 23..30, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 23..24, }, bound: None, @@ -72,7 +82,9 @@ Module( Name( ExprName { range: 27..30, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -85,7 +97,9 @@ Module( value: Name( ExprName { range: 34..37, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -97,7 +111,9 @@ Module( name: Name( ExprName { range: 43..44, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -109,14 +125,18 @@ Module( TypeParamTypeVar { range: 45..57, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 45..46, }, bound: Some( Name( ExprName { range: 48..51, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -125,7 +145,9 @@ Module( Name( ExprName { range: 54..57, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -138,7 +160,9 @@ Module( value: Name( ExprName { range: 61..64, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -150,7 +174,9 @@ Module( name: Name( ExprName { range: 70..71, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -162,7 +188,9 @@ Module( TypeParamTypeVar { range: 72..91, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 72..73, }, bound: Some( @@ -173,14 +201,18 @@ Module( Name( ExprName { range: 76..79, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), Name( ExprName { range: 81..84, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -194,7 +226,9 @@ Module( Name( ExprName { range: 88..91, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -207,7 +241,9 @@ Module( value: Name( ExprName { range: 95..98, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -219,7 +255,9 @@ Module( name: Name( ExprName { range: 104..105, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -231,14 +269,18 @@ Module( TypeParamTypeVar { range: 106..118, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 106..107, }, bound: Some( Name( ExprName { range: 109..112, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -247,7 +289,9 @@ Module( Name( ExprName { range: 115..118, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -258,7 +302,9 @@ Module( TypeParamTypeVar { range: 120..139, name: Identifier { - id: "U", + id: Name( + "U", + ), range: 120..121, }, bound: Some( @@ -269,14 +315,18 @@ Module( Name( ExprName { range: 124..127, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), Name( ExprName { range: 129..132, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -290,7 +340,9 @@ Module( Name( ExprName { range: 136..139, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -303,7 +355,9 @@ Module( value: Name( ExprName { range: 143..146, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_parser/tests/snapshots/valid_syntax@type_param_type_var_tuple.py.snap b/crates/ruff_python_parser/tests/snapshots/valid_syntax@type_param_type_var_tuple.py.snap index 199f094a1ca168..8a8a7311b37918 100644 --- a/crates/ruff_python_parser/tests/snapshots/valid_syntax@type_param_type_var_tuple.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/valid_syntax@type_param_type_var_tuple.py.snap @@ -15,7 +15,9 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -27,7 +29,9 @@ Module( TypeParamTypeVarTuple { range: 7..10, name: Identifier { - id: "Ts", + id: Name( + "Ts", + ), range: 8..10, }, default: None, @@ -39,7 +43,9 @@ Module( value: Name( ExprName { range: 14..17, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -51,7 +57,9 @@ Module( name: Name( ExprName { range: 23..24, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -63,14 +71,18 @@ Module( TypeParamTypeVarTuple { range: 25..34, name: Identifier { - id: "Ts", + id: Name( + "Ts", + ), range: 26..28, }, default: Some( Name( ExprName { range: 31..34, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -83,7 +95,9 @@ Module( value: Name( ExprName { range: 38..41, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -95,7 +109,9 @@ Module( name: Name( ExprName { range: 47..48, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -107,7 +123,9 @@ Module( TypeParamTypeVarTuple { range: 49..59, name: Identifier { - id: "Ts", + id: Name( + "Ts", + ), range: 50..52, }, default: Some( @@ -117,7 +135,9 @@ Module( value: Name( ExprName { range: 56..59, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -133,7 +153,9 @@ Module( value: Name( ExprName { range: 63..66, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -145,7 +167,9 @@ Module( name: Name( ExprName { range: 72..73, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -157,7 +181,9 @@ Module( TypeParamTypeVar { range: 74..75, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 74..75, }, bound: None, @@ -168,7 +194,9 @@ Module( TypeParamTypeVarTuple { range: 77..80, name: Identifier { - id: "Ts", + id: Name( + "Ts", + ), range: 78..80, }, default: None, @@ -180,7 +208,9 @@ Module( value: Name( ExprName { range: 84..87, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -192,7 +222,9 @@ Module( name: Name( ExprName { range: 93..94, - id: "X", + id: Name( + "X", + ), ctx: Store, }, ), @@ -204,7 +236,9 @@ Module( TypeParamTypeVar { range: 95..96, name: Identifier { - id: "T", + id: Name( + "T", + ), range: 95..96, }, bound: None, @@ -215,14 +249,18 @@ Module( TypeParamTypeVarTuple { range: 98..107, name: Identifier { - id: "Ts", + id: Name( + "Ts", + ), range: 99..101, }, default: Some( Name( ExprName { range: 104..107, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), @@ -235,7 +273,9 @@ Module( value: Name( ExprName { range: 111..114, - id: "int", + id: Name( + "int", + ), ctx: Load, }, ), diff --git a/crates/ruff_python_semantic/src/model.rs b/crates/ruff_python_semantic/src/model.rs index e567a5e936f845..76670e3148f4d8 100644 --- a/crates/ruff_python_semantic/src/model.rs +++ b/crates/ruff_python_semantic/src/model.rs @@ -1,5 +1,3 @@ -pub mod all; - use std::path::Path; use bitflags::bitflags; @@ -27,6 +25,8 @@ use crate::reference::{ use crate::scope::{Scope, ScopeId, ScopeKind, Scopes}; use crate::Imported; +pub mod all; + /// A semantic model for a Python module, to enable querying the module's semantic information. pub struct SemanticModel<'a> { typing_modules: &'a [String], @@ -936,7 +936,7 @@ impl<'a> SemanticModel<'a> { .all(|scope| !scope.has(name)) { return Some(ImportedName { - name: (*name).to_string(), + name: name.to_string(), source, range: self.nodes[source].range(), context: binding.context, diff --git a/crates/ruff_workspace/src/options.rs b/crates/ruff_workspace/src/options.rs index 38645d3008069d..74bf21277484fd 100644 --- a/crates/ruff_workspace/src/options.rs +++ b/crates/ruff_workspace/src/options.rs @@ -28,6 +28,7 @@ use ruff_linter::settings::types::{ }; use ruff_linter::{warn_user_once, RuleSelector}; use ruff_macros::{CombineOptions, OptionsMetadata}; +use ruff_python_ast::name::Name; use ruff_python_formatter::{DocstringCodeLineWidth, QuoteStyle}; use crate::options_base::{OptionsMetadata, Visit}; @@ -1223,7 +1224,7 @@ pub struct Flake8GetTextOptions { value_type = "list[str]", example = r#"function-names = ["_", "gettext", "ngettext", "ugettetxt"]"# )] - pub function_names: Option>, + pub function_names: Option>, /// Additional function names to consider as internationalization calls, in addition to those /// included in `function-names`. @@ -1232,7 +1233,7 @@ pub struct Flake8GetTextOptions { value_type = "list[str]", example = r#"extend-function-names = ["ugettetxt"]"# )] - pub extend_function_names: Option>, + pub extend_function_names: Option>, } impl Flake8GetTextOptions { @@ -1585,7 +1586,7 @@ pub struct Flake8SelfOptions { ignore-names = ["_new"] "# )] - pub ignore_names: Option>, + pub ignore_names: Option>, /// Additional names to ignore when considering `flake8-self` violations, /// in addition to those included in `ignore-names`. @@ -1594,7 +1595,7 @@ pub struct Flake8SelfOptions { value_type = "list[str]", example = r#"extend-ignore-names = ["_base_manager", "_default_manager", "_meta"]"# )] - pub extend_ignore_names: Option>, + pub extend_ignore_names: Option>, } impl Flake8SelfOptions { @@ -3235,9 +3236,9 @@ pub struct FormatOptions { #[cfg(test)] mod tests { - use ruff_linter::rules::flake8_self; - use crate::options::Flake8SelfOptions; + use ruff_linter::rules::flake8_self; + use ruff_python_ast::name::Name; #[test] fn flake8_self_options() { @@ -3253,16 +3254,16 @@ mod tests { // Uses ignore_names if specified. let options = Flake8SelfOptions { - ignore_names: Some(vec!["_foo".to_string()]), + ignore_names: Some(vec![Name::new_static("_foo")]), extend_ignore_names: None, }; let settings = options.into_settings(); - assert_eq!(settings.ignore_names, vec!["_foo".to_string()]); + assert_eq!(settings.ignore_names, vec![Name::new_static("_foo")]); // Appends extend_ignore_names to defaults if only extend_ignore_names is specified. let options = Flake8SelfOptions { ignore_names: None, - extend_ignore_names: Some(vec!["_bar".to_string()]), + extend_ignore_names: Some(vec![Name::new_static("_bar")]), }; let settings = options.into_settings(); assert_eq!( @@ -3270,19 +3271,19 @@ mod tests { default_settings .ignore_names .into_iter() - .chain(["_bar".to_string()]) - .collect::>() + .chain([Name::new_static("_bar")]) + .collect::>() ); // Appends extend_ignore_names to ignore_names if both are specified. let options = Flake8SelfOptions { - ignore_names: Some(vec!["_foo".to_string()]), - extend_ignore_names: Some(vec!["_bar".to_string()]), + ignore_names: Some(vec![Name::new_static("_foo")]), + extend_ignore_names: Some(vec![Name::new_static("_bar")]), }; let settings = options.into_settings(); assert_eq!( settings.ignore_names, - vec!["_foo".to_string(), "_bar".to_string()] + vec![Name::new_static("_foo"), Name::new_static("_bar")] ); } }