From d6d006e90674765973c5371a84fa6345dff2f2ff Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Sat, 29 Jun 2024 11:16:39 +0200 Subject: [PATCH 1/4] Use `smol_str` for Identifier --- Cargo.lock | 5 +- crates/red_knot_python_semantic/Cargo.toml | 1 - crates/red_knot_python_semantic/src/lib.rs | 1 - crates/red_knot_python_semantic/src/name.rs | 56 --- .../src/semantic_index/builder.rs | 25 +- .../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 | 11 +- .../rules/unittest_assert.rs | 5 +- .../ruff_linter/src/rules/flake8_self/mod.rs | 8 +- .../rules/private_member_access.rs | 7 +- .../src/rules/flake8_self/settings.rs | 5 +- .../flake8_simplify/rules/ast_bool_op.rs | 11 +- .../rules/flake8_simplify/rules/ast_ifexp.rs | 3 +- .../flake8_simplify/rules/ast_unary_op.rs | 3 +- .../flake8_simplify/rules/needless_bool.rs | 3 +- .../rules/reimplemented_builtin.rs | 15 +- .../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 +- ...convert_named_tuple_functional_to_class.rs | 12 +- .../rules/pyupgrade/rules/os_error_alias.rs | 4 +- .../pyupgrade/rules/timeout_error_alias.rs | 4 +- .../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 | 10 +- crates/ruff_python_ast/src/helpers.rs | 8 +- crates/ruff_python_ast/src/name.rs | 164 +++++- crates/ruff_python_ast/src/nodes.rs | 32 +- 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 | 4 +- ...arser__tests__ipython_escape_commands.snap | 26 +- ...arser__parser__tests__unicode_aliases.snap | 4 +- .../src/parser/statement.rs | 5 +- ...thon_parser__lexer__tests__assignment.snap | 2 +- ...ruff_python_parser__lexer__tests__bom.snap | 2 +- ...parser__lexer__tests__bom_with_offset.snap | 4 +- ...r__lexer__tests__bom_with_offset_edge.snap | 2 +- ...lexer__tests__dedent_after_whitespace.snap | 6 +- ...er__tests__double_dedent_with_mac_eol.snap | 4 +- ...ests__double_dedent_with_tabs_mac_eol.snap | 4 +- ...sts__double_dedent_with_tabs_unix_eol.snap | 4 +- ...__double_dedent_with_tabs_windows_eol.snap | 4 +- ...r__tests__double_dedent_with_unix_eol.snap | 4 +- ...tests__double_dedent_with_windows_eol.snap | 4 +- ..._python_parser__lexer__tests__fstring.snap | 6 +- ...arser__lexer__tests__fstring_comments.snap | 2 +- ...ser__lexer__tests__fstring_conversion.snap | 10 +- ..._parser__lexer__tests__fstring_escape.snap | 4 +- ...__lexer__tests__fstring_escape_braces.snap | 4 +- ...ser__lexer__tests__fstring_escape_raw.snap | 4 +- ...__tests__fstring_expression_multiline.snap | 4 +- ...rser__lexer__tests__fstring_multiline.snap | 2 +- ...xer__tests__fstring_named_unicode_raw.snap | 2 +- ..._parser__lexer__tests__fstring_nested.snap | 4 +- ...exer__tests__fstring_with_format_spec.snap | 14 +- ...ests__fstring_with_ipy_escape_command.snap | 2 +- ...tests__fstring_with_lambda_expression.snap | 8 +- ...s__fstring_with_multiline_format_spec.snap | 10 +- ..._tests__fstring_with_named_expression.snap | 10 +- ...exer__tests__indentation_with_mac_eol.snap | 2 +- ...xer__tests__indentation_with_unix_eol.snap | 2 +- ...__tests__indentation_with_windows_eol.snap | 2 +- ...ts__ipython_escape_command_assignment.snap | 8 +- ..._tests__match_softkeyword_in_notebook.snap | 4 +- ...r__tests__newline_in_brackets_mac_eol.snap | 2 +- ...__tests__newline_in_brackets_unix_eol.snap | 2 +- ...ests__newline_in_brackets_windows_eol.snap | 2 +- ...ests__dont_panic_on_8_in_octal_escape.snap | 4 +- ...string__tests__fstring_constant_range.snap | 6 +- ...ing__tests__fstring_escaped_character.snap | 4 +- ...tring__tests__fstring_escaped_newline.snap | 4 +- ...ing__tests__fstring_line_continuation.snap | 4 +- ...__fstring_parse_self_documenting_base.snap | 4 +- ...ring_parse_self_documenting_base_more.snap | 6 +- ...fstring_parse_self_documenting_format.snap | 4 +- ...ing__tests__fstring_unescaped_newline.snap | 4 +- ..._parser__string__tests__parse_fstring.snap | 6 +- ...ring_nested_concatenation_string_spec.snap | 4 +- ...ing__tests__parse_fstring_nested_spec.snap | 6 +- ...sts__parse_fstring_nested_string_spec.snap | 4 +- ..._tests__parse_fstring_not_nested_spec.snap | 4 +- ...ts__parse_fstring_self_doc_prec_space.snap | 4 +- ...parse_fstring_self_doc_trailing_space.snap | 4 +- ...on_parser__string__tests__raw_fstring.snap | 4 +- ...ing__tests__triple_quoted_raw_fstring.snap | 4 +- crates/ruff_python_parser/src/token.rs | 3 +- ...ann_assign_stmt_invalid_annotation.py.snap | 18 +- ...tax@ann_assign_stmt_invalid_target.py.snap | 36 +- ...ntax@ann_assign_stmt_invalid_value.py.snap | 28 +- ...syntax@ann_assign_stmt_missing_rhs.py.snap | 4 +- ..._assign_stmt_type_alias_annotation.py.snap | 14 +- .../invalid_syntax@assert_empty_msg.py.snap | 2 +- .../invalid_syntax@assert_empty_test.py.snap | 2 +- ...lid_syntax@assert_invalid_msg_expr.py.snap | 8 +- ...id_syntax@assert_invalid_test_expr.py.snap | 10 +- ..._syntax@assign_stmt_invalid_target.py.snap | 8 +- ...tax@assign_stmt_invalid_value_expr.py.snap | 24 +- ..._syntax@assign_stmt_keyword_target.py.snap | 22 +- ...lid_syntax@assign_stmt_missing_rhs.py.snap | 16 +- ...alid_syntax@async_unexpected_token.py.snap | 10 +- ...tax@aug_assign_stmt_invalid_target.py.snap | 10 +- ...ntax@aug_assign_stmt_invalid_value.py.snap | 24 +- ...syntax@aug_assign_stmt_missing_rhs.py.snap | 8 +- ..._syntax@case_expect_indented_block.py.snap | 2 +- ...nvalid_syntax@class_def_empty_body.py.snap | 6 +- ...alid_syntax@class_def_missing_name.py.snap | 10 +- ...class_def_unclosed_type_param_list.py.snap | 12 +- ...ntax@comma_separated_missing_comma.py.snap | 4 +- ...ma_separated_missing_first_element.py.snap | 2 +- ...prehension_missing_for_after_async.py.snap | 8 +- ...yntax@decorator_invalid_expression.py.snap | 12 +- ...yntax@decorator_missing_expression.py.snap | 12 +- ...d_syntax@decorator_missing_newline.py.snap | 12 +- ..._syntax@decorator_unexpected_token.py.snap | 4 +- ...valid_syntax@del_incomplete_target.py.snap | 16 +- ...d_syntax@dotted_name_multiple_dots.py.snap | 6 +- ...tax@except_stmt_invalid_expression.py.snap | 4 +- ...syntax@except_stmt_missing_as_name.py.snap | 4 +- ...ntax@except_stmt_missing_exception.py.snap | 4 +- ...@except_stmt_unparenthesized_tuple.py.snap | 20 +- ...essions__arguments__double_starred.py.snap | 16 +- ...ments__duplicate_keyword_arguments.py.snap | 12 +- ...ons__arguments__invalid_expression.py.snap | 16 +- ...uments__invalid_keyword_expression.py.snap | 24 +- ...ressions__arguments__invalid_order.py.snap | 32 +- ...sions__arguments__missing_argument.py.snap | 6 +- ...ressions__arguments__missing_comma.py.snap | 6 +- ...ons__arguments__missing_expression.py.snap | 16 +- ...ax@expressions__arguments__starred.py.snap | 16 +- ...expressions__arguments__unclosed_0.py.snap | 4 +- ...expressions__arguments__unclosed_1.py.snap | 6 +- ...expressions__arguments__unclosed_2.py.snap | 6 +- ...essions__attribute__invalid_member.py.snap | 8 +- ...ressions__attribute__multiple_dots.py.snap | 16 +- ...@expressions__attribute__no_member.py.snap | 10 +- ...xpressions__await__no_expression_0.py.snap | 6 +- ...xpressions__await__no_expression_1.py.snap | 4 +- ...syntax@expressions__await__recover.py.snap | 20 +- ...ns__bin_op__invalid_rhs_expression.py.snap | 10 +- ...x@expressions__bin_op__missing_lhs.py.snap | 2 +- ...expressions__bin_op__missing_rhs_0.py.snap | 2 +- ...expressions__bin_op__missing_rhs_1.py.snap | 2 +- ...@expressions__bin_op__multiple_ops.py.snap | 8 +- ...ressions__bin_op__named_expression.py.snap | 8 +- ...ssions__bin_op__starred_expression.py.snap | 8 +- ...s__bool_op__invalid_rhs_expression.py.snap | 10 +- ...@expressions__bool_op__missing_lhs.py.snap | 2 +- ...@expressions__bool_op__missing_rhs.py.snap | 4 +- ...essions__bool_op__named_expression.py.snap | 12 +- ...sions__bool_op__starred_expression.py.snap | 8 +- ...xpressions__compare__invalid_order.py.snap | 16 +- ...s__compare__invalid_rhs_expression.py.snap | 10 +- ...@expressions__compare__missing_lhs.py.snap | 2 +- ...xpressions__compare__missing_rhs_0.py.snap | 4 +- ...xpressions__compare__missing_rhs_1.py.snap | 4 +- ...xpressions__compare__missing_rhs_2.py.snap | 4 +- ...ressions__compare__multiple_equals.py.snap | 12 +- ...essions__compare__named_expression.py.snap | 8 +- ...sions__compare__starred_expression.py.snap | 16 +- ...x@expressions__dict__comprehension.py.snap | 106 ++-- ...tax@expressions__dict__double_star.py.snap | 46 +- ...s__dict__double_star_comprehension.py.snap | 16 +- ...ons__dict__missing_closing_brace_0.py.snap | 8 +- ...ons__dict__missing_closing_brace_1.py.snap | 2 +- ...ons__dict__missing_closing_brace_2.py.snap | 4 +- ...ressions__dict__named_expression_0.py.snap | 14 +- ...ressions__dict__named_expression_1.py.snap | 16 +- ..._syntax@expressions__dict__recover.py.snap | 36 +- ...tax@expressions__emoji_identifiers.py.snap | 10 +- ...essions__if__missing_orelse_expr_0.py.snap | 8 +- ...essions__if__missing_orelse_expr_1.py.snap | 6 +- ...pressions__if__missing_test_expr_0.py.snap | 8 +- ...pressions__if__missing_test_expr_1.py.snap | 6 +- ...id_syntax@expressions__if__recover.py.snap | 44 +- ...essions__lambda_default_parameters.py.snap | 6 +- ...sions__lambda_duplicate_parameters.py.snap | 20 +- ...x@expressions__list__comprehension.py.snap | 88 ++-- ...s__list__missing_closing_bracket_0.py.snap | 2 +- ...s__list__missing_closing_bracket_1.py.snap | 4 +- ...s__list__missing_closing_bracket_2.py.snap | 4 +- ...s__list__missing_closing_bracket_3.py.snap | 2 +- ..._syntax@expressions__list__recover.py.snap | 8 +- ...__list__star_expression_precedence.py.snap | 42 +- ...expressions__named__invalid_target.py.snap | 14 +- ...sions__named__missing_expression_0.py.snap | 2 +- ...sions__named__missing_expression_1.py.snap | 4 +- ...sions__named__missing_expression_2.py.snap | 8 +- ...sions__named__missing_expression_3.py.snap | 6 +- ...sions__named__missing_expression_4.py.snap | 8 +- ...ressions__parenthesized__generator.py.snap | 12 +- ...nthesized__missing_closing_paren_0.py.snap | 2 +- ...nthesized__missing_closing_paren_1.py.snap | 4 +- ...nthesized__missing_closing_paren_2.py.snap | 4 +- ...nthesized__missing_closing_paren_3.py.snap | 2 +- ...ions__parenthesized__parenthesized.py.snap | 4 +- ...@expressions__parenthesized__tuple.py.snap | 12 +- ..._parenthesized__tuple_starred_expr.py.snap | 124 ++--- ...ax@expressions__set__comprehension.py.snap | 88 ++-- ...set__missing_closing_curly_brace_0.py.snap | 2 +- ...set__missing_closing_curly_brace_1.py.snap | 4 +- ...set__missing_closing_curly_brace_2.py.snap | 4 +- ...set__missing_closing_curly_brace_3.py.snap | 2 +- ...d_syntax@expressions__set__recover.py.snap | 8 +- ...s__set__star_expression_precedence.py.snap | 42 +- ...__subscript__invalid_slice_element.py.snap | 24 +- ...sions__subscript__unclosed_slice_0.py.snap | 6 +- ...sions__subscript__unclosed_slice_1.py.snap | 8 +- .../invalid_syntax@expressions__unary.py.snap | 2 +- ...pressions__unary__named_expression.py.snap | 4 +- ...xpressions__unary__no_expression_0.py.snap | 6 +- ...xpressions__unary__no_expression_1.py.snap | 6 +- ...pressions__yield__named_expression.py.snap | 4 +- ...xpressions__yield__star_expression.py.snap | 8 +- ...ns__yield_from__starred_expression.py.snap | 6 +- ...sions__yield_from__unparenthesized.py.snap | 12 +- ...d_syntax@f_string_empty_expression.py.snap | 4 +- ...g_invalid_conversion_flag_name_tok.py.snap | 2 +- ..._invalid_conversion_flag_other_tok.py.snap | 4 +- ...ntax@f_string_invalid_starred_expr.py.snap | 8 +- ..._string_lambda_without_parentheses.py.snap | 4 +- ...id_syntax@f_string_unclosed_lbrace.py.snap | 10 +- ...ing_unclosed_lbrace_in_format_spec.py.snap | 4 +- ..._syntax@for_stmt_invalid_iter_expr.py.snap | 14 +- ...lid_syntax@for_stmt_invalid_target.py.snap | 32 +- ...or_stmt_invalid_target_binary_expr.py.snap | 32 +- ...for_stmt_invalid_target_in_keyword.py.snap | 44 +- ...syntax@for_stmt_missing_in_keyword.py.snap | 8 +- ...valid_syntax@for_stmt_missing_iter.py.snap | 6 +- ...lid_syntax@for_stmt_missing_target.py.snap | 4 +- ...id_syntax@from_import_dotted_names.py.snap | 26 +- ...lid_syntax@from_import_empty_names.py.snap | 6 +- ..._syntax@from_import_missing_module.py.snap | 2 +- ...id_syntax@from_import_missing_rpar.py.snap | 12 +- ...@from_import_star_with_other_names.py.snap | 30 +- ...ort_unparenthesized_trailing_comma.py.snap | 16 +- ...lid_syntax@function_def_empty_body.py.snap | 8 +- ...x@function_def_invalid_return_expr.py.snap | 12 +- ...ax@function_def_missing_identifier.py.snap | 6 +- ...x@function_def_missing_return_type.py.snap | 2 +- ...nction_def_unclosed_parameter_list.py.snap | 22 +- ...ction_def_unclosed_type_param_list.py.snap | 16 +- ...n_def_unparenthesized_return_types.py.snap | 10 +- ...alid_syntax@global_stmt_expression.py.snap | 2 +- ..._syntax@global_stmt_trailing_comma.py.snap | 6 +- ..._syntax@if_stmt_elif_missing_colon.py.snap | 4 +- ...tax@if_stmt_invalid_elif_test_expr.py.snap | 6 +- ...d_syntax@if_stmt_invalid_test_expr.py.snap | 6 +- ...valid_syntax@if_stmt_missing_colon.py.snap | 6 +- ...nvalid_syntax@if_stmt_missing_test.py.snap | 2 +- ...lid_syntax@if_stmt_misspelled_elif.py.snap | 4 +- ...y_concatenated_unterminated_string.py.snap | 2 +- ...ated_unterminated_string_multiline.py.snap | 2 +- ...syntax@import_alias_missing_asname.py.snap | 2 +- ...ax@import_stmt_parenthesized_names.py.snap | 6 +- ...lid_syntax@import_stmt_star_import.py.snap | 8 +- ..._syntax@import_stmt_trailing_comma.py.snap | 4 +- .../invalid_syntax@invalid_del_target.py.snap | 2 +- ...ntax@lambda_body_with_starred_expr.py.snap | 20 +- ...syntax@lambda_body_with_yield_expr.py.snap | 8 +- ...d_syntax@match_classify_as_keyword.py.snap | 2 +- ..._classify_as_keyword_or_identifier.py.snap | 2 +- ...x@match_stmt_expect_indented_block.py.snap | 2 +- ...tax@match_stmt_expected_case_block.py.snap | 8 +- ...ntax@match_stmt_invalid_guard_expr.py.snap | 18 +- ...ax@match_stmt_invalid_subject_expr.py.snap | 10 +- ...ntax@match_stmt_missing_guard_expr.py.snap | 4 +- ..._syntax@match_stmt_missing_pattern.py.snap | 4 +- ...@match_stmt_no_newline_before_case.py.snap | 2 +- ...@match_stmt_single_starred_subject.py.snap | 2 +- ...ntax@multiple_clauses_on_same_line.py.snap | 12 +- ...nvalid_syntax@node_range_with_gaps.py.snap | 6 +- ...id_syntax@nonlocal_stmt_expression.py.snap | 2 +- ...yntax@nonlocal_stmt_trailing_comma.py.snap | 6 +- ...id_syntax@param_missing_annotation.py.snap | 8 +- ...valid_syntax@param_missing_default.py.snap | 10 +- ...ntax@param_with_invalid_annotation.py.snap | 20 +- ..._syntax@param_with_invalid_default.py.snap | 18 +- ...param_with_invalid_star_annotation.py.snap | 28 +- ...alid_syntax@params_duplicate_names.py.snap | 16 +- ...rams_expected_after_star_separator.py.snap | 16 +- ...@params_kwarg_after_star_separator.py.snap | 4 +- ...alid_syntax@params_multiple_kwargs.py.snap | 6 +- ...ax@params_multiple_slash_separator.py.snap | 14 +- ...tax@params_multiple_star_separator.py.snap | 14 +- ...lid_syntax@params_multiple_varargs.py.snap | 26 +- ..._syntax@params_no_arg_before_slash.py.snap | 6 +- ...x@params_non_default_after_default.py.snap | 10 +- ...lid_syntax@params_star_after_slash.py.snap | 28 +- ...ms_star_separator_after_star_param.py.snap | 18 +- ...ax@params_var_keyword_with_default.py.snap | 6 +- ...params_var_positional_with_default.py.snap | 6 +- ...id_syntax@raise_stmt_invalid_cause.py.snap | 12 +- ...alid_syntax@raise_stmt_invalid_exc.py.snap | 6 +- ...e_stmt_unparenthesized_tuple_cause.py.snap | 10 +- ...ise_stmt_unparenthesized_tuple_exc.py.snap | 12 +- ...nvalid_syntax@re_lex_logical_token.py.snap | 64 +-- ...yntax@re_lex_logical_token_mac_eol.py.snap | 10 +- ...x@re_lex_logical_token_windows_eol.py.snap | 10 +- ...x@re_lexing__fstring_format_spec_1.py.snap | 8 +- ...tax@re_lexing__line_continuation_1.py.snap | 8 +- ...ing__line_continuation_windows_eol.py.snap | 8 +- ...re_lexing__triple_quoted_fstring_1.py.snap | 2 +- ...re_lexing__triple_quoted_fstring_2.py.snap | 2 +- ...re_lexing__triple_quoted_fstring_3.py.snap | 4 +- ...id_syntax@return_stmt_invalid_expr.py.snap | 12 +- ...ple_and_compound_stmt_on_same_line.py.snap | 6 +- ...d_syntax@simple_stmts_on_same_line.py.snap | 12 +- ...atements__function_type_parameters.py.snap | 26 +- ...syntax@statements__if_extra_indent.py.snap | 6 +- ...ements__invalid_assignment_targets.py.snap | 90 ++-- ...nvalid_augmented_assignment_target.py.snap | 88 ++-- ...ax@statements__match__as_pattern_0.py.snap | 8 +- ...ax@statements__match__as_pattern_1.py.snap | 4 +- ...ax@statements__match__as_pattern_2.py.snap | 8 +- ...ax@statements__match__as_pattern_3.py.snap | 6 +- ...ax@statements__match__as_pattern_4.py.snap | 8 +- ...ents__match__invalid_class_pattern.py.snap | 26 +- ..._match__invalid_lhs_or_rhs_pattern.py.snap | 30 +- ...ts__match__invalid_mapping_pattern.py.snap | 28 +- ...tements__match__star_pattern_usage.py.snap | 24 +- ...statements__match__unary_add_usage.py.snap | 8 +- ...s__with__ambiguous_lpar_with_items.py.snap | 132 ++--- ...statements__with__empty_with_items.py.snap | 4 +- ...nts__with__unclosed_ambiguous_lpar.py.snap | 6 +- ..._with__unclosed_ambiguous_lpar_eof.py.snap | 2 +- ...__with__unparenthesized_with_items.py.snap | 28 +- ..._syntax@try_stmt_misspelled_except.py.snap | 12 +- ..._syntax@type_alias_incomplete_stmt.py.snap | 10 +- ...ntax@type_alias_invalid_value_expr.py.snap | 16 +- ...ntax@type_param_invalid_bound_expr.py.snap | 34 +- ...id_syntax@type_param_missing_bound.py.snap | 14 +- ...syntax@type_param_param_spec_bound.py.snap | 10 +- ...am_param_spec_invalid_default_expr.py.snap | 42 +- ...e_param_param_spec_missing_default.py.snap | 14 +- ...aram_type_var_invalid_default_expr.py.snap | 52 +- ...ype_param_type_var_missing_default.py.snap | 22 +- ...ax@type_param_type_var_tuple_bound.py.snap | 10 +- ...ype_var_tuple_invalid_default_expr.py.snap | 44 +- ...ram_type_var_tuple_missing_default.py.snap | 14 +- .../invalid_syntax@type_params_empty.py.snap | 8 +- ...erminated_fstring_newline_recovery.py.snap | 6 +- ...yntax@while_stmt_invalid_test_expr.py.snap | 12 +- ...id_syntax@while_stmt_missing_colon.py.snap | 2 +- ...lid_syntax@while_stmt_missing_test.py.snap | 6 +- ..._items_parenthesized_missing_colon.py.snap | 4 +- ..._items_parenthesized_missing_comma.py.snap | 32 +- ...iguous_lpar_with_items_binary_expr.py.snap | 34 +- ...@ambiguous_lpar_with_items_if_expr.py.snap | 24 +- ...ntax@ann_assign_stmt_simple_target.py.snap | 18 +- ...d_syntax@assign_targets_terminator.py.snap | 20 +- .../valid_syntax@async_for_statement.py.snap | 4 +- ...d_syntax@async_function_definition.py.snap | 2 +- .../valid_syntax@async_with_statement.py.snap | 2 +- .../valid_syntax@class_def_arguments.py.snap | 4 +- ...id_syntax@decorator_async_function.py.snap | 4 +- ...alid_syntax@del_targets_terminator.py.snap | 16 +- ...ntax@dotted_name_normalized_spaces.py.snap | 4 +- ...x@except_stmt_as_name_soft_keyword.py.snap | 12 +- ...alid_syntax@expressions__arguments.py.snap | 200 ++++---- ...alid_syntax@expressions__attribute.py.snap | 30 +- .../valid_syntax@expressions__await.py.snap | 28 +- .../valid_syntax@expressions__bin_op.py.snap | 4 +- .../valid_syntax@expressions__bool_op.py.snap | 58 +-- .../valid_syntax@expressions__call.py.snap | 18 +- .../valid_syntax@expressions__compare.py.snap | 104 ++-- ...lid_syntax@expressions__dictionary.py.snap | 70 +-- ...ressions__dictionary_comprehension.py.snap | 144 +++--- ...valid_syntax@expressions__f_string.py.snap | 80 +-- ...alid_syntax@expressions__generator.py.snap | 96 ++-- .../valid_syntax@expressions__if.py.snap | 74 +-- .../valid_syntax@expressions__lambda.py.snap | 134 ++--- .../valid_syntax@expressions__list.py.snap | 42 +- ...ax@expressions__list_comprehension.py.snap | 178 +++---- .../valid_syntax@expressions__name.py.snap | 18 +- .../valid_syntax@expressions__named.py.snap | 36 +- ...syntax@expressions__number_literal.py.snap | 98 ++-- ..._syntax@expressions__parenthesized.py.snap | 22 +- .../valid_syntax@expressions__set.py.snap | 22 +- ...tax@expressions__set_comprehension.py.snap | 112 ++--- .../valid_syntax@expressions__slice.py.snap | 38 +- .../valid_syntax@expressions__starred.py.snap | 30 +- ...alid_syntax@expressions__subscript.py.snap | 56 +-- .../valid_syntax@expressions__tuple.py.snap | 66 +-- ...valid_syntax@expressions__unary_op.py.snap | 20 +- .../valid_syntax@expressions__yield.py.snap | 38 +- ...lid_syntax@expressions__yield_from.py.snap | 28 +- ...id_syntax@for_in_target_valid_expr.py.snap | 22 +- .../valid_syntax@from_import_no_space.py.snap | 4 +- ...om_import_soft_keyword_module_name.py.snap | 16 +- ...syntax@from_import_stmt_terminator.py.snap | 36 +- ...tax@fstring_format_spec_terminator.py.snap | 4 +- ...yntax@function_def_parameter_range.py.snap | 12 +- ...ion_def_parenthesized_return_types.py.snap | 10 +- ...tax@function_def_valid_return_expr.py.snap | 22 +- .../valid_syntax@global_stmt.py.snap | 8 +- ...syntax@import_as_name_soft_keyword.py.snap | 12 +- ...alid_syntax@import_stmt_terminator.py.snap | 16 +- ...alid_syntax@lambda_with_valid_body.py.snap | 32 +- .../valid_syntax@match_as_pattern.py.snap | 4 +- ...ntax@match_as_pattern_soft_keyword.py.snap | 8 +- ...ax@match_attr_pattern_soft_keyword.py.snap | 28 +- ...tax@match_classify_as_identifier_1.py.snap | 4 +- ...tax@match_classify_as_identifier_2.py.snap | 46 +- ...syntax@match_classify_as_keyword_1.py.snap | 14 +- ...syntax@match_classify_as_keyword_2.py.snap | 6 +- ..._classify_as_keyword_or_identifier.py.snap | 14 +- ...nce_pattern_parentheses_terminator.py.snap | 10 +- ...@match_sequence_pattern_terminator.py.snap | 18 +- ...lid_syntax@match_stmt_subject_expr.py.snap | 12 +- ...syntax@match_stmt_valid_guard_expr.py.snap | 28 +- .../valid_syntax@nonlocal_stmt.py.snap | 8 +- .../valid_syntax@other__decorator.py.snap | 74 +-- ...valid_syntax@param_with_annotation.py.snap | 28 +- .../valid_syntax@param_with_default.py.snap | 24 +- ..._syntax@param_with_star_annotation.py.snap | 16 +- ...ntax@params_non_default_after_star.py.snap | 22 +- ...seen_keyword_only_param_after_star.py.snap | 12 +- ...valid_syntax@simple_stmts_in_block.py.snap | 2 +- ...yntax@simple_stmts_with_semicolons.py.snap | 12 +- ...atement__ambiguous_lpar_with_items.py.snap | 304 +++++------ ...ax@statement__annotated_assignment.py.snap | 30 +- .../valid_syntax@statement__assert.py.snap | 34 +- ...valid_syntax@statement__assignment.py.snap | 64 +-- ...ax@statement__augmented_assignment.py.snap | 44 +- .../valid_syntax@statement__class.py.snap | 138 ++--- .../valid_syntax@statement__delete.py.snap | 46 +- .../valid_syntax@statement__for.py.snap | 92 ++-- ...alid_syntax@statement__from_import.py.snap | 42 +- .../valid_syntax@statement__function.py.snap | 380 +++++++------- .../valid_syntax@statement__if.py.snap | 40 +- .../valid_syntax@statement__import.py.snap | 22 +- .../valid_syntax@statement__match.py.snap | 472 +++++++++--------- .../valid_syntax@statement__raise.py.snap | 54 +- .../valid_syntax@statement__return.py.snap | 30 +- .../valid_syntax@statement__simple.py.snap | 20 +- .../valid_syntax@statement__try.py.snap | 96 ++-- .../valid_syntax@statement__type.py.snap | 420 ++++++++-------- .../valid_syntax@statement__while.py.snap | 32 +- .../valid_syntax@statement__with.py.snap | 38 +- ...valid_syntax@type_param_param_spec.py.snap | 32 +- .../valid_syntax@type_param_type_var.py.snap | 54 +- ...d_syntax@type_param_type_var_tuple.py.snap | 40 +- crates/ruff_python_semantic/src/model.rs | 6 +- crates/ruff_workspace/src/options.rs | 29 +- 465 files changed, 4866 insertions(+), 4727 deletions(-) delete mode 100644 crates/red_knot_python_semantic/src/name.rs diff --git a/Cargo.lock b/Cargo.lock index 4218fe686ed72..462a77f978376 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1900,7 +1900,6 @@ dependencies = [ "rustc-hash 2.0.0", "salsa", "smallvec", - "smol_str", "tracing", ] @@ -2262,11 +2261,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]] diff --git a/crates/red_knot_python_semantic/Cargo.toml b/crates/red_knot_python_semantic/Cargo.toml index cbf436fb47546..cc273e4eccdde 100644 --- a/crates/red_knot_python_semantic/Cargo.toml +++ b/crates/red_knot_python_semantic/Cargo.toml @@ -21,7 +21,6 @@ bitflags = { workspace = true } indexmap = { workspace = true } salsa = { workspace = true } smallvec = { workspace = true } -smol_str = { workspace = true } tracing = { workspace = true } rustc-hash = { workspace = true } hashbrown = { workspace = true } diff --git a/crates/red_knot_python_semantic/src/lib.rs b/crates/red_knot_python_semantic/src/lib.rs index 64e73d1f291df..436fd07f4cff1 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 78a9e4cfc2c40..0000000000000 --- 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 b60a008ed981c..32e152399e289 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, @@ -133,7 +133,6 @@ impl<'a> SemanticIndexBuilder<'a> { fn add_or_update_symbol_with_definition( &mut self, name: Name, - definition: Definition, ) -> ScopedSymbolId { let symbol_table = self.current_symbol_table(); @@ -168,7 +167,7 @@ impl<'a> SemanticIndexBuilder<'a> { ast::TypeParam::ParamSpec(ast::TypeParamParamSpec { name, .. }) => name, ast::TypeParam::TypeVarTuple(ast::TypeParamTypeVarTuple { name, .. }) => name, }; - self.add_or_update_symbol(Name::new(name), SymbolFlags::IS_DEFINED); + self.add_or_update_symbol(name.id.clone(), SymbolFlags::IS_DEFINED); } } @@ -233,7 +232,7 @@ impl Visitor<'_> for SemanticIndexBuilder<'_> { for decorator in &function_def.decorator_list { self.visit_decorator(decorator); } - let name = Name::new(&function_def.name.id); + let name = &function_def.name.id; let function_id = ScopeFunctionId(statement_id); let definition = Definition::FunctionDef(function_id); let scope = self.current_scope(); @@ -271,7 +270,7 @@ impl Visitor<'_> for SemanticIndexBuilder<'_> { self.visit_decorator(decorator); } - let name = Name::new(&class.name.id); + let name = &class.name.id; let class_id = ScopeClassId(statement_id); let definition = Definition::from(class_id); let scope = self.current_scope(); @@ -306,16 +305,16 @@ impl Visitor<'_> for SemanticIndexBuilder<'_> { ast::Stmt::Import(ast::StmtImport { names, .. }) => { for (i, alias) in names.iter().enumerate() { let symbol_name = if let Some(asname) = &alias.asname { - asname.id.as_str() + asname.id.clone() } else { - alias.name.id.split('.').next().unwrap() + Name::new(alias.name.id.split('.').next().unwrap()) }; let def = Definition::Import(ImportDefinition { import_id: ScopeImportId(statement_id), alias: u32::try_from(i).unwrap(), }); - self.add_or_update_symbol_with_definition(Name::new(symbol_name), def); + self.add_or_update_symbol_with_definition(symbol_name, def); } } ast::Stmt::ImportFrom(ast::StmtImportFrom { @@ -326,15 +325,15 @@ impl Visitor<'_> for SemanticIndexBuilder<'_> { }) => { for (i, alias) in names.iter().enumerate() { let symbol_name = if let Some(asname) = &alias.asname { - asname.id.as_str() + &asname.id } else { - alias.name.id.as_str() + &alias.name.id }; let def = Definition::ImportFrom(ImportFromDefinition { import_id: ScopeImportFromId(statement_id), name: u32::try_from(i).unwrap(), }); - self.add_or_update_symbol_with_definition(Name::new(symbol_name), def); + self.add_or_update_symbol_with_definition(symbol_name.clone(), def); } } ast::Stmt::Assign(node) => { @@ -375,10 +374,10 @@ impl Visitor<'_> for SemanticIndexBuilder<'_> { }; match self.current_definition { Some(definition) if flags.contains(SymbolFlags::IS_DEFINED) => { - self.add_or_update_symbol_with_definition(Name::new(id), definition); + self.add_or_update_symbol_with_definition(id.clone(), definition); } _ => { - self.add_or_update_symbol(Name::new(id), flags); + self.add_or_update_symbol(id.clone(), flags); } } 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 62282a1a5f155..ac447d3eee64a 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 54c0a92c40e07..e47870b960e40 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 9b1728d16c6bc..bfdba6d606178 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 6de9c25420ded..6b0eaeda0b6be 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 51ada8f45d37b..b4bb20a5dbf16 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 870525d9ad5de..9836f230e7b9b 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 fd5b66cd4e288..1cea0f6135233 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 eec91be60eb18..09d440526eb06 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 76180b45ac59d..491868ab997c8 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 50f67c164be92..3799ae8763bf0 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(), })), @@ -154,7 +155,7 @@ pub(crate) fn unnecessary_type_union<'a>(checker: &mut Checker, union: &'a Expr) let elts: Vec = type_exprs.into_iter().cloned().collect(); 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_pytest_style/rules/unittest_assert.rs b/crates/ruff_linter/src/rules/flake8_pytest_style/rules/unittest_assert.rs index 3469368326351..b4e4d5fafe462 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/rules/unittest_assert.rs +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/rules/unittest_assert.rs @@ -1,4 +1,5 @@ use anyhow::{anyhow, bail, Result}; +use ruff_python_ast::name::Name; use ruff_python_ast::{ self as ast, Arguments, CmpOp, Expr, ExprContext, Identifier, Keyword, Stmt, UnaryOp, }; @@ -379,7 +380,7 @@ impl UnittestAssert { .ok_or_else(|| anyhow!("Missing argument `cls`"))?; let msg = args.get("msg").copied(); let node = ast::ExprName { - id: "isinstance".into(), + id: Name::new_static("isinstance"), ctx: ExprContext::Load, range: TextRange::default(), }; @@ -417,7 +418,7 @@ impl UnittestAssert { .ok_or_else(|| anyhow!("Missing argument `regex`"))?; let msg = args.get("msg").copied(); let node = ast::ExprName { - id: "re".into(), + id: Name::new_static("re"), 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 70f1557c5ec1a..d870d85f9fcb1 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 0802caa578420..aa592c828523b 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 cb3027fa90c23..a6d9f1dde3c0e 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/flake8_simplify/rules/ast_bool_op.rs b/crates/ruff_linter/src/rules/flake8_simplify/rules/ast_bool_op.rs index 9e64c26178bcf..43c7d93f943c1 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/rules/ast_bool_op.rs +++ b/crates/ruff_linter/src/rules/flake8_simplify/rules/ast_bool_op.rs @@ -10,6 +10,7 @@ use ruff_diagnostics::{AlwaysFixableViolation, Diagnostic, Edit, Fix, FixAvailab use ruff_macros::{derive_message_formats, violation}; use ruff_python_ast::comparable::ComparableExpr; use ruff_python_ast::helpers::{contains_effect, Truthiness}; +use ruff_python_ast::name::Name; use ruff_python_ast::parenthesize::parenthesized_range; use ruff_python_codegen::Generator; use ruff_python_semantic::SemanticModel; @@ -425,7 +426,7 @@ pub(crate) fn duplicate_isinstance_call(checker: &mut Checker, expr: &Expr) { let isinstance_call = ast::ExprCall { func: Box::new( ast::ExprName { - id: "isinstance".into(), + id: Name::new_static("isinstance"), ctx: ExprContext::Load, range: TextRange::default(), } @@ -469,7 +470,7 @@ pub(crate) fn duplicate_isinstance_call(checker: &mut Checker, expr: &Expr) { } } -fn match_eq_target(expr: &Expr) -> Option<(&str, &Expr)> { +fn match_eq_target(expr: &Expr) -> Option<(&Name, &Expr)> { let Expr::Compare(ast::ExprCompare { left, ops, @@ -482,7 +483,7 @@ fn match_eq_target(expr: &Expr) -> Option<(&str, &Expr)> { if **ops != [CmpOp::Eq] { return None; } - let Expr::Name(ast::ExprName { id, .. }) = left.as_ref() else { + let Expr::Name(ast::ExprName { id, .. }) = &**left else { return None; }; let [comparator] = &**comparators else { @@ -507,7 +508,7 @@ pub(crate) fn compare_with_tuple(checker: &mut Checker, expr: &Expr) { // Given `a == "foo" or a == "bar"`, we generate `{"a": [(0, "foo"), (1, // "bar")]}`. - let mut id_to_comparators: BTreeMap<&str, Vec<(usize, &Expr)>> = BTreeMap::new(); + let mut id_to_comparators: BTreeMap<&Name, Vec<(usize, &Expr)>> = BTreeMap::new(); for (index, value) in values.iter().enumerate() { if let Some((id, comparator)) = match_eq_target(value) { id_to_comparators @@ -548,7 +549,7 @@ pub(crate) fn compare_with_tuple(checker: &mut Checker, expr: &Expr) { parenthesized: true, }; let node1 = ast::ExprName { - id: id.into(), + id: id.clone(), ctx: ExprContext::Load, range: TextRange::default(), }; diff --git a/crates/ruff_linter/src/rules/flake8_simplify/rules/ast_ifexp.rs b/crates/ruff_linter/src/rules/flake8_simplify/rules/ast_ifexp.rs index fe157f721963a..2d54023f2649b 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/rules/ast_ifexp.rs +++ b/crates/ruff_linter/src/rules/flake8_simplify/rules/ast_ifexp.rs @@ -4,6 +4,7 @@ use ruff_text_size::{Ranged, TextRange}; use ruff_diagnostics::{AlwaysFixableViolation, Diagnostic, Edit, Fix, FixAvailability, Violation}; use ruff_macros::{derive_message_formats, violation}; use ruff_python_ast::helpers::{is_const_false, is_const_true}; +use ruff_python_ast::name::Name; use ruff_python_ast::parenthesize::parenthesized_range; use crate::checkers::ast::Checker; @@ -178,7 +179,7 @@ pub(crate) fn if_expr_with_true_false( &ast::ExprCall { func: Box::new( ast::ExprName { - id: "bool".into(), + id: Name::new_static("bool"), ctx: ExprContext::Load, range: TextRange::default(), } diff --git a/crates/ruff_linter/src/rules/flake8_simplify/rules/ast_unary_op.rs b/crates/ruff_linter/src/rules/flake8_simplify/rules/ast_unary_op.rs index c30d511ea90dc..02526e4509644 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/rules/ast_unary_op.rs +++ b/crates/ruff_linter/src/rules/flake8_simplify/rules/ast_unary_op.rs @@ -3,6 +3,7 @@ use ruff_text_size::{Ranged, TextRange}; use ruff_diagnostics::{AlwaysFixableViolation, Diagnostic, Edit, Fix}; use ruff_macros::{derive_message_formats, violation}; +use ruff_python_ast::name::Name; use ruff_python_semantic::ScopeKind; use crate::checkers::ast::Checker; @@ -272,7 +273,7 @@ pub(crate) fn double_negation(checker: &mut Checker, expr: &Expr, op: UnaryOp, o ))); } else if checker.semantic().has_builtin_binding("bool") { let node = ast::ExprName { - id: "bool".into(), + id: Name::new_static("bool"), ctx: ExprContext::Load, range: TextRange::default(), }; diff --git a/crates/ruff_linter/src/rules/flake8_simplify/rules/needless_bool.rs b/crates/ruff_linter/src/rules/flake8_simplify/rules/needless_bool.rs index c6ce049a97135..569e53bf2b3d2 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/rules/needless_bool.rs +++ b/crates/ruff_linter/src/rules/flake8_simplify/rules/needless_bool.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::traversal; use ruff_python_ast::{self as ast, Arguments, ElifElseClause, Expr, ExprContext, Stmt}; use ruff_python_semantic::analyze::typing::{is_sys_version_block, is_type_checking_block}; @@ -226,7 +227,7 @@ pub(crate) fn needless_bool(checker: &mut Checker, stmt: &Stmt) { } else if checker.semantic().has_builtin_binding("bool") { // Otherwise, we need to wrap the condition in a call to `bool`. let func_node = ast::ExprName { - id: "bool".into(), + id: Name::new_static("bool"), ctx: ExprContext::Load, range: TextRange::default(), }; diff --git a/crates/ruff_linter/src/rules/flake8_simplify/rules/reimplemented_builtin.rs b/crates/ruff_linter/src/rules/flake8_simplify/rules/reimplemented_builtin.rs index 2ae49cf068f80..a155ed774cd37 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/rules/reimplemented_builtin.rs +++ b/crates/ruff_linter/src/rules/flake8_simplify/rules/reimplemented_builtin.rs @@ -1,6 +1,7 @@ use ruff_diagnostics::{Diagnostic, Edit, Fix, FixAvailability, Violation}; use ruff_macros::{derive_message_formats, violation}; use ruff_python_ast::helpers::any_over_expr; +use ruff_python_ast::name::Name; use ruff_python_ast::traversal; use ruff_python_ast::{ self as ast, Arguments, CmpOp, Comprehension, Expr, ExprContext, Stmt, UnaryOp, @@ -89,7 +90,7 @@ pub(crate) fn convert_for_loop_to_any_all(checker: &mut Checker, stmt: &Stmt) { // Replace with `any`. (true, false) => { let contents = return_stmt( - "any", + Name::new_static("any"), loop_.test, loop_.target, loop_.iter, @@ -177,7 +178,13 @@ pub(crate) fn convert_for_loop_to_any_all(checker: &mut Checker, stmt: &Stmt) { node.into() } }; - let contents = return_stmt("all", &test, loop_.target, loop_.iter, checker.generator()); + let contents = return_stmt( + Name::new_static("all"), + &test, + loop_.target, + loop_.iter, + checker.generator(), + ); // Don't flag if the resulting expression would exceed the maximum line length. let line_start = checker.locator().line_start(stmt.start()); @@ -372,7 +379,7 @@ fn match_sibling_return<'a>(stmt: &'a Stmt, sibling: &'a Stmt) -> Option String { +fn return_stmt(id: Name, test: &Expr, target: &Expr, iter: &Expr, generator: Generator) -> String { let node = ast::ExprGenerator { elt: Box::new(test.clone()), generators: vec![Comprehension { @@ -386,7 +393,7 @@ fn return_stmt(id: &str, test: &Expr, target: &Expr, iter: &Expr, generator: Gen parenthesized: false, }; let node1 = ast::ExprName { - id: id.into(), + id, ctx: ExprContext::Load, range: TextRange::default(), }; diff --git a/crates/ruff_linter/src/rules/pyflakes/format.rs b/crates/ruff_linter/src/rules/pyflakes/format.rs index bdedd04398075..f53d7acfa1b66 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 d61c501bde69f..811bf7c26e52f 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 efc31b4e1cf08..ad2ef7e8d9903 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 49d22f2fb30e7..e6421bd2a7d49 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 cb0dbc5175f2b..5952a462695f9 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/convert_named_tuple_functional_to_class.rs b/crates/ruff_linter/src/rules/pyupgrade/rules/convert_named_tuple_functional_to_class.rs index 20d29a698f891..ab39ca1bfe36b 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/rules/convert_named_tuple_functional_to_class.rs +++ b/crates/ruff_linter/src/rules/pyupgrade/rules/convert_named_tuple_functional_to_class.rs @@ -3,6 +3,7 @@ use log::debug; use ruff_diagnostics::{Diagnostic, Edit, Fix, FixAvailability, Violation}; use ruff_macros::{derive_message_formats, violation}; use ruff_python_ast::helpers::is_dunder; +use ruff_python_ast::name::Name; use ruff_python_ast::{self as ast, Arguments, Expr, ExprContext, Identifier, Keyword, Stmt}; use ruff_python_codegen::Generator; use ruff_python_semantic::SemanticModel; @@ -148,11 +149,11 @@ fn match_named_tuple_assign<'a>( } /// Generate a [`Stmt::AnnAssign`] representing the provided field definition. -fn create_field_assignment_stmt(field: &str, annotation: &Expr) -> Stmt { +fn create_field_assignment_stmt(field: Name, annotation: &Expr) -> Stmt { ast::StmtAnnAssign { target: Box::new( ast::ExprName { - id: field.into(), + id: field, ctx: ExprContext::Load, range: TextRange::default(), } @@ -191,7 +192,10 @@ fn create_fields_from_fields_arg(fields: &Expr) -> Option> { if is_dunder(field.to_str()) { return None; } - Some(create_field_assignment_stmt(field.to_str(), annotation)) + Some(create_field_assignment_stmt( + Name::new(field.to_str()), + annotation, + )) }) .collect() } @@ -205,7 +209,7 @@ fn create_fields_from_keywords(keywords: &[Keyword]) -> Option> { keyword .arg .as_ref() - .map(|field| create_field_assignment_stmt(field.as_str(), &keyword.value)) + .map(|field| create_field_assignment_stmt(field.id.clone(), &keyword.value)) }) .collect() } diff --git a/crates/ruff_linter/src/rules/pyupgrade/rules/os_error_alias.rs b/crates/ruff_linter/src/rules/pyupgrade/rules/os_error_alias.rs index d14297d581919..677eaa57c4879 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/rules/os_error_alias.rs +++ b/crates/ruff_linter/src/rules/pyupgrade/rules/os_error_alias.rs @@ -4,7 +4,7 @@ use ruff_text_size::{Ranged, TextRange}; use crate::fix::edits::pad; use ruff_diagnostics::{AlwaysFixableViolation, Diagnostic, Edit, Fix}; use ruff_macros::{derive_message_formats, violation}; -use ruff_python_ast::name::UnqualifiedName; +use ruff_python_ast::name::{Name, UnqualifiedName}; use ruff_python_semantic::SemanticModel; use crate::checkers::ast::Checker; @@ -116,7 +116,7 @@ fn tuple_diagnostic(checker: &mut Checker, tuple: &ast::ExprTuple, aliases: &[&E .all(|elt| !semantic.match_builtin_expr(elt, "OSError")) { let node = ast::ExprName { - id: "OSError".into(), + id: Name::new_static("OSError"), ctx: ExprContext::Load, range: TextRange::default(), }; diff --git a/crates/ruff_linter/src/rules/pyupgrade/rules/timeout_error_alias.rs b/crates/ruff_linter/src/rules/pyupgrade/rules/timeout_error_alias.rs index 6af259104f8a3..97ee95df9c877 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/rules/timeout_error_alias.rs +++ b/crates/ruff_linter/src/rules/pyupgrade/rules/timeout_error_alias.rs @@ -4,7 +4,7 @@ use ruff_text_size::{Ranged, TextRange}; use crate::fix::edits::pad; use ruff_diagnostics::{AlwaysFixableViolation, Diagnostic, Edit, Fix}; use ruff_macros::{derive_message_formats, violation}; -use ruff_python_ast::name::UnqualifiedName; +use ruff_python_ast::name::{Name, UnqualifiedName}; use ruff_python_semantic::SemanticModel; use crate::checkers::ast::Checker; @@ -128,7 +128,7 @@ fn tuple_diagnostic(checker: &mut Checker, tuple: &ast::ExprTuple, aliases: &[&E .all(|elt| !semantic.match_builtin_expr(elt, "TimeoutError")) { let node = ast::ExprName { - id: "TimeoutError".into(), + id: Name::new_static("TimeoutError"), ctx: ExprContext::Load, range: TextRange::default(), }; 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 670954e408f24..dc3072ff08396 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 97823d2032d25..d82f105d9b29c 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 1b0e610bdbe54..21c21f282192f 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 6ca6446262bcb..4692674b0327a 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 4cc61ba619393..1d47662dc3e69 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 3d4e6a203d8a1..776623bfd293e 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 fca0a99edc8e4..6f714b99c6f4e 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 dc2a85a1207d3..5455233b8fec0 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 844bc71a9c976..8fd1769d72cd7 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 6cea64454b89f..2a06f9d993691 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 f187429ab1b27..cde90b1fbfa7c 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,16 @@ 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 + +[package.metadata.cargo-shear] +# Used via `CacheKey` macro expansion. +ignored = ["ruff_cache"] diff --git a/crates/ruff_python_ast/src/helpers.rs b/crates/ruff_python_ast/src/helpers.rs index 86e9d8c61b8b7..6613bd9dd0bf1 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 1fee147b2872f..709b7ad881514 100644 --- a/crates/ruff_python_ast/src/name.rs +++ b/crates/ruff_python_ast/src/name.rs @@ -1,8 +1,170 @@ +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(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 Debug for Name { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + write!(f, "Name({:?})", self.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] + 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 294dc1186e171..e8dbc969f1751 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,10 +2735,16 @@ impl From for Expr { #[derive(Clone, Debug, PartialEq)] pub struct ExprName { pub range: TextRange, - pub id: String, + pub id: Name, pub ctx: ExprContext, } +impl ExprName { + pub fn id(&self) -> &Name { + &self.id + } +} + impl From for Expr { fn from(payload: ExprName) -> Self { Expr::Name(payload) @@ -3763,13 +3764,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, @@ -3798,7 +3799,7 @@ impl PartialEq for Identifier { impl PartialEq for Identifier { #[inline] fn eq(&self, other: &String) -> bool { - &self.id == other + self.id == other } } @@ -3817,22 +3818,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_parser/src/lexer.rs b/crates/ruff_python_parser/src/lexer.rs index 1aeafd3487923..d407ab357e68f 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 dda172ee2127f..61060f9e34ce5 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.into_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 88079c60ed11d..0685913e3b655 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 8687b8c95f5eb..1dd4489a8c085 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 3f8f1ed6de3fa..a3f88a0bb02f5 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,11 @@ --- 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 cc658cadf8fed..d365ad36534c5 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,7 @@ Module( left: Name( ExprName { range: 27..28, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -23,7 +23,7 @@ Module( right: Name( ExprName { range: 39..40, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -128,7 +128,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 570..573, }, type_params: None, @@ -152,7 +152,7 @@ Module( left: Name( ExprName { range: 598..599, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -163,7 +163,7 @@ Module( Name( ExprName { range: 619..620, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -204,7 +204,7 @@ Module( target: Name( ExprName { range: 715..716, - id: "a", + id: Name("a"), ctx: Store, }, ), @@ -214,7 +214,7 @@ Module( func: Name( ExprName { range: 720..725, - id: "range", + id: Name("range"), ctx: Load, }, ), @@ -253,7 +253,7 @@ Module( Name( ExprName { range: 739..741, - id: "p1", + id: Name("p1"), ctx: Store, }, ), @@ -273,14 +273,14 @@ 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 +303,7 @@ Module( Name( ExprName { range: 764..767, - id: "foo", + id: Name("foo"), ctx: Store, }, ), @@ -331,7 +331,7 @@ 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 67b838399a31e..12dbd525ae5c4 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,7 @@ 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 0ae5a02dce139..d09183b8eeba2 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 248f1eab3feb0..4a1d92e345dfb 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,7 @@ 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 ea400d2e3b47c..f8ffac258640e 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,7 @@ 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 9ae6aaa3cfa24..ae884918e10cf 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,7 @@ expression: "lex_source_with_offset(source, TextSize::new(7))" [ ( Name( - "y", + Name("y"), ), 7..8, ), @@ -17,7 +17,7 @@ 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 a6e704c18f3fc..e7376dbf3b121 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,7 @@ 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 698e077bffe75..52f55ab814a36 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,7 @@ expression: lex_source(source) ), ( Name( - "first", + Name("first"), ), 3..8, ), @@ -33,7 +33,7 @@ expression: lex_source(source) ), ( Name( - "second", + Name("second"), ), 17..23, ), @@ -63,7 +63,7 @@ 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 f877c10beee72..ccb4c9f10783f 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,7 @@ expression: double_dedent_with_eol(MAC_EOL) ), ( Name( - "foo", + Name("foo"), ), 4..7, ), @@ -41,7 +41,7 @@ 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 7c2082732f60d..974da6fd829d6 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,7 @@ expression: double_dedent_with_tabs_eol(MAC_EOL) ), ( Name( - "foo", + Name("foo"), ), 4..7, ), @@ -41,7 +41,7 @@ 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 214b1734108d3..1e0460ca79639 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,7 @@ expression: double_dedent_with_tabs_eol(UNIX_EOL) ), ( Name( - "foo", + Name("foo"), ), 4..7, ), @@ -41,7 +41,7 @@ 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 79bb8e6f48e9d..6c431603c10ae 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,7 @@ expression: double_dedent_with_tabs_eol(WINDOWS_EOL) ), ( Name( - "foo", + Name("foo"), ), 4..7, ), @@ -41,7 +41,7 @@ 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 a01a3dd252957..220b1d6e01f51 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,7 @@ expression: double_dedent_with_eol(UNIX_EOL) ), ( Name( - "foo", + Name("foo"), ), 4..7, ), @@ -41,7 +41,7 @@ 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 2f84b6b91a9d2..3aee0e3cb69b7 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,7 @@ expression: double_dedent_with_eol(WINDOWS_EOL) ), ( Name( - "foo", + Name("foo"), ), 4..7, ), @@ -41,7 +41,7 @@ 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 cd6778a73adad..9bb046096b514 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,7 @@ expression: lex_source(source) ), ( Name( - "foo", + Name("foo"), ), 10..13, ), @@ -50,7 +50,7 @@ expression: lex_source(source) ), ( Name( - "bar", + Name("bar"), ), 28..31, ), @@ -73,7 +73,7 @@ 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 8eb4842ebb8e9..32c1e8d641f4e 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,7 @@ 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 bcda1c925b961..134d038e21a7c 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,7 @@ expression: lex_source(source) ), ( Name( - "x", + Name("x"), ), 3..4, ), @@ -28,7 +28,7 @@ expression: lex_source(source) ), ( Name( - "s", + Name("s"), ), 5..6, ), @@ -51,7 +51,7 @@ expression: lex_source(source) ), ( Name( - "x", + Name("x"), ), 9..10, ), @@ -65,7 +65,7 @@ expression: lex_source(source) ), ( Name( - "r", + Name("r"), ), 12..13, ), @@ -88,7 +88,7 @@ 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 b581901ed9421..081742afc5376 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,7 @@ expression: lex_source(source) ), ( Name( - "x", + Name("x"), ), 4..5, ), @@ -50,7 +50,7 @@ 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 d8d007d560fb1..a225b449f5f40 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,7 @@ expression: lex_source(source) ), ( Name( - "foo", + Name("foo"), ), 4..7, ), @@ -64,7 +64,7 @@ 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 e92513e5bb596..f0efc08a4ff16 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,7 @@ expression: lex_source(source) ), ( Name( - "x", + Name("x"), ), 5..6, ), @@ -50,7 +50,7 @@ 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 fef1db4f33e69..e3726a139cf23 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,7 @@ expression: lex_source(source) ), ( Name( - "x", + Name("x"), ), 14..15, ), @@ -49,7 +49,7 @@ 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 0393d76865383..c69eddd664510 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,7 @@ 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 760a7153741bb..3f678f2a81856 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,7 @@ 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 3e82eadf77de6..1aff2fa9086e9 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,7 @@ expression: lex_source(source) ), ( Name( - "x", + Name("x"), ), 14..15, ), @@ -68,7 +68,7 @@ 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 8157de849c983..a4df0afe76013 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,7 @@ expression: lex_source(source) ), ( Name( - "foo", + Name("foo"), ), 3..6, ), @@ -45,7 +45,7 @@ expression: lex_source(source) ), ( Name( - "x", + Name("x"), ), 10..11, ), @@ -59,7 +59,7 @@ expression: lex_source(source) ), ( Name( - "s", + Name("s"), ), 13..14, ), @@ -95,7 +95,7 @@ expression: lex_source(source) ), ( Name( - "x", + Name("x"), ), 21..22, ), @@ -118,7 +118,7 @@ expression: lex_source(source) ), ( Name( - "y", + Name("y"), ), 25..26, ), @@ -222,7 +222,7 @@ expression: lex_source(source) ), ( Name( - "x", + Name("x"), ), 46..47, ), @@ -254,7 +254,7 @@ 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 7c749c92e7782..2ca6afe74c8d2 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,7 @@ 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 5fde2adc2c307..fedc3ab67ce2b 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,7 @@ expression: lex_source(source) ), ( Name( - "x", + Name("x"), ), 10..11, ), @@ -36,7 +36,7 @@ expression: lex_source(source) ), ( Name( - "x", + Name("x"), ), 13..14, ), @@ -80,7 +80,7 @@ expression: lex_source(source) ), ( Name( - "x", + Name("x"), ), 29..30, ), @@ -94,7 +94,7 @@ 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 4e46987c1242e..a48bb8b3c2664 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,7 @@ expression: lex_source(source) ), ( Name( - "x", + Name("x"), ), 12..13, ), @@ -98,7 +98,7 @@ expression: lex_source(source) ), ( Name( - "x", + Name("x"), ), 35..36, ), @@ -165,7 +165,7 @@ expression: lex_source(source) ), ( Name( - "x", + Name("x"), ), 78..79, ), @@ -236,7 +236,7 @@ expression: lex_source(source) ), ( Name( - "x", + Name("x"), ), 97..98, ), @@ -259,7 +259,7 @@ 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 900373f25c231..d202f0fa66697 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,7 @@ expression: lex_source(source) ), ( Name( - "x", + Name("x"), ), 3..4, ), @@ -58,7 +58,7 @@ expression: lex_source(source) ), ( Name( - "x", + Name("x"), ), 12..13, ), @@ -95,7 +95,7 @@ expression: lex_source(source) ), ( Name( - "x", + Name("x"), ), 21..22, ), @@ -109,7 +109,7 @@ expression: lex_source(source) ), ( Name( - "y", + Name("y"), ), 24..25, ), @@ -150,7 +150,7 @@ 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 be043b9151f15..60a396cb45373 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,7 @@ 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 7f92d8a8df78a..e7eda48572a91 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,7 @@ 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 e7c4cdb3f0519..d5966f6c555b4 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,7 @@ 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 32a7e56eea8ef..232b1d850f8b9 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,7 @@ expression: lex_jupyter_source(source) [ ( Name( - "pwd", + Name("pwd"), ), 0..3, ), @@ -28,7 +28,7 @@ expression: lex_jupyter_source(source) ), ( Name( - "foo", + Name("foo"), ), 11..14, ), @@ -49,7 +49,7 @@ expression: lex_jupyter_source(source) ), ( Name( - "bar", + Name("bar"), ), 31..34, ), @@ -70,7 +70,7 @@ 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 d56f39910dcec..a8c2f875ea84e 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,7 @@ expression: lex_jupyter_source(source) ), ( Name( - "foo", + Name("foo"), ), 6..9, ), @@ -33,7 +33,7 @@ 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 d167752f78baa..f9e862dc9fa37 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,7 @@ 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 6355d419f262f..82230da340b53 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,7 @@ 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 cfcd1f7ea18f4..b1901506c7525 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,7 @@ 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 afa779ea6dbc7..cb104bf04527f 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,7 @@ 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 c4c27935f6aa9..1fb97ef52c06a 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,7 @@ expression: parse_ast expression: Name( ExprName { range: 6..9, - id: "bbb", + id: Name("bbb"), ctx: Load, }, ), @@ -48,7 +48,7 @@ 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 430790e6db494..ac60d76a170db 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,7 @@ 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 60f99a5cdf406..0c9226d1bc0f0 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,7 @@ 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 fc2a429ff0989..c4309c2577625 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,7 @@ 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 e464a815eaeed..f7b2fe35ad03c 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,7 @@ 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 01a3d6f58a5fc..378a47ac0b1fb 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,7 @@ expression: parse_ast expression: Name( ExprName { range: 7..11, - id: "user", + id: Name("user"), ctx: Load, }, ), @@ -53,7 +53,7 @@ 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 47713a069b541..e1fe9b94f7cf0 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,7 @@ 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 a98031a67ce51..19af05c8817fd 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,7 @@ 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 92ff6491c8273..d482341170889 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,7 @@ expression: parse_ast expression: Name( ExprName { range: 3..4, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -36,7 +36,7 @@ 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 6a524b9a69c62..1ffe597771925 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,7 @@ 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 90f01e11808a7..0a3252e55a2e8 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,7 @@ expression: parse_ast expression: Name( ExprName { range: 3..6, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -37,7 +37,7 @@ 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 cffbb7ddc0efc..e93879ed2e5e1 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,7 @@ 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 77879b89dac8f..013a9e508cbf3 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,7 @@ 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 11c92c78045c0..aae76973564d3 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,7 @@ 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 6ea7dcb6ed331..d571a2b65a4f2 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,7 @@ 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 5349caaa761cf..b82aeffc63e08 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,7 @@ 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 00ad084ed6c2a..519c65e04cc0c 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,7 @@ 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 4e6ee1bcc13fe..9c240f4964e5b 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 0b0e968b41c13..79252b34afdbd 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,7 @@ Module( target: Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -25,7 +25,7 @@ Module( value: Name( ExprName { range: 4..7, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -51,7 +51,7 @@ Module( target: Name( ExprName { range: 12..13, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -62,7 +62,7 @@ Module( Name( ExprName { range: 21..22, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -88,7 +88,7 @@ Module( target: Name( ExprName { range: 27..28, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -98,7 +98,7 @@ Module( value: Name( ExprName { range: 41..42, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -123,14 +123,14 @@ 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 +145,7 @@ 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 aa00e7545ddf2..2807b901727b5 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,7 @@ Module( annotation: Name( ExprName { range: 7..10, - id: "str", + id: Name("str"), ctx: Load, }, ), @@ -69,7 +69,7 @@ Module( func: Name( ExprName { range: 19..23, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -83,7 +83,7 @@ Module( annotation: Name( ExprName { range: 27..30, - id: "str", + id: Name("str"), ctx: Load, }, ), @@ -119,7 +119,7 @@ Module( value: Name( ExprName { range: 39..40, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -129,7 +129,7 @@ Module( annotation: Name( ExprName { range: 42..45, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -173,7 +173,7 @@ Module( Name( ExprName { range: 72..73, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -185,7 +185,7 @@ Module( annotation: Name( ExprName { range: 76..79, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -212,14 +212,14 @@ 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 +231,7 @@ Module( annotation: Name( ExprName { range: 90..93, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -275,14 +275,14 @@ 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 +294,7 @@ Module( annotation: Name( ExprName { range: 109..112, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -338,7 +338,7 @@ Module( Name( ExprName { range: 139..140, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -349,7 +349,7 @@ Module( annotation: Name( ExprName { range: 143..146, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -376,14 +376,14 @@ 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 +394,7 @@ 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 0528b96f48c78..714c5d29f5524 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,14 @@ 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 +38,14 @@ 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 +65,14 @@ 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 +80,7 @@ Module( Name( ExprName { range: 27..28, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -107,14 +107,14 @@ 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 +126,7 @@ Module( Name( ExprName { range: 45..46, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -139,7 +139,7 @@ Module( left: Name( ExprName { range: 49..50, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -147,7 +147,7 @@ Module( right: Name( ExprName { range: 53..54, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -167,14 +167,14 @@ 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 be4a891ed0318..96a57dfeb1525 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,14 @@ 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 ef88c92d751ae..f94c3c08e6b63 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,14 @@ 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 +37,7 @@ Module( Name( ExprName { range: 8..9, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -45,7 +45,7 @@ Module( value: Name( ExprName { range: 12..15, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -61,7 +61,7 @@ Module( body: Name( ExprName { range: 24..28, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -76,7 +76,7 @@ Module( Name( ExprName { range: 29..30, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -84,7 +84,7 @@ 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 56fdd012dd6e2..2b54821ece7f1 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,7 @@ 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 fc5b871b2f6cd..14ef5d77dbb3e 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,7 @@ 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 c2349e7019f1b..e2966c3197e1c 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,7 @@ Module( value: Name( ExprName { range: 15..16, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -53,7 +53,7 @@ Module( test: Name( ExprName { range: 38..39, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -77,7 +77,7 @@ Module( Name( ExprName { range: 60..61, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -100,7 +100,7 @@ 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 238f0fe092dc1..5135617f8187a 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,7 @@ Module( value: Name( ExprName { range: 8..9, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -34,7 +34,7 @@ Module( test: Name( ExprName { range: 17..23, - id: "assert", + id: Name("assert"), ctx: Load, }, ), @@ -47,7 +47,7 @@ Module( value: Name( ExprName { range: 24..25, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -63,7 +63,7 @@ Module( Name( ExprName { range: 39..40, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -79,7 +79,7 @@ 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 252a34b009e21..98770afc2fbc4 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,7 @@ Module( Name( ExprName { range: 6..7, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -69,7 +69,7 @@ Module( Name( ExprName { range: 16..17, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -84,7 +84,7 @@ Module( Name( ExprName { range: 24..25, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -100,7 +100,7 @@ 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 2d123c3e3356e..3dd710665ea47 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,7 @@ Module( Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -32,14 +32,14 @@ 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 +58,7 @@ Module( Name( ExprName { range: 13..14, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -73,7 +73,7 @@ Module( Name( ExprName { range: 24..25, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -92,7 +92,7 @@ Module( Name( ExprName { range: 26..27, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -106,7 +106,7 @@ Module( value: Name( ExprName { range: 42..43, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -124,7 +124,7 @@ Module( Name( ExprName { range: 44..45, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -145,7 +145,7 @@ Module( parameter: Parameter { range: 56..57, name: Identifier { - id: "x", + id: Name("x"), range: 56..57, }, annotation: None, @@ -161,7 +161,7 @@ Module( body: Name( ExprName { range: 59..60, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -179,7 +179,7 @@ Module( Name( ExprName { range: 61..62, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -187,7 +187,7 @@ 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 0b79a3eee84d2..262d2032216fc 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,14 @@ 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 +31,7 @@ Module( value: Name( ExprName { range: 11..12, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -46,7 +46,7 @@ Module( left: Name( ExprName { range: 13..14, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -54,7 +54,7 @@ Module( right: Name( ExprName { range: 17..18, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -69,21 +69,21 @@ 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 +91,7 @@ Module( value: Name( ExprName { range: 34..35, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -106,7 +106,7 @@ Module( left: Name( ExprName { range: 36..37, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -114,7 +114,7 @@ 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 ad4013673216a..0622530818dff 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,7 @@ Module( Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -24,7 +24,7 @@ Module( value: Name( ExprName { range: 3..3, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -64,14 +64,14 @@ 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 +79,7 @@ Module( value: Name( ExprName { range: 17..17, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -119,14 +119,14 @@ 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 +134,7 @@ 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 37154ac1eedae..fb98de4ff4197 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,7 @@ Module( range: 6..20, decorator_list: [], name: Identifier { - id: "Foo", + id: Name("Foo"), range: 12..15, }, type_params: None, @@ -39,7 +39,7 @@ Module( test: Name( ExprName { range: 33..37, - id: "test", + id: Name("test"), ctx: Load, }, ), @@ -65,7 +65,7 @@ Module( Name( ExprName { range: 49..50, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -86,7 +86,7 @@ Module( is_async: true, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 71..74, }, type_params: None, @@ -119,7 +119,7 @@ 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 2b6344ab13b7b..e70d651f0e166 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,7 @@ Module( value: Name( ExprName { range: 19..20, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -124,7 +124,7 @@ Module( target: Name( ExprName { range: 36..37, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -132,7 +132,7 @@ Module( value: Name( ExprName { range: 41..45, - id: "pass", + id: Name("pass"), ctx: Load, }, ), @@ -147,7 +147,7 @@ Module( left: Name( ExprName { range: 47..48, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -155,7 +155,7 @@ 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 203e9e401b415..84441297a0e97 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,7 @@ Module( target: Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -31,14 +31,14 @@ 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 +56,7 @@ Module( target: Name( ExprName { range: 14..15, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -71,7 +71,7 @@ Module( Name( ExprName { range: 26..27, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -89,7 +89,7 @@ Module( target: Name( ExprName { range: 28..29, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -103,7 +103,7 @@ Module( value: Name( ExprName { range: 45..46, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -120,7 +120,7 @@ Module( target: Name( ExprName { range: 47..48, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -141,7 +141,7 @@ Module( parameter: Parameter { range: 60..61, name: Identifier { - id: "x", + id: Name("x"), range: 60..61, }, annotation: None, @@ -157,7 +157,7 @@ Module( body: Name( ExprName { range: 63..64, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -174,7 +174,7 @@ Module( target: Name( ExprName { range: 65..66, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -182,7 +182,7 @@ 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 df5c25dc7cfe0..36e0931320811 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,7 @@ Module( target: Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -23,7 +23,7 @@ Module( value: Name( ExprName { range: 4..4, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -62,7 +62,7 @@ Module( target: Name( ExprName { range: 11..12, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -70,7 +70,7 @@ 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 a72d0cac0a930..9e736f17352f1 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,7 @@ 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 1c4725aa896e1..2e9bbb95f4277 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,7 @@ Module( range: 0..10, decorator_list: [], name: Identifier { - id: "Foo", + id: Name("Foo"), range: 6..9, }, type_params: None, @@ -27,7 +27,7 @@ Module( range: 11..23, decorator_list: [], name: Identifier { - id: "Foo", + id: Name("Foo"), range: 17..20, }, type_params: None, @@ -48,7 +48,7 @@ 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 e254f9523fc7f..a6a65bf577c8f 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,7 @@ Module( range: 0..11, decorator_list: [], name: Identifier { - id: "", + id: Name(""), range: 5..5, }, type_params: None, @@ -38,7 +38,7 @@ Module( range: 12..25, decorator_list: [], name: Identifier { - id: "", + id: Name(""), range: 17..17, }, type_params: None, @@ -68,7 +68,7 @@ Module( range: 26..52, decorator_list: [], name: Identifier { - id: "", + id: Name(""), range: 31..31, }, type_params: None, @@ -81,14 +81,14 @@ 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 ce87aec207589..039c40e65e199 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,7 @@ Module( range: 0..33, decorator_list: [], name: Identifier { - id: "Foo", + id: Name("Foo"), range: 6..9, }, type_params: Some( @@ -25,7 +25,7 @@ Module( TypeParamTypeVar { range: 10..12, name: Identifier { - id: "T1", + id: Name("T1"), range: 10..12, }, bound: None, @@ -36,7 +36,7 @@ Module( TypeParamTypeVarTuple { range: 14..17, name: Identifier { - id: "T2", + id: Name("T2"), range: 15..17, }, default: None, @@ -52,14 +52,14 @@ 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 +83,7 @@ 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 a278a2155f32b..035ba2045cd20 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,7 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -41,7 +41,7 @@ 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 8a98ab26f50ac..65bb9f79c9684 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,7 @@ 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 e506dac043a4f..57fa3e1227f36 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,7 @@ Module( value: Name( ExprName { range: 1..6, - id: "async", + id: Name("async"), ctx: Load, }, ), @@ -30,7 +30,7 @@ Module( elt: Name( ExprName { range: 9..10, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -40,14 +40,14 @@ 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 7ee0145871e06..b6e1f3f84f1f4 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,7 @@ Module( value: Name( ExprName { range: 2..3, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -38,7 +38,7 @@ Module( value: Name( ExprName { range: 7..8, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -54,7 +54,7 @@ Module( value: Name( ExprName { range: 14..15, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -71,7 +71,7 @@ Module( Name( ExprName { range: 25..26, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -87,7 +87,7 @@ Module( value: Name( ExprName { range: 39..40, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -96,7 +96,7 @@ 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 ea01e8e07061c..8920f84aded59 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,7 @@ Module( func: Name( ExprName { range: 5..8, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -48,14 +48,14 @@ 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 +95,7 @@ Module( left: Name( ExprName { range: 34..34, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -103,7 +103,7 @@ Module( right: Name( ExprName { range: 35..35, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -112,7 +112,7 @@ 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 16e58deab9e6f..fdbe569f7fce9 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,14 @@ 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 +63,14 @@ 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 +106,14 @@ 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 c23436132148e..3b1efc7102869 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,7 @@ Module( context_expr: Name( ExprName { range: 16..17, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -47,7 +47,7 @@ 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 ac45a128e39db..4019e44237003 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,7 @@ Module( Name( ExprName { range: 4..5, - id: "x", + id: Name("x"), ctx: Del, }, ), @@ -26,12 +26,12 @@ 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 +46,7 @@ Module( value: Name( ExprName { range: 10..11, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -59,7 +59,7 @@ Module( Name( ExprName { range: 16..17, - id: "x", + id: Name("x"), ctx: Del, }, ), @@ -69,7 +69,7 @@ Module( value: Name( ExprName { range: 19..20, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -80,7 +80,7 @@ Module( Name( ExprName { range: 22..23, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -89,7 +89,7 @@ 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 f876858cc17cd..a84773ff80c71 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,7 @@ Module( Alias { range: 7..11, name: Identifier { - id: "a..b", + id: Name("a..b"), range: 7..11, }, asname: None, @@ -31,7 +31,7 @@ Module( Alias { range: 19..20, name: Identifier { - id: "a", + id: Name("a"), range: 19..20, }, asname: None, @@ -55,7 +55,7 @@ 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 ca3cb6b784d76..dacd5f5d78d07 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,7 @@ Module( Name( ExprName { range: 27..28, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -76,7 +76,7 @@ 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 c9fcabbab0956..433c42b6c3e8e 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,7 @@ Module( Name( ExprName { range: 21..30, - id: "Exception", + id: Name("Exception"), ctx: Load, }, ), @@ -49,7 +49,7 @@ 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 d30dbd928c71d..6462ff889845b 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,7 @@ Module( type_: None, name: Some( Identifier { - id: "exc", + id: Name("exc"), range: 24..27, }, ), @@ -90,7 +90,7 @@ 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 7e191318af4ab..7b4a51d0d8c50 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,14 @@ 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 +69,14 @@ 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 +88,7 @@ Module( ), name: Some( Identifier { - id: "exc", + id: Name("exc"), range: 51..54, }, ), @@ -129,14 +129,14 @@ 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 +167,14 @@ 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 +186,7 @@ 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 2bab550c4867a..5a3276c6a44a6 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,7 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -36,7 +36,7 @@ Module( Name( ExprName { range: 13..14, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -59,7 +59,7 @@ Module( func: Name( ExprName { range: 16..20, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -76,7 +76,7 @@ Module( value: Name( ExprName { range: 25..26, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -99,7 +99,7 @@ Module( func: Name( ExprName { range: 28..32, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -116,7 +116,7 @@ Module( value: Name( ExprName { range: 36..37, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -139,7 +139,7 @@ Module( func: Name( ExprName { range: 40..44, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -162,7 +162,7 @@ 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 9b105f6cb3740..2b70f716d5e09 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,7 @@ Module( func: Name( ExprName { range: 0..3, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -30,7 +30,7 @@ Module( range: 4..7, arg: Some( Identifier { - id: "a", + id: Name("a"), range: 4..5, }, ), @@ -47,7 +47,7 @@ Module( range: 9..12, arg: Some( Identifier { - id: "b", + id: Name("b"), range: 9..10, }, ), @@ -64,7 +64,7 @@ Module( range: 14..17, arg: Some( Identifier { - id: "c", + id: Name("c"), range: 14..15, }, ), @@ -81,7 +81,7 @@ Module( range: 19..22, arg: Some( Identifier { - id: "b", + id: Name("b"), range: 19..20, }, ), @@ -98,7 +98,7 @@ 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 f904be8edbec4..421422c823901 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,7 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -30,7 +30,7 @@ Module( range: 5..14, arg: Some( Identifier { - id: "", + id: Name(""), range: 5..10, }, ), @@ -58,7 +58,7 @@ Module( func: Name( ExprName { range: 16..20, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -70,7 +70,7 @@ Module( range: 21..31, arg: Some( Identifier { - id: "", + id: Name(""), range: 21..27, }, ), @@ -98,7 +98,7 @@ Module( func: Name( ExprName { range: 34..38, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -112,7 +112,7 @@ Module( Name( ExprName { range: 45..46, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -135,7 +135,7 @@ Module( func: Name( ExprName { range: 48..52, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -148,7 +148,7 @@ 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 5200967a60d43..ed40594a67d8b 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,7 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -30,7 +30,7 @@ Module( range: 5..16, arg: Some( Identifier { - id: "x", + id: Name("x"), range: 5..6, }, ), @@ -41,7 +41,7 @@ Module( Name( ExprName { range: 15..16, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -64,7 +64,7 @@ Module( func: Name( ExprName { range: 18..22, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -76,7 +76,7 @@ Module( range: 23..39, arg: Some( Identifier { - id: "x", + id: Name("x"), range: 23..24, }, ), @@ -86,7 +86,7 @@ Module( value: Name( ExprName { range: 38..39, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -108,7 +108,7 @@ Module( func: Name( ExprName { range: 41..45, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -120,7 +120,7 @@ Module( range: 46..52, arg: Some( Identifier { - id: "x", + id: Name("x"), range: 46..47, }, ), @@ -130,7 +130,7 @@ Module( value: Name( ExprName { range: 51..52, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -153,7 +153,7 @@ Module( func: Name( ExprName { range: 54..58, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -165,7 +165,7 @@ Module( range: 59..67, arg: Some( Identifier { - id: "x", + id: Name("x"), range: 59..60, }, ), @@ -175,7 +175,7 @@ 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 0cf3fffafd3be..88887650f1226 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,7 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -28,7 +28,7 @@ Module( Name( ExprName { range: 15..16, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -40,7 +40,7 @@ Module( value: Name( ExprName { range: 7..13, - id: "kwargs", + id: Name("kwargs"), ctx: Load, }, ), @@ -60,7 +60,7 @@ Module( func: Name( ExprName { range: 18..22, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -70,7 +70,7 @@ Module( Name( ExprName { range: 28..29, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -80,7 +80,7 @@ Module( range: 23..26, arg: Some( Identifier { - id: "x", + id: Name("x"), range: 23..24, }, ), @@ -108,7 +108,7 @@ Module( func: Name( ExprName { range: 31..35, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -118,7 +118,7 @@ Module( Name( ExprName { range: 51..52, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -128,7 +128,7 @@ Module( range: 36..39, arg: Some( Identifier { - id: "x", + id: Name("x"), range: 36..37, }, ), @@ -147,7 +147,7 @@ Module( value: Name( ExprName { range: 43..49, - id: "kwargs", + id: Name("kwargs"), ctx: Load, }, ), @@ -167,7 +167,7 @@ Module( func: Name( ExprName { range: 54..58, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -180,7 +180,7 @@ Module( value: Name( ExprName { range: 70..74, - id: "args", + id: Name("args"), ctx: Load, }, ), @@ -195,7 +195,7 @@ Module( value: Name( ExprName { range: 61..67, - id: "kwargs", + id: Name("kwargs"), ctx: Load, }, ), @@ -215,7 +215,7 @@ Module( func: Name( ExprName { range: 76..80, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -228,7 +228,7 @@ Module( value: Name( ExprName { range: 93..97, - id: "args", + id: Name("args"), ctx: Load, }, ), @@ -243,7 +243,7 @@ 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 f2749b81a555c..dab4a4db50d54 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,7 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -28,14 +28,14 @@ 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 d3c83e68ecd14..229848f77fb8b 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,7 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -28,14 +28,14 @@ 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 03fd0e76b98d6..ca673d00fe313 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,7 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -49,7 +49,7 @@ Module( func: Name( ExprName { range: 11..15, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -61,14 +61,14 @@ 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 +88,7 @@ Module( func: Name( ExprName { range: 22..26, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -101,7 +101,7 @@ Module( value: Name( ExprName { range: 28..28, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -111,7 +111,7 @@ Module( Name( ExprName { range: 30..31, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -128,7 +128,7 @@ 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 b8e9b4363e058..f538b700391f1 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,7 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -34,7 +34,7 @@ Module( value: Name( ExprName { range: 6..10, - id: "data", + id: Name("data"), ctx: Load, }, ), @@ -47,14 +47,14 @@ 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 +81,7 @@ Module( func: Name( ExprName { range: 29..33, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -98,7 +98,7 @@ Module( Name( ExprName { range: 41..42, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -124,7 +124,7 @@ Module( func: Name( ExprName { range: 44..48, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -140,7 +140,7 @@ 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 d4b6d03e5d9a6..4f8681244d93f 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,7 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -37,7 +37,7 @@ 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 bcb536b75bd5d..3654bb9411da4 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,7 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -28,7 +28,7 @@ Module( Name( ExprName { range: 5..6, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -45,7 +45,7 @@ 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 131bfd6e2b377..2b49a046b2c39 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,7 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -28,7 +28,7 @@ Module( Name( ExprName { range: 5..6, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -45,7 +45,7 @@ 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 346e2bebcc6fb..17e22755330f6 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,7 @@ Module( value: Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -40,7 +40,7 @@ Module( value: Name( ExprName { range: 4..5, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -84,12 +84,12 @@ 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 269efc26dcc8b..d9b4b66168968 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,19 @@ 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 +47,7 @@ Module( value: Name( ExprName { range: 11..19, - id: "multiple", + id: Name("multiple"), ctx: Load, }, ), @@ -65,7 +65,7 @@ Module( }, ), attr: Identifier { - id: "dots", + id: Name("dots"), range: 23..27, }, ctx: Load, @@ -79,7 +79,7 @@ Module( value: Name( ExprName { range: 28..36, - id: "multiple", + id: Name("multiple"), ctx: Load, }, ), @@ -100,14 +100,14 @@ 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 e7f213367fb2e..d2eed0a8e53c2 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,12 @@ 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 +37,7 @@ Module( value: Name( ExprName { range: 94..100, - id: "second", + id: Name("second"), ctx: Load, }, ), @@ -52,12 +52,12 @@ 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 31b383038a064..0164501aa5f09 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,7 @@ Module( value: Name( ExprName { range: 66..66, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -35,7 +35,7 @@ Module( left: Name( ExprName { range: 68..69, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -43,7 +43,7 @@ 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 54bda080762d1..57dc152f35cea 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,7 @@ Module( value: Name( ExprName { range: 64..64, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -32,7 +32,7 @@ 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 416c0b1ddd884..e07ab46242c93 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,7 @@ Module( value: Name( ExprName { range: 129..130, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -43,7 +43,7 @@ Module( value: Name( ExprName { range: 161..162, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -66,7 +66,7 @@ Module( value: Name( ExprName { range: 171..172, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -90,7 +90,7 @@ Module( Name( ExprName { range: 226..227, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -120,7 +120,7 @@ Module( parameter: Parameter { range: 241..242, name: Identifier { - id: "x", + id: Name("x"), range: 241..242, }, annotation: None, @@ -136,7 +136,7 @@ Module( body: Name( ExprName { range: 244..245, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -159,7 +159,7 @@ Module( operand: Name( ExprName { range: 253..254, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -182,7 +182,7 @@ Module( operand: Name( ExprName { range: 262..263, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -205,7 +205,7 @@ Module( operand: Name( ExprName { range: 271..272, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -228,7 +228,7 @@ 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 cd588a4f70469..81f73870150ca 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,7 @@ Module( left: Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -36,7 +36,7 @@ Module( parameter: Parameter { range: 11..12, name: Identifier { - id: "y", + id: Name("y"), range: 11..12, }, annotation: None, @@ -52,7 +52,7 @@ Module( body: Name( ExprName { range: 14..15, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -71,7 +71,7 @@ Module( left: Name( ExprName { range: 17..18, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -83,7 +83,7 @@ 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 605a1de371178..f244c636ad2d6 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,7 @@ 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 4b265c72baf3e..a766ceda9cf18 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,7 @@ 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 aff9c7fff9317..1a5e9fb0386aa 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,7 @@ 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 d1e939fd39cb7..24db57185b3bc 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,7 @@ Module( left: Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -30,7 +30,7 @@ Module( operand: Name( ExprName { range: 3..3, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -76,7 +76,7 @@ Module( left: Name( ExprName { range: 10..11, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -88,7 +88,7 @@ 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 b14cee55b84e5..89624a06e8d80 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,7 @@ Module( left: Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -26,7 +26,7 @@ Module( right: Name( ExprName { range: 4..5, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -73,7 +73,7 @@ Module( left: Name( ExprName { range: 16..17, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -81,7 +81,7 @@ 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 477d4cac07898..65f2ce048de3d 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,7 @@ Module( left: Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -29,7 +29,7 @@ Module( value: Name( ExprName { range: 5..6, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -49,7 +49,7 @@ Module( left: Name( ExprName { range: 7..8, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -60,7 +60,7 @@ 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 a7b60a2d3a1f7..2268d3a7b0ca6 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,7 @@ Module( Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -37,7 +37,7 @@ Module( parameter: Parameter { range: 13..14, name: Identifier { - id: "y", + id: Name("y"), range: 13..14, }, annotation: None, @@ -53,7 +53,7 @@ Module( body: Name( ExprName { range: 16..17, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -75,7 +75,7 @@ Module( Name( ExprName { range: 19..20, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -86,7 +86,7 @@ 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 6441ac2035b5d..bba4257d31040 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,7 @@ 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 a954ccf5c6c0a..92a7651203541 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,14 @@ 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 55689d68dff19..782763d0daa52 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,14 @@ 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 +42,7 @@ Module( value: Name( ExprName { range: 11..12, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -59,14 +59,14 @@ 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 +81,7 @@ 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 7883b0548065b..cc1e7edfccdb9 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,7 @@ Module( Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -30,7 +30,7 @@ Module( value: Name( ExprName { range: 7..8, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -53,7 +53,7 @@ Module( Name( ExprName { range: 9..10, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -63,7 +63,7 @@ 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 cebbe6465c64d..964cd9c9e8f0e 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,7 @@ Module( left: Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -33,7 +33,7 @@ Module( operand: Name( ExprName { range: 9..10, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -51,7 +51,7 @@ Module( Name( ExprName { range: 35..36, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -62,7 +62,7 @@ Module( left: Name( ExprName { range: 38..38, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -73,7 +73,7 @@ Module( Name( ExprName { range: 40..41, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -88,7 +88,7 @@ Module( value: Name( ExprName { range: 120..121, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -104,7 +104,7 @@ Module( operand: Name( ExprName { range: 126..128, - id: "is", + id: Name("is"), ctx: Load, }, ), @@ -118,7 +118,7 @@ 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 401865d0592c0..415395193d922 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,7 @@ Module( left: Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -39,7 +39,7 @@ Module( parameter: Parameter { range: 16..17, name: Identifier { - id: "y", + id: Name("y"), range: 16..17, }, annotation: None, @@ -55,7 +55,7 @@ Module( body: Name( ExprName { range: 19..20, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -75,7 +75,7 @@ Module( left: Name( ExprName { range: 22..23, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -90,7 +90,7 @@ 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 31007185b95db..d726803994ff5 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,7 @@ 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 30a6f6402c8f2..d704cd736da69 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,7 @@ Module( left: Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -29,7 +29,7 @@ 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 8a9bf572acb4e..cce5b0d788676 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,7 @@ Module( value: Name( ExprName { range: 59..60, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -31,7 +31,7 @@ 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 741fd3d2b0f3a..cf0cae2ef6c22 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,7 @@ Module( left: Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -29,7 +29,7 @@ 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 344a3aa2cf33d..9a5bab9af83ed 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,7 @@ Module( left: Name( ExprName { range: 25..26, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -30,7 +30,7 @@ Module( Name( ExprName { range: 29..29, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -41,7 +41,7 @@ Module( value: Name( ExprName { range: 31..32, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -57,7 +57,7 @@ Module( left: Name( ExprName { range: 33..34, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -68,7 +68,7 @@ Module( Name( ExprName { range: 37..37, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -79,7 +79,7 @@ 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 923f38214381f..2d3c0dbb8c585 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,7 @@ Module( left: Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -29,7 +29,7 @@ Module( Name( ExprName { range: 9..10, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -77,7 +77,7 @@ Module( left: Name( ExprName { range: 21..22, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -88,7 +88,7 @@ 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 cd1ab62b32e90..0988005a771b0 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,7 @@ Module( left: Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -32,7 +32,7 @@ Module( value: Name( ExprName { range: 6..7, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -53,7 +53,7 @@ Module( left: Name( ExprName { range: 8..9, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -67,7 +67,7 @@ Module( value: Name( ExprName { range: 18..19, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -91,7 +91,7 @@ Module( left: Name( ExprName { range: 22..23, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -102,7 +102,7 @@ Module( Name( ExprName { range: 26..27, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -126,7 +126,7 @@ Module( left: Name( ExprName { range: 29..30, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -137,7 +137,7 @@ 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 d99635f56af93..aca3cd963c47c 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,14 @@ 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 +43,7 @@ Module( iter: Name( ExprName { range: 32..33, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -64,14 +64,14 @@ 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 +99,7 @@ Module( iter: Name( ExprName { range: 52..53, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -120,14 +120,14 @@ 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 +140,7 @@ Module( func: Name( ExprName { range: 65..69, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -154,7 +154,7 @@ Module( iter: Name( ExprName { range: 75..76, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -175,14 +175,14 @@ 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 +196,14 @@ 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 +213,7 @@ Module( iter: Name( ExprName { range: 98..99, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -234,14 +234,14 @@ 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 +251,7 @@ Module( target: Name( ExprName { range: 127..128, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -261,7 +261,7 @@ Module( value: Name( ExprName { range: 133..134, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -285,14 +285,14 @@ 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 +302,7 @@ Module( target: Name( ExprName { range: 146..147, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -313,7 +313,7 @@ Module( Name( ExprName { range: 157..158, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -337,14 +337,14 @@ 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 +354,7 @@ Module( target: Name( ExprName { range: 170..171, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -364,7 +364,7 @@ Module( value: Name( ExprName { range: 186..187, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -387,14 +387,14 @@ 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 +404,7 @@ Module( target: Name( ExprName { range: 199..200, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -421,7 +421,7 @@ Module( parameter: Parameter { range: 211..212, name: Identifier { - id: "y", + id: Name("y"), range: 211..212, }, annotation: None, @@ -437,7 +437,7 @@ Module( body: Name( ExprName { range: 214..215, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -460,14 +460,14 @@ 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 +477,14 @@ 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 +495,7 @@ Module( value: Name( ExprName { range: 255..256, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -519,14 +519,14 @@ 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 +536,14 @@ 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 +555,7 @@ Module( Name( ExprName { range: 287..288, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -579,14 +579,14 @@ 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 +596,14 @@ 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 +614,7 @@ Module( value: Name( ExprName { range: 324..325, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -637,14 +637,14 @@ 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 +654,14 @@ 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 +679,7 @@ Module( parameter: Parameter { range: 357..358, name: Identifier { - id: "y", + id: Name("y"), range: 357..358, }, annotation: None, @@ -695,7 +695,7 @@ 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 bc87a11aba602..98af41e0dd157 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,7 @@ Module( value: Name( ExprName { range: 128..129, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -40,7 +40,7 @@ Module( value: Name( ExprName { range: 134..134, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -62,7 +62,7 @@ Module( Name( ExprName { range: 137..138, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -90,14 +90,14 @@ 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 +131,7 @@ Module( parameter: Parameter { range: 173..174, name: Identifier { - id: "x", + id: Name("x"), range: 173..174, }, annotation: None, @@ -147,7 +147,7 @@ Module( body: Name( ExprName { range: 176..177, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -159,7 +159,7 @@ Module( Name( ExprName { range: 179..180, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -190,7 +190,7 @@ Module( Name( ExprName { range: 186..187, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -214,14 +214,14 @@ 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 +251,14 @@ 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 +271,7 @@ Module( Name( ExprName { range: 214..215, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -302,7 +302,7 @@ Module( Name( ExprName { range: 221..222, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -325,7 +325,7 @@ Module( operand: Name( ExprName { range: 233..234, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -337,7 +337,7 @@ Module( Name( ExprName { range: 236..237, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -371,7 +371,7 @@ Module( left: Name( ExprName { range: 245..246, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -382,7 +382,7 @@ Module( Name( ExprName { range: 250..251, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -410,7 +410,7 @@ Module( left: Name( ExprName { range: 256..257, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -421,7 +421,7 @@ Module( Name( ExprName { range: 265..266, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -449,7 +449,7 @@ Module( left: Name( ExprName { range: 271..272, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -460,7 +460,7 @@ 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 a5e9951e6dfee..d6aae33ea7ca9 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,7 @@ Module( value: Name( ExprName { range: 125..126, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -31,7 +31,7 @@ Module( Name( ExprName { range: 128..129, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -39,7 +39,7 @@ Module( value: Name( ExprName { range: 130..133, - id: "for", + id: Name("for"), ctx: Load, }, ), @@ -49,7 +49,7 @@ Module( Name( ExprName { range: 134..135, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -57,7 +57,7 @@ Module( value: Name( ExprName { range: 135..135, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -70,7 +70,7 @@ Module( left: Name( ExprName { range: 137..138, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -81,7 +81,7 @@ Module( Name( ExprName { range: 142..146, - id: "data", + id: Name("data"), ctx: Load, }, ), @@ -92,7 +92,7 @@ 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 f672965118674..4d8b3e3e6c397 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,7 @@ Module( Name( ExprName { range: 1..2, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -29,7 +29,7 @@ Module( value: Name( ExprName { range: 5..8, - id: "def", + id: Name("def"), ctx: Load, }, ), @@ -42,7 +42,7 @@ Module( func: Name( ExprName { range: 9..12, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -57,7 +57,7 @@ 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 e475ac928d577..6705246116c97 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,7 @@ 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 e116b76e2d21b..00cc3d110cbc7 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,7 @@ Module( Name( ExprName { range: 1..2, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -46,7 +46,7 @@ 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 311a18cd33ddc..81078747c88b9 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,7 @@ Module( target: Name( ExprName { range: 56..57, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -42,7 +42,7 @@ Module( value: Name( ExprName { range: 64..65, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -52,7 +52,7 @@ Module( Name( ExprName { range: 67..68, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -60,7 +60,7 @@ Module( value: Name( ExprName { range: 68..68, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -79,7 +79,7 @@ Module( value: Name( ExprName { range: 75..76, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -98,7 +98,7 @@ Module( left: Name( ExprName { range: 79..80, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -106,7 +106,7 @@ 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 09964f98bfd20..4776fda92b7bf 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,7 @@ Module( Name( ExprName { range: 58..59, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -29,7 +29,7 @@ Module( value: Name( ExprName { range: 61..62, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -48,7 +48,7 @@ Module( value: Name( ExprName { range: 67..67, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -58,7 +58,7 @@ Module( Name( ExprName { range: 69..70, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -66,7 +66,7 @@ Module( value: Name( ExprName { range: 72..73, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -85,7 +85,7 @@ Module( value: Name( ExprName { range: 78..78, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -104,7 +104,7 @@ Module( left: Name( ExprName { range: 81..82, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -112,7 +112,7 @@ 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 4c7b359e7ea0c..bbb7c91204228 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,7 @@ Module( Name( ExprName { range: 89..89, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -185,7 +185,7 @@ Module( value: Name( ExprName { range: 160..160, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -207,7 +207,7 @@ Module( value: Name( ExprName { range: 204..204, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -229,7 +229,7 @@ Module( Name( ExprName { range: 207..208, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -237,7 +237,7 @@ Module( value: Name( ExprName { range: 210..211, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -247,7 +247,7 @@ Module( value: Name( ExprName { range: 215..215, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -257,7 +257,7 @@ Module( Name( ExprName { range: 217..218, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -265,7 +265,7 @@ Module( value: Name( ExprName { range: 220..221, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -290,7 +290,7 @@ Module( value: Name( ExprName { range: 312..313, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -301,7 +301,7 @@ Module( value: Name( ExprName { range: 315..316, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -311,7 +311,7 @@ Module( Name( ExprName { range: 318..319, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -319,7 +319,7 @@ Module( value: Name( ExprName { range: 321..322, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -332,7 +332,7 @@ Module( value: Name( ExprName { range: 325..326, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -343,7 +343,7 @@ Module( value: Name( ExprName { range: 328..329, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -365,7 +365,7 @@ Module( Name( ExprName { range: 332..333, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -376,7 +376,7 @@ Module( value: Name( ExprName { range: 336..337, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -389,7 +389,7 @@ Module( Name( ExprName { range: 339..340, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -400,7 +400,7 @@ 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 0704457cf8efa..c3bf1599c0a06 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,7 @@ Module( Name( ExprName { range: 0..1, - id: "a", + id: Name("a"), ctx: Store, }, ), @@ -24,7 +24,7 @@ Module( value: Name( ExprName { range: 5..5, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -37,7 +37,7 @@ Module( Name( ExprName { range: 32..33, - id: "a", + id: Name("a"), ctx: Store, }, ), @@ -45,7 +45,7 @@ Module( value: Name( ExprName { range: 37..37, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -61,7 +61,7 @@ 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 6d33d60b2105d..d1405f41f78f7 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,21 @@ 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 +46,7 @@ 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 d1108c8dd56a6..218a36f34cfa0 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,21 @@ 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 6e386a3635796..fe3c7bc22a39a 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,21 @@ 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 +46,7 @@ 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 cca10a7160c18..7efd57df11d0f 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,21 @@ 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 0a9c25c6acd0e..c610719116df7 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,7 @@ Module( value: Name( ExprName { range: 32..36, - id: "expr", + id: Name("expr"), ctx: Load, }, ), @@ -31,14 +31,14 @@ 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 +65,7 @@ Module( parameter: Parameter { range: 56..57, name: Identifier { - id: "x", + id: Name("x"), range: 56..57, }, annotation: None, @@ -81,7 +81,7 @@ Module( body: Name( ExprName { range: 59..60, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -90,14 +90,14 @@ 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 +118,7 @@ Module( Name( ExprName { range: 79..80, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -128,14 +128,14 @@ 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 +155,7 @@ Module( value: Name( ExprName { range: 104..105, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -164,14 +164,14 @@ 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 +188,14 @@ 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 +205,7 @@ Module( value: Name( ExprName { range: 158..164, - id: "orelse", + id: Name("orelse"), ctx: Load, }, ), @@ -225,14 +225,14 @@ 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 +243,7 @@ Module( Name( ExprName { range: 186..187, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -263,14 +263,14 @@ 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 +280,7 @@ 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 fa45ab4e24a5a..e0ae6e6e4a29e 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,7 @@ Module( parameter: Parameter { range: 7..8, name: Identifier { - id: "a", + id: Name("a"), range: 7..8, }, annotation: None, @@ -37,7 +37,7 @@ Module( parameter: Parameter { range: 10..11, name: Identifier { - id: "b", + id: Name("b"), range: 10..11, }, annotation: None, @@ -58,7 +58,7 @@ 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 82f5f6132a962..3d017d058b9f5 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,7 @@ Module( parameter: Parameter { range: 7..8, name: Identifier { - id: "a", + id: Name("a"), range: 7..8, }, annotation: None, @@ -37,7 +37,7 @@ Module( parameter: Parameter { range: 10..11, name: Identifier { - id: "a", + id: Name("a"), range: 10..11, }, annotation: None, @@ -78,7 +78,7 @@ Module( parameter: Parameter { range: 23..24, name: Identifier { - id: "a", + id: Name("a"), range: 23..24, }, annotation: None, @@ -93,7 +93,7 @@ Module( parameter: Parameter { range: 29..30, name: Identifier { - id: "a", + id: Name("a"), range: 29..30, }, annotation: None, @@ -132,7 +132,7 @@ Module( parameter: Parameter { range: 42..43, name: Identifier { - id: "a", + id: Name("a"), range: 42..43, }, annotation: None, @@ -144,7 +144,7 @@ Module( parameter: Parameter { range: 45..46, name: Identifier { - id: "a", + id: Name("a"), range: 45..46, }, annotation: None, @@ -194,7 +194,7 @@ Module( parameter: Parameter { range: 61..62, name: Identifier { - id: "a", + id: Name("a"), range: 61..62, }, annotation: None, @@ -206,7 +206,7 @@ Module( Parameter { range: 64..66, name: Identifier { - id: "a", + id: Name("a"), range: 65..66, }, annotation: None, @@ -244,7 +244,7 @@ Module( parameter: Parameter { range: 78..79, name: Identifier { - id: "a", + id: Name("a"), range: 78..79, }, annotation: None, @@ -258,7 +258,7 @@ 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 3c663b1a90bc5..be422050d77ae 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,7 @@ Module( value: Name( ExprName { range: 35..36, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -34,14 +34,14 @@ 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 +62,7 @@ Module( elt: Name( ExprName { range: 68..69, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -80,7 +80,7 @@ Module( iter: Name( ExprName { range: 79..80, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -101,7 +101,7 @@ Module( elt: Name( ExprName { range: 83..84, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -129,7 +129,7 @@ Module( iter: Name( ExprName { range: 96..97, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -150,7 +150,7 @@ Module( elt: Name( ExprName { range: 100..101, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -163,7 +163,7 @@ Module( func: Name( ExprName { range: 106..110, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -177,7 +177,7 @@ Module( iter: Name( ExprName { range: 116..117, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -198,7 +198,7 @@ Module( elt: Name( ExprName { range: 120..121, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -212,14 +212,14 @@ 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 +229,7 @@ Module( iter: Name( ExprName { range: 136..137, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -250,7 +250,7 @@ Module( elt: Name( ExprName { range: 156..157, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -260,7 +260,7 @@ Module( target: Name( ExprName { range: 162..163, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -270,7 +270,7 @@ Module( value: Name( ExprName { range: 168..169, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -294,7 +294,7 @@ Module( elt: Name( ExprName { range: 172..173, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -304,7 +304,7 @@ Module( target: Name( ExprName { range: 178..179, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -315,7 +315,7 @@ Module( Name( ExprName { range: 189..190, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -339,7 +339,7 @@ Module( elt: Name( ExprName { range: 193..194, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -349,7 +349,7 @@ Module( target: Name( ExprName { range: 199..200, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -359,7 +359,7 @@ Module( value: Name( ExprName { range: 215..216, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -382,7 +382,7 @@ Module( elt: Name( ExprName { range: 219..220, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -392,7 +392,7 @@ Module( target: Name( ExprName { range: 225..226, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -409,7 +409,7 @@ Module( parameter: Parameter { range: 237..238, name: Identifier { - id: "y", + id: Name("y"), range: 237..238, }, annotation: None, @@ -425,7 +425,7 @@ Module( body: Name( ExprName { range: 240..241, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -448,7 +448,7 @@ Module( elt: Name( ExprName { range: 258..259, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -458,14 +458,14 @@ 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 +476,7 @@ Module( value: Name( ExprName { range: 278..279, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -500,7 +500,7 @@ Module( elt: Name( ExprName { range: 282..283, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -510,14 +510,14 @@ 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 +529,7 @@ Module( Name( ExprName { range: 307..308, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -553,7 +553,7 @@ Module( elt: Name( ExprName { range: 311..312, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -563,14 +563,14 @@ 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 +581,7 @@ Module( value: Name( ExprName { range: 341..342, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -604,7 +604,7 @@ Module( elt: Name( ExprName { range: 345..346, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -614,14 +614,14 @@ 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 +639,7 @@ Module( parameter: Parameter { range: 371..372, name: Identifier { - id: "y", + id: Name("y"), range: 371..372, }, annotation: None, @@ -655,7 +655,7 @@ 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 3c3f2be769ba7..e7ec874488ffb 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,7 @@ 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 b343c2c3cc56c..1c59c84935b60 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,7 @@ Module( left: Name( ExprName { range: 128..129, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -30,7 +30,7 @@ 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 1e42422912b8b..529c718a506e6 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,7 @@ Module( left: Name( ExprName { range: 136..137, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -38,7 +38,7 @@ 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 faeaa38a8412a..604af52d20be3 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,7 @@ 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 2ff84388a921d..7b981e1dd44cf 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,7 @@ Module( Name( ExprName { range: 83..83, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -158,7 +158,7 @@ Module( left: Name( ExprName { range: 189..190, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -166,7 +166,7 @@ Module( right: Name( ExprName { range: 192..192, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -220,7 +220,7 @@ 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 5d9c56c01328c..edc30e1d71571 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,7 @@ Module( value: Name( ExprName { range: 87..88, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -32,7 +32,7 @@ Module( Name( ExprName { range: 91..92, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -58,7 +58,7 @@ Module( left: Name( ExprName { range: 96..97, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -69,7 +69,7 @@ Module( Name( ExprName { range: 101..102, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -82,7 +82,7 @@ Module( Name( ExprName { range: 104..105, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -109,7 +109,7 @@ Module( operand: Name( ExprName { range: 113..114, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -121,7 +121,7 @@ Module( Name( ExprName { range: 116..117, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -149,14 +149,14 @@ 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 +169,7 @@ Module( Name( ExprName { range: 130..131, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -197,14 +197,14 @@ 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 +217,7 @@ Module( Name( ExprName { range: 143..144, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -249,14 +249,14 @@ 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 +268,7 @@ Module( Name( ExprName { range: 166..167, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -301,7 +301,7 @@ Module( parameter: Parameter { range: 178..179, name: Identifier { - id: "x", + id: Name("x"), range: 178..179, }, annotation: None, @@ -317,7 +317,7 @@ Module( body: Name( ExprName { range: 181..182, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -329,7 +329,7 @@ Module( Name( ExprName { range: 184..185, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -355,7 +355,7 @@ Module( value: Name( ExprName { range: 189..190, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -375,7 +375,7 @@ 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 ca8a03f58f863..6d494f709cf6a 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,12 @@ 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 +56,14 @@ 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 +94,7 @@ Module( value: Name( ExprName { range: 83..84, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -126,14 +126,14 @@ 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 f2583dca28154..242e26e5f6fac 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,7 @@ 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 4a3dc48c47acc..253880c410e0c 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,14 @@ 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 7da176072a451..30608f4b8ab8b 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,14 @@ 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 +42,7 @@ Module( func: Name( ExprName { range: 72..75, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -56,7 +56,7 @@ 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 4fedd3fdad4a4..53e9b2fba0426 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,7 @@ Module( target: Name( ExprName { range: 101..102, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -28,7 +28,7 @@ Module( left: Name( ExprName { range: 107..108, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -36,7 +36,7 @@ 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 916b3919331c7..7a1537006a3d6 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,14 @@ 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 +42,7 @@ Module( left: Name( ExprName { range: 73..74, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -50,7 +50,7 @@ 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 776e7601ce923..3fa1fc2f2e201 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,7 @@ Module( value: Name( ExprName { range: 2..3, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -34,14 +34,14 @@ 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 +67,7 @@ Module( target: Name( ExprName { range: 17..18, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -95,14 +95,14 @@ 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 f7c864a2655d8..c2acf808fa7ea 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,7 @@ 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 37bfd450e0600..2cac7005580ec 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,7 @@ Module( left: Name( ExprName { range: 132..133, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -26,7 +26,7 @@ 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 6c0f8e9524108..e10df7aafa422 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,7 @@ Module( left: Name( ExprName { range: 141..142, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -38,7 +38,7 @@ 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 e0708719b1f00..ad99ccea89b8a 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,7 @@ 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 363ea16627611..b8fd6f0455467 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,7 @@ Module( value: Name( ExprName { range: 68..69, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -33,7 +33,7 @@ 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 5227204d9882c..eac91f1998f84 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,7 @@ Module( Name( ExprName { range: 84..84, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -152,7 +152,7 @@ Module( left: Name( ExprName { range: 190..191, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -160,7 +160,7 @@ Module( right: Name( ExprName { range: 193..193, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -209,14 +209,14 @@ 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 +231,7 @@ 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 49b3005abfe13..5133374b14b0c 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,7 @@ Module( left: Name( ExprName { range: 163..164, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -36,7 +36,7 @@ Module( Name( ExprName { range: 168..169, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -49,7 +49,7 @@ Module( Name( ExprName { range: 171..172, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -62,7 +62,7 @@ Module( left: Name( ExprName { range: 175..176, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -73,7 +73,7 @@ Module( Name( ExprName { range: 180..181, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -107,7 +107,7 @@ Module( operand: Name( ExprName { range: 189..190, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -119,7 +119,7 @@ Module( Name( ExprName { range: 192..193, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -133,7 +133,7 @@ Module( operand: Name( ExprName { range: 200..201, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -167,14 +167,14 @@ 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 +187,7 @@ Module( Name( ExprName { range: 214..215, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -202,14 +202,14 @@ 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 +244,14 @@ 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 +264,7 @@ Module( Name( ExprName { range: 237..238, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -279,14 +279,14 @@ 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 +325,14 @@ 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 +344,7 @@ Module( Name( ExprName { range: 269..270, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -363,14 +363,14 @@ 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 +409,7 @@ Module( parameter: Parameter { range: 300..301, name: Identifier { - id: "x", + id: Name("x"), range: 300..301, }, annotation: None, @@ -425,7 +425,7 @@ Module( body: Name( ExprName { range: 303..304, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -437,7 +437,7 @@ Module( Name( ExprName { range: 306..307, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -457,7 +457,7 @@ Module( parameter: Parameter { range: 317..318, name: Identifier { - id: "x", + id: Name("x"), range: 317..318, }, annotation: None, @@ -473,7 +473,7 @@ Module( body: Name( ExprName { range: 320..321, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -505,7 +505,7 @@ Module( value: Name( ExprName { range: 325..326, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -525,7 +525,7 @@ Module( Name( ExprName { range: 333..334, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -538,7 +538,7 @@ Module( value: Name( ExprName { range: 337..338, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -578,7 +578,7 @@ Module( left: Name( ExprName { range: 368..369, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -589,7 +589,7 @@ Module( Name( ExprName { range: 373..374, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -602,7 +602,7 @@ Module( Name( ExprName { range: 376..377, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -615,7 +615,7 @@ Module( left: Name( ExprName { range: 380..381, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -626,7 +626,7 @@ Module( Name( ExprName { range: 385..386, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -660,7 +660,7 @@ Module( operand: Name( ExprName { range: 392..393, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -672,7 +672,7 @@ Module( Name( ExprName { range: 395..396, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -686,7 +686,7 @@ Module( operand: Name( ExprName { range: 403..404, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -720,14 +720,14 @@ 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 +740,7 @@ Module( Name( ExprName { range: 415..416, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -755,14 +755,14 @@ 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 +797,14 @@ 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 +817,7 @@ Module( Name( ExprName { range: 436..437, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -832,14 +832,14 @@ 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 +878,14 @@ 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 +897,7 @@ Module( Name( ExprName { range: 466..467, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -916,14 +916,14 @@ 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 +962,7 @@ Module( parameter: Parameter { range: 495..496, name: Identifier { - id: "x", + id: Name("x"), range: 495..496, }, annotation: None, @@ -978,7 +978,7 @@ Module( body: Name( ExprName { range: 498..499, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -990,7 +990,7 @@ Module( Name( ExprName { range: 501..502, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -1010,7 +1010,7 @@ Module( parameter: Parameter { range: 512..513, name: Identifier { - id: "x", + id: Name("x"), range: 512..513, }, annotation: None, @@ -1026,7 +1026,7 @@ Module( body: Name( ExprName { range: 515..516, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1051,7 +1051,7 @@ Module( value: Name( ExprName { range: 518..519, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1078,7 +1078,7 @@ Module( Name( ExprName { range: 526..527, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -1088,7 +1088,7 @@ 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 a4bff441f8cb4..576ede44ac669 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,7 @@ Module( value: Name( ExprName { range: 35..36, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -34,14 +34,14 @@ 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 +62,7 @@ Module( elt: Name( ExprName { range: 68..69, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -80,7 +80,7 @@ Module( iter: Name( ExprName { range: 79..80, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -101,7 +101,7 @@ Module( elt: Name( ExprName { range: 83..84, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -129,7 +129,7 @@ Module( iter: Name( ExprName { range: 96..97, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -150,7 +150,7 @@ Module( elt: Name( ExprName { range: 100..101, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -163,7 +163,7 @@ Module( func: Name( ExprName { range: 106..110, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -177,7 +177,7 @@ Module( iter: Name( ExprName { range: 116..117, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -198,7 +198,7 @@ Module( elt: Name( ExprName { range: 120..121, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -212,14 +212,14 @@ 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 +229,7 @@ Module( iter: Name( ExprName { range: 136..137, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -250,7 +250,7 @@ Module( elt: Name( ExprName { range: 156..157, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -260,7 +260,7 @@ Module( target: Name( ExprName { range: 162..163, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -270,7 +270,7 @@ Module( value: Name( ExprName { range: 168..169, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -294,7 +294,7 @@ Module( elt: Name( ExprName { range: 172..173, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -304,7 +304,7 @@ Module( target: Name( ExprName { range: 178..179, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -315,7 +315,7 @@ Module( Name( ExprName { range: 189..190, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -339,7 +339,7 @@ Module( elt: Name( ExprName { range: 193..194, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -349,7 +349,7 @@ Module( target: Name( ExprName { range: 199..200, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -359,7 +359,7 @@ Module( value: Name( ExprName { range: 215..216, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -382,7 +382,7 @@ Module( elt: Name( ExprName { range: 219..220, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -392,7 +392,7 @@ Module( target: Name( ExprName { range: 225..226, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -409,7 +409,7 @@ Module( parameter: Parameter { range: 237..238, name: Identifier { - id: "y", + id: Name("y"), range: 237..238, }, annotation: None, @@ -425,7 +425,7 @@ Module( body: Name( ExprName { range: 240..241, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -448,7 +448,7 @@ Module( elt: Name( ExprName { range: 258..259, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -458,14 +458,14 @@ 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 +476,7 @@ Module( value: Name( ExprName { range: 278..279, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -500,7 +500,7 @@ Module( elt: Name( ExprName { range: 282..283, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -510,14 +510,14 @@ 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 +529,7 @@ Module( Name( ExprName { range: 307..308, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -553,7 +553,7 @@ Module( elt: Name( ExprName { range: 311..312, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -563,14 +563,14 @@ 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 +581,7 @@ Module( value: Name( ExprName { range: 341..342, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -604,7 +604,7 @@ Module( elt: Name( ExprName { range: 345..346, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -614,14 +614,14 @@ 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 +639,7 @@ Module( parameter: Parameter { range: 371..372, name: Identifier { - id: "y", + id: Name("y"), range: 371..372, }, annotation: None, @@ -655,7 +655,7 @@ 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 18c6034e1e43c..5dfdee390976e 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,7 @@ 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 340384ab77d7f..4d1c8c9301098 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,7 @@ Module( left: Name( ExprName { range: 131..132, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -30,7 +30,7 @@ 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 9cdfecacebe6e..e428dc35acd33 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,7 @@ Module( left: Name( ExprName { range: 139..140, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -38,7 +38,7 @@ 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 5c7dcaa38888e..51c9034fc9e05 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,7 @@ 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 946b061be1f43..90a625582e810 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,7 @@ Module( Name( ExprName { range: 198..198, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -157,7 +157,7 @@ Module( left: Name( ExprName { range: 304..305, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -165,7 +165,7 @@ Module( right: Name( ExprName { range: 307..307, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -217,7 +217,7 @@ 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 978e113160587..d8b2fc78374db 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,7 @@ Module( value: Name( ExprName { range: 86..87, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -32,7 +32,7 @@ Module( Name( ExprName { range: 90..91, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -57,7 +57,7 @@ Module( left: Name( ExprName { range: 95..96, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -68,7 +68,7 @@ Module( Name( ExprName { range: 100..101, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -81,7 +81,7 @@ Module( Name( ExprName { range: 103..104, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -107,7 +107,7 @@ Module( operand: Name( ExprName { range: 112..113, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -119,7 +119,7 @@ Module( Name( ExprName { range: 115..116, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -146,14 +146,14 @@ 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 +166,7 @@ Module( Name( ExprName { range: 129..130, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -193,14 +193,14 @@ 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 +213,7 @@ Module( Name( ExprName { range: 142..143, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -244,14 +244,14 @@ 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 +263,7 @@ Module( Name( ExprName { range: 165..166, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -295,7 +295,7 @@ Module( parameter: Parameter { range: 177..178, name: Identifier { - id: "x", + id: Name("x"), range: 177..178, }, annotation: None, @@ -311,7 +311,7 @@ Module( body: Name( ExprName { range: 180..181, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -323,7 +323,7 @@ Module( Name( ExprName { range: 183..184, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -348,7 +348,7 @@ Module( value: Name( ExprName { range: 188..189, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -368,7 +368,7 @@ 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 45fbf9dad61f0..26b2d038fff59 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,7 @@ Module( value: Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -32,7 +32,7 @@ Module( target: Name( ExprName { range: 2..3, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -65,7 +65,7 @@ Module( value: Name( ExprName { range: 33..34, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -79,7 +79,7 @@ Module( value: Name( ExprName { range: 36..37, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -105,7 +105,7 @@ Module( value: Name( ExprName { range: 40..41, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -120,7 +120,7 @@ Module( value: Name( ExprName { range: 44..45, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -145,7 +145,7 @@ Module( value: Name( ExprName { range: 47..48, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -161,7 +161,7 @@ Module( value: Name( ExprName { range: 52..53, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -185,14 +185,14 @@ 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 +210,7 @@ Module( value: Name( ExprName { range: 123..124, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -223,7 +223,7 @@ 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 19fe8dd3eda30..3d89a70be471b 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,7 @@ Module( value: Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -33,7 +33,7 @@ Module( left: Name( ExprName { range: 5..6, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -41,7 +41,7 @@ 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 25e36ee3deb14..e7173c5ea1fd6 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,7 @@ Module( value: Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -31,7 +31,7 @@ Module( Name( ExprName { range: 6..9, - id: "def", + id: Name("def"), ctx: Load, }, ), @@ -52,7 +52,7 @@ Module( func: Name( ExprName { range: 10..13, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -66,7 +66,7 @@ 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 1f4c963db2a69..b5f566d249772 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,7 @@ 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 89a46ff73ece5..be7d7154c7b7d 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,7 @@ Module( operand: Name( ExprName { range: 1..2, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -50,7 +50,7 @@ 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 bc8357cc3c5c7..835f04ff2ed8f 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,7 @@ Module( operand: Name( ExprName { range: 3..3, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -36,7 +36,7 @@ Module( left: Name( ExprName { range: 5..6, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -44,7 +44,7 @@ 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 c53f05dc108d0..a6ff514626a6b 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,7 @@ Module( operand: Name( ExprName { range: 1..1, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -36,7 +36,7 @@ Module( left: Name( ExprName { range: 3..4, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -44,7 +44,7 @@ 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 933fd61a1ddf7..1d6a889540eb6 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,7 @@ Module( Name( ExprName { range: 58..59, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -63,7 +63,7 @@ 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 69d607d70392f..119f774e10329 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,7 @@ Module( value: Name( ExprName { range: 45..46, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -56,14 +56,14 @@ 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 +76,7 @@ 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 866aae89fc93d..d222e225b6004 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,7 @@ Module( value: Name( ExprName { range: 82..83, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -48,7 +48,7 @@ Module( value: Name( ExprName { range: 96..97, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -58,7 +58,7 @@ 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 8ee4ab27c556f..2423b977365b8 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,7 @@ Module( value: Name( ExprName { range: 46..47, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -52,14 +52,14 @@ 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 +85,7 @@ Module( Name( ExprName { range: 180..181, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -100,14 +100,14 @@ 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 6f8fdf7b09eda..5a731cc3454d7 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,7 @@ Module( expression: Name( ExprName { range: 3..3, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -68,7 +68,7 @@ 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 43b521ce6a48b..91e43094e0249 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,7 @@ 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 7376ec2087bff..97b365a8dd233 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,7 @@ Module( expression: Name( ExprName { range: 3..4, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -68,7 +68,7 @@ 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 df5f3b0e8d1d7..95e958e547eaa 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,7 @@ Module( value: Name( ExprName { range: 81..81, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -82,14 +82,14 @@ 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 +143,7 @@ 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 669ca2dd2ba07..254276e9787c7 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,7 @@ Module( parameter: Parameter { range: 10..11, name: Identifier { - id: "x", + id: Name("x"), range: 10..11, }, annotation: None, @@ -53,7 +53,7 @@ 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 bdd816e505aa1..1ea72f64018b6 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,7 @@ Module( expression: Name( ExprName { range: 3..3, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -68,7 +68,7 @@ Module( expression: Name( ExprName { range: 8..11, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -109,7 +109,7 @@ Module( expression: Name( ExprName { range: 18..21, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -156,7 +156,7 @@ Module( expression: Name( ExprName { range: 27..27, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -183,7 +183,7 @@ 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 8fe9999299082..0ee92326b2d19 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,7 @@ Module( expression: Name( ExprName { range: 9..10, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -85,7 +85,7 @@ 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 13d3c6dca1e17..4561e00279930 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,7 @@ Module( target: Name( ExprName { range: 4..5, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -31,14 +31,14 @@ 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 +70,7 @@ Module( target: Name( ExprName { range: 27..28, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -81,7 +81,7 @@ Module( Name( ExprName { range: 38..39, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -110,14 +110,14 @@ 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 10e8692553609..a3907addee1de 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,7 @@ Module( iter: Name( ExprName { range: 9..10, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -68,7 +68,7 @@ Module( iter: Name( ExprName { range: 27..28, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -102,14 +102,14 @@ 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 +122,7 @@ Module( iter: Name( ExprName { range: 50..51, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -154,7 +154,7 @@ Module( left: Name( ExprName { range: 62..63, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -162,7 +162,7 @@ Module( right: Name( ExprName { range: 66..67, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -174,7 +174,7 @@ Module( iter: Name( ExprName { range: 71..72, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -203,7 +203,7 @@ Module( value: Name( ExprName { range: 88..89, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -212,7 +212,7 @@ Module( iter: Name( ExprName { range: 93..94, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -245,7 +245,7 @@ Module( left: Name( ExprName { range: 110..111, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -256,7 +256,7 @@ Module( Name( ExprName { range: 115..116, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -269,7 +269,7 @@ Module( iter: Name( ExprName { range: 116..116, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -299,7 +299,7 @@ Module( Name( ExprName { range: 127..128, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -314,7 +314,7 @@ Module( Name( ExprName { range: 133..134, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -357,7 +357,7 @@ 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 7d06a792e973b..d6f322b122946 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,7 @@ Module( left: Name( ExprName { range: 4..5, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -30,7 +30,7 @@ Module( Name( ExprName { range: 13..14, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -40,7 +40,7 @@ Module( iter: Name( ExprName { range: 18..19, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -69,7 +69,7 @@ Module( left: Name( ExprName { range: 29..30, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -80,7 +80,7 @@ Module( Name( ExprName { range: 34..35, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -90,7 +90,7 @@ Module( iter: Name( ExprName { range: 39..40, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -121,14 +121,14 @@ 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 +138,7 @@ Module( iter: Name( ExprName { range: 60..61, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -168,7 +168,7 @@ Module( operand: Name( ExprName { range: 72..73, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -177,7 +177,7 @@ Module( iter: Name( ExprName { range: 77..78, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -207,7 +207,7 @@ Module( operand: Name( ExprName { range: 92..93, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -216,7 +216,7 @@ Module( iter: Name( ExprName { range: 97..98, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -245,7 +245,7 @@ Module( left: Name( ExprName { range: 108..109, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -253,7 +253,7 @@ Module( right: Name( ExprName { range: 112..113, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -262,7 +262,7 @@ 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 c6e9447da789e..c8c43ae82cbd4 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,7 @@ Module( func: Name( ExprName { range: 4..5, - id: "d", + id: Name("d"), ctx: Load, }, ), @@ -32,7 +32,7 @@ Module( left: Name( ExprName { range: 6..7, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -43,7 +43,7 @@ Module( Name( ExprName { range: 11..12, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -58,7 +58,7 @@ Module( iter: Name( ExprName { range: 17..23, - id: "target", + id: Name("target"), ctx: Load, }, ), @@ -90,7 +90,7 @@ Module( left: Name( ExprName { range: 34..35, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -101,7 +101,7 @@ Module( Name( ExprName { range: 39..40, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -118,7 +118,7 @@ Module( iter: Name( ExprName { range: 47..51, - id: "iter", + id: Name("iter"), ctx: Load, }, ), @@ -147,7 +147,7 @@ Module( left: Name( ExprName { range: 62..63, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -158,7 +158,7 @@ Module( Name( ExprName { range: 67..68, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -168,7 +168,7 @@ Module( iter: Name( ExprName { range: 73..77, - id: "iter", + id: Name("iter"), ctx: Load, }, ), @@ -201,7 +201,7 @@ Module( left: Name( ExprName { range: 88..89, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -212,7 +212,7 @@ Module( Name( ExprName { range: 93..94, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -222,7 +222,7 @@ Module( Name( ExprName { range: 96..97, - id: "z", + id: Name("z"), ctx: Store, }, ), @@ -234,7 +234,7 @@ Module( iter: Name( ExprName { range: 102..106, - id: "iter", + id: Name("iter"), ctx: Load, }, ), @@ -267,7 +267,7 @@ Module( left: Name( ExprName { range: 117..118, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -278,7 +278,7 @@ Module( Name( ExprName { range: 122..123, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -288,7 +288,7 @@ Module( Name( ExprName { range: 125..126, - id: "z", + id: Name("z"), ctx: Store, }, ), @@ -299,7 +299,7 @@ Module( iter: Name( ExprName { range: 131..135, - id: "iter", + id: Name("iter"), ctx: Load, }, ), @@ -332,7 +332,7 @@ Module( left: Name( ExprName { range: 146..147, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -343,7 +343,7 @@ Module( Name( ExprName { range: 151..152, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -353,7 +353,7 @@ Module( Name( ExprName { range: 154..155, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -363,7 +363,7 @@ 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 007a4ef75d67d..f90a68d9d63a2 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,14 @@ 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 +49,14 @@ 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 93821ecf7c64f..e130d85caa56f 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,14 @@ 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 +35,7 @@ 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 dd0bb8cfe4166..f72bfdd6ab2da 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,14 @@ 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 3ba6f7198ffb1..2e9373eb81688 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,7 @@ Module( range: 0..16, module: Some( Identifier { - id: "x", + id: Name("x"), range: 5..6, }, ), @@ -22,7 +22,7 @@ Module( Alias { range: 14..15, name: Identifier { - id: "a", + id: Name("a"), range: 14..15, }, asname: None, @@ -36,7 +36,7 @@ Module( range: 17..34, module: Some( Identifier { - id: "x", + id: Name("x"), range: 22..23, }, ), @@ -44,7 +44,7 @@ Module( Alias { range: 31..32, name: Identifier { - id: "a", + id: Name("a"), range: 31..32, }, asname: None, @@ -52,7 +52,7 @@ Module( Alias { range: 33..34, name: Identifier { - id: "b", + id: Name("b"), range: 33..34, }, asname: None, @@ -66,7 +66,7 @@ Module( range: 35..66, module: Some( Identifier { - id: "x", + id: Name("x"), range: 40..41, }, ), @@ -74,7 +74,7 @@ Module( Alias { range: 49..50, name: Identifier { - id: "a", + id: Name("a"), range: 49..50, }, asname: None, @@ -82,7 +82,7 @@ Module( Alias { range: 52..53, name: Identifier { - id: "b", + id: Name("b"), range: 52..53, }, asname: None, @@ -90,7 +90,7 @@ Module( Alias { range: 54..55, name: Identifier { - id: "c", + id: Name("c"), range: 54..55, }, asname: None, @@ -98,7 +98,7 @@ Module( Alias { range: 57..58, name: Identifier { - id: "d", + id: Name("d"), range: 57..58, }, asname: None, @@ -106,7 +106,7 @@ Module( Alias { range: 60..61, name: Identifier { - id: "e", + id: Name("e"), range: 60..61, }, asname: None, @@ -114,7 +114,7 @@ Module( Alias { range: 62..63, name: Identifier { - id: "f", + id: Name("f"), range: 62..63, }, asname: None, @@ -122,7 +122,7 @@ 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 1b446fb502e6d..02849ea1d4488 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,7 @@ Module( range: 0..13, module: Some( Identifier { - id: "x", + id: Name("x"), range: 5..6, }, ), @@ -27,7 +27,7 @@ Module( range: 14..30, module: Some( Identifier { - id: "x", + id: Name("x"), range: 19..20, }, ), @@ -40,7 +40,7 @@ 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 4cb803abd1848..71b24a22c4679 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,7 @@ 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 df0c2c6587a21..3b6968126a1d0 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,7 @@ Module( range: 0..19, module: Some( Identifier { - id: "x", + id: Name("x"), range: 5..6, }, ), @@ -22,7 +22,7 @@ Module( Alias { range: 15..16, name: Identifier { - id: "a", + id: Name("a"), range: 15..16, }, asname: None, @@ -30,7 +30,7 @@ Module( Alias { range: 18..19, name: Identifier { - id: "b", + id: Name("b"), range: 18..19, }, asname: None, @@ -71,7 +71,7 @@ Module( range: 26..46, module: Some( Identifier { - id: "x", + id: Name("x"), range: 31..32, }, ), @@ -79,7 +79,7 @@ Module( Alias { range: 41..42, name: Identifier { - id: "a", + id: Name("a"), range: 41..42, }, asname: None, @@ -87,7 +87,7 @@ 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 a82029dfb5701..ca8f658ba1ef5 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,7 @@ Module( range: 0..18, module: Some( Identifier { - id: "x", + id: Name("x"), range: 5..6, }, ), @@ -22,7 +22,7 @@ Module( Alias { range: 14..15, name: Identifier { - id: "*", + id: Name("*"), range: 14..15, }, asname: None, @@ -30,7 +30,7 @@ Module( Alias { range: 17..18, name: Identifier { - id: "a", + id: Name("a"), range: 17..18, }, asname: None, @@ -44,7 +44,7 @@ Module( range: 19..40, module: Some( Identifier { - id: "x", + id: Name("x"), range: 24..25, }, ), @@ -52,7 +52,7 @@ Module( Alias { range: 33..34, name: Identifier { - id: "a", + id: Name("a"), range: 33..34, }, asname: None, @@ -60,7 +60,7 @@ Module( Alias { range: 36..37, name: Identifier { - id: "*", + id: Name("*"), range: 36..37, }, asname: None, @@ -68,7 +68,7 @@ Module( Alias { range: 39..40, name: Identifier { - id: "b", + id: Name("b"), range: 39..40, }, asname: None, @@ -82,7 +82,7 @@ Module( range: 41..64, module: Some( Identifier { - id: "x", + id: Name("x"), range: 46..47, }, ), @@ -90,7 +90,7 @@ Module( Alias { range: 55..56, name: Identifier { - id: "*", + id: Name("*"), range: 55..56, }, asname: None, @@ -98,12 +98,12 @@ 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 +117,7 @@ Module( range: 65..86, module: Some( Identifier { - id: "x", + id: Name("x"), range: 70..71, }, ), @@ -125,7 +125,7 @@ Module( Alias { range: 79..80, name: Identifier { - id: "*", + id: Name("*"), range: 79..80, }, asname: None, @@ -133,7 +133,7 @@ Module( Alias { range: 82..83, name: Identifier { - id: "*", + id: Name("*"), range: 82..83, }, asname: None, @@ -141,7 +141,7 @@ 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 404317157362a..02ff0ff97462c 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,7 @@ Module( range: 0..16, module: Some( Identifier { - id: "a", + id: Name("a"), range: 5..6, }, ), @@ -22,7 +22,7 @@ Module( Alias { range: 14..15, name: Identifier { - id: "b", + id: Name("b"), range: 14..15, }, asname: None, @@ -36,7 +36,7 @@ Module( range: 17..38, module: Some( Identifier { - id: "a", + id: Name("a"), range: 22..23, }, ), @@ -44,12 +44,12 @@ 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 +63,7 @@ Module( range: 39..58, module: Some( Identifier { - id: "a", + id: Name("a"), range: 44..45, }, ), @@ -71,7 +71,7 @@ Module( Alias { range: 53..54, name: Identifier { - id: "b", + id: Name("b"), range: 53..54, }, asname: None, @@ -79,7 +79,7 @@ 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 66550f4675391..9a132ab9f50b2 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -37,7 +37,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 15..18, }, type_params: None, @@ -53,7 +53,7 @@ Module( Name( ExprName { range: 24..27, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -68,7 +68,7 @@ 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 c96a223891d1c..0d1731ead85ae 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -34,7 +34,7 @@ Module( value: Name( ExprName { range: 14..17, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -62,7 +62,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 27..30, }, type_params: None, @@ -81,7 +81,7 @@ Module( value: Name( ExprName { range: 38..41, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -109,7 +109,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 52..55, }, type_params: None, @@ -129,7 +129,7 @@ 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 68e3130a862ce..d8ee81f34b5a2 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "", + id: Name(""), range: 3..3, }, type_params: None, @@ -48,7 +48,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "", + id: Name(""), range: 15..15, }, type_params: None, @@ -64,7 +64,7 @@ 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 192bbfdd747da..994e34c5ce9ee 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,7 @@ 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 e37c632e7f9bc..1b2fef4c05ecf 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -28,14 +28,14 @@ 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 +48,7 @@ Module( parameter: Parameter { range: 16..18, name: Identifier { - id: "b", + id: Name("b"), range: 16..17, }, annotation: None, @@ -70,7 +70,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 23..26, }, type_params: None, @@ -108,7 +108,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 48..51, }, type_params: None, @@ -121,14 +121,14 @@ 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 +141,14 @@ 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 +161,7 @@ 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 c5cfe5b377958..c7bf44d05c9a9 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: Some( @@ -26,7 +26,7 @@ Module( TypeParamTypeVar { range: 8..10, name: Identifier { - id: "T1", + id: Name("T1"), range: 8..10, }, bound: None, @@ -37,7 +37,7 @@ Module( TypeParamTypeVarTuple { range: 12..15, name: Identifier { - id: "T2", + id: Name("T2"), range: 13..15, }, default: None, @@ -55,7 +55,7 @@ Module( parameter: Parameter { range: 16..17, name: Identifier { - id: "a", + id: Name("a"), range: 16..17, }, annotation: None, @@ -67,7 +67,7 @@ Module( parameter: Parameter { range: 19..20, name: Identifier { - id: "b", + id: Name("b"), range: 19..20, }, annotation: None, @@ -91,7 +91,7 @@ Module( left: Name( ExprName { range: 34..35, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -99,7 +99,7 @@ Module( right: Name( ExprName { range: 38..39, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -118,7 +118,7 @@ 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 202748b993d2e..0cfd37fb16f35 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -35,7 +35,7 @@ Module( Name( ExprName { range: 13..16, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -65,7 +65,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 27..30, }, type_params: None, @@ -85,14 +85,14 @@ 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 dcb28456ec1a9..a9271abcd3b39 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,7 @@ 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 d84efa64801b2..008d13eb1a8dc 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,7 @@ Module( range: 9..18, names: [ Identifier { - id: "x", + id: Name("x"), range: 16..17, }, ], @@ -31,11 +31,11 @@ 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 94ad569a4f518..5353c7589bbd4 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,7 @@ Module( test: Name( ExprName { range: 3..4, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -33,7 +33,7 @@ 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 a80c406018a9a..f83040060e0d2 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,7 @@ Module( test: Name( ExprName { range: 3..4, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -36,7 +36,7 @@ Module( value: Name( ExprName { range: 21..22, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -62,7 +62,7 @@ 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 cf7c49e04c707..d5c0dfe0e1659 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,7 @@ Module( value: Name( ExprName { range: 4..5, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -50,7 +50,7 @@ Module( Name( ExprName { range: 20..21, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -81,7 +81,7 @@ 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 80f43b4bd6463..0038d2d015326 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,7 @@ Module( test: Name( ExprName { range: 3..4, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -29,7 +29,7 @@ Module( test: Name( ExprName { range: 8..9, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -50,7 +50,7 @@ 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 973d6d77074aa..790cf6f41a3d9 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,7 @@ 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 b36d6f97eaade..f67bc96ce73e3 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,14 @@ 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 7eada587cdee4..2f6c6423e18b7 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,7 @@ 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 2091165382461..9479f931659bb 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,7 @@ 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 0b5fdda550fb4..6a88db4d7b6d6 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,7 @@ 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 07706b4e062c1..3b8a41be099f0 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,7 @@ Module( value: Name( ExprName { range: 8..9, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -43,14 +43,14 @@ 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 d7b385d339a5f..3cd6de4d7ef8d 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,7 @@ Module( value: Name( ExprName { range: 8..8, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -40,7 +40,7 @@ Module( Alias { range: 16..17, name: Identifier { - id: "x", + id: Name("x"), range: 16..17, }, asname: None, @@ -61,7 +61,7 @@ Module( value: Name( ExprName { range: 20..20, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -71,7 +71,7 @@ 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 513a22fac0b04..aeccfea75ae89 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,7 @@ Module( Alias { range: 16..17, name: Identifier { - id: "x", + id: Name("x"), range: 16..17, }, asname: None, @@ -30,7 +30,7 @@ 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 d32507dc88cdd..28880171aa95e 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,7 @@ 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 05fbaf22c9c40..bbea803b8dc21 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,7 @@ Module( parameter: Parameter { range: 7..8, name: Identifier { - id: "x", + id: Name("x"), range: 7..8, }, annotation: None, @@ -44,7 +44,7 @@ Module( value: Name( ExprName { range: 11..12, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -75,7 +75,7 @@ Module( parameter: Parameter { range: 20..21, name: Identifier { - id: "x", + id: Name("x"), range: 20..21, }, annotation: None, @@ -94,7 +94,7 @@ Module( value: Name( ExprName { range: 24..25, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -130,7 +130,7 @@ Module( parameter: Parameter { range: 34..35, name: Identifier { - id: "x", + id: Name("x"), range: 34..35, }, annotation: None, @@ -149,7 +149,7 @@ Module( value: Name( ExprName { range: 38..39, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -161,7 +161,7 @@ Module( Name( ExprName { range: 41..42, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -188,7 +188,7 @@ Module( parameter: Parameter { range: 50..51, name: Identifier { - id: "x", + id: Name("x"), range: 50..51, }, annotation: None, @@ -212,14 +212,14 @@ 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 22675825920b2..072a112e0cf4e 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,7 @@ Module( parameter: Parameter { range: 7..8, name: Identifier { - id: "x", + id: Name("x"), range: 7..8, }, annotation: None, @@ -45,7 +45,7 @@ Module( Name( ExprName { range: 16..17, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -72,7 +72,7 @@ Module( parameter: Parameter { range: 25..26, name: Identifier { - id: "x", + id: Name("x"), range: 25..26, }, annotation: None, @@ -91,7 +91,7 @@ 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 70c3203746c26..309fb36a80be0 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,7 @@ 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 4f420387e903b..7d49c6ad3ca5f 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,7 @@ 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 2b4bd18bfc920..8964f5715f630 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,7 @@ 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 af91bab864b31..aacdafae78173 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,7 @@ Module( subject: Name( ExprName { range: 6..7, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -29,7 +29,7 @@ Module( Name( ExprName { range: 13..14, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -50,7 +50,7 @@ Module( subject: Name( ExprName { range: 25..26, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -63,7 +63,7 @@ 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 b697fd9a52465..d6414cd19885d 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,7 @@ Module( subject: Name( ExprName { range: 6..7, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -28,7 +28,7 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name("y"), range: 18..19, }, ), @@ -41,7 +41,7 @@ Module( value: Name( ExprName { range: 24..25, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -71,7 +71,7 @@ Module( subject: Name( ExprName { range: 37..38, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -84,7 +84,7 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name("y"), range: 49..50, }, ), @@ -97,7 +97,7 @@ Module( value: Name( ExprName { range: 56..57, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -127,7 +127,7 @@ Module( subject: Name( ExprName { range: 70..71, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -140,7 +140,7 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name("y"), range: 82..83, }, ), @@ -154,7 +154,7 @@ 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 f5d5a8223aab0..b66638023e68f 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,7 @@ Module( value: Name( ExprName { range: 8..9, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -70,14 +70,14 @@ 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 +90,7 @@ Module( Name( ExprName { range: 81..82, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -136,7 +136,7 @@ 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 f21bb6097843b..2b4abbd6375fc 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,7 @@ Module( subject: Name( ExprName { range: 6..7, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -28,7 +28,7 @@ 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 882bb79838791..da43e7947ca32 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,7 @@ Module( subject: Name( ExprName { range: 6..7, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -28,7 +28,7 @@ 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 2e8be2f3068a7..ca54385407968 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,7 @@ 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 aeed10c67518c..6926b0bda064c 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,7 @@ 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 2a3a470fadc5d..652815a142627 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,14 @@ 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 +148,14 @@ 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 +193,7 @@ Module( Name( ExprName { range: 168..171, - id: "exc", + id: Name("exc"), ctx: Load, }, ), @@ -244,7 +244,7 @@ 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 1456d1a7a8ede..7326c3c1a81fe 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -37,7 +37,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "bar", + id: Name("bar"), range: 22..25, }, type_params: None, @@ -70,7 +70,7 @@ 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 2becdd33525d5..1f46cd034fbaf 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,7 @@ 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 de8910ccb6777..67e6ac6f7826f 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,7 @@ Module( range: 11..22, names: [ Identifier { - id: "x", + id: Name("x"), range: 20..21, }, ], @@ -31,11 +31,11 @@ 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 d8b202163ab84..215fbe03dc835 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -28,7 +28,7 @@ Module( parameter: Parameter { range: 8..10, name: Identifier { - id: "x", + id: Name("x"), range: 8..9, }, annotation: None, @@ -61,7 +61,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 21..24, }, type_params: None, @@ -74,7 +74,7 @@ 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 b648cc9fddd6e..0ed6b9d9ba566 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -28,7 +28,7 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "x", + id: Name("x"), range: 8..9, }, annotation: None, @@ -61,7 +61,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 21..24, }, type_params: None, @@ -74,14 +74,14 @@ 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 eea04d97781a2..c63c0fdb25a9e 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -28,7 +28,7 @@ Module( parameter: Parameter { range: 8..17, name: Identifier { - id: "arg", + id: Name("arg"), range: 8..11, }, annotation: Some( @@ -38,7 +38,7 @@ Module( value: Name( ExprName { range: 14..17, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -75,7 +75,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 28..31, }, type_params: None, @@ -88,7 +88,7 @@ Module( parameter: Parameter { range: 32..46, name: Identifier { - id: "arg", + id: Name("arg"), range: 32..35, }, annotation: Some( @@ -99,7 +99,7 @@ Module( Name( ExprName { range: 43..46, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -136,7 +136,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 57..60, }, type_params: None, @@ -149,14 +149,14 @@ 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 +169,7 @@ 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 ad562a053f4f5..b26f96cb7aa23 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -28,7 +28,7 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "x", + id: Name("x"), range: 8..9, }, annotation: None, @@ -40,7 +40,7 @@ Module( value: Name( ExprName { range: 11..14, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -75,7 +75,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 25..28, }, type_params: None, @@ -88,7 +88,7 @@ Module( parameter: Parameter { range: 29..30, name: Identifier { - id: "x", + id: Name("x"), range: 29..30, }, annotation: None, @@ -100,7 +100,7 @@ Module( value: Name( ExprName { range: 33..36, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -135,7 +135,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 48..51, }, type_params: None, @@ -148,7 +148,7 @@ Module( parameter: Parameter { range: 52..53, name: Identifier { - id: "x", + id: Name("x"), range: 52..53, }, annotation: None, @@ -161,7 +161,7 @@ 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 388c8c721ab92..f036adb4b7691 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -27,7 +27,7 @@ Module( Parameter { range: 8..16, name: Identifier { - id: "args", + id: Name("args"), range: 9..13, }, annotation: Some( @@ -37,7 +37,7 @@ Module( value: Name( ExprName { range: 16..16, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -71,7 +71,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 27..30, }, type_params: None, @@ -83,7 +83,7 @@ Module( Parameter { range: 31..51, name: Identifier { - id: "args", + id: Name("args"), range: 32..36, }, annotation: Some( @@ -96,14 +96,14 @@ 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 +140,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 62..65, }, type_params: None, @@ -152,7 +152,7 @@ Module( Parameter { range: 66..84, name: Identifier { - id: "args", + id: Name("args"), range: 67..71, }, annotation: Some( @@ -167,14 +167,14 @@ 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 +211,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 95..98, }, type_params: None, @@ -223,7 +223,7 @@ Module( Parameter { range: 99..114, name: Identifier { - id: "args", + id: Name("args"), range: 100..104, }, annotation: Some( @@ -237,7 +237,7 @@ 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 47f14abfa5744..2ae962eaaadd8 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -28,7 +28,7 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "a", + id: Name("a"), range: 8..9, }, annotation: None, @@ -40,7 +40,7 @@ Module( parameter: Parameter { range: 11..12, name: Identifier { - id: "a", + id: Name("a"), range: 11..12, }, annotation: None, @@ -61,7 +61,7 @@ Module( Parameter { range: 17..19, name: Identifier { - id: "a", + id: Name("a"), range: 18..19, }, annotation: None, @@ -73,7 +73,7 @@ Module( parameter: Parameter { range: 21..22, name: Identifier { - id: "a", + id: Name("a"), range: 21..22, }, annotation: None, @@ -85,14 +85,14 @@ 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 +105,7 @@ 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 110d02ed1bdc0..4e068b2b641a0 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -48,7 +48,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 20..23, }, type_params: None, @@ -81,7 +81,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 37..40, }, type_params: None, @@ -94,7 +94,7 @@ Module( parameter: Parameter { range: 41..42, name: Identifier { - id: "a", + id: Name("a"), range: 41..42, }, annotation: None, @@ -127,7 +127,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 56..59, }, type_params: None, @@ -140,7 +140,7 @@ Module( parameter: Parameter { range: 60..61, name: Identifier { - id: "a", + id: Name("a"), range: 60..61, }, annotation: None, @@ -173,7 +173,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 76..79, }, type_params: None, @@ -187,7 +187,7 @@ 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 cd77b73780a0c..947b84535b813 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -29,7 +29,7 @@ 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 4f1c1d86137c1..dae60bc1861d1 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -28,7 +28,7 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "a", + id: Name("a"), range: 8..9, }, annotation: None, @@ -42,7 +42,7 @@ 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 df14cc04f70e7..4c16a418beefc 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -27,7 +27,7 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "a", + id: Name("a"), range: 8..9, }, annotation: None, @@ -41,7 +41,7 @@ Module( parameter: Parameter { range: 17..18, name: Identifier { - id: "b", + id: Name("b"), range: 17..18, }, annotation: None, @@ -74,7 +74,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 29..32, }, type_params: None, @@ -86,7 +86,7 @@ Module( parameter: Parameter { range: 33..34, name: Identifier { - id: "a", + id: Name("a"), range: 33..34, }, annotation: None, @@ -100,7 +100,7 @@ Module( parameter: Parameter { range: 39..40, name: Identifier { - id: "b", + id: Name("b"), range: 39..40, }, annotation: None, @@ -112,7 +112,7 @@ 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 7db636e923fc7..3b3be63cf6eba 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -28,7 +28,7 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "a", + id: Name("a"), range: 8..9, }, annotation: None, @@ -43,7 +43,7 @@ Module( parameter: Parameter { range: 17..18, name: Identifier { - id: "b", + id: Name("b"), range: 17..18, }, annotation: None, @@ -74,7 +74,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 29..32, }, type_params: None, @@ -87,7 +87,7 @@ Module( parameter: Parameter { range: 33..34, name: Identifier { - id: "a", + id: Name("a"), range: 33..34, }, annotation: None, @@ -102,7 +102,7 @@ Module( parameter: Parameter { range: 39..40, name: Identifier { - id: "b", + id: Name("b"), range: 39..40, }, annotation: None, @@ -114,7 +114,7 @@ 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 a74e1988f2d10..eb15f21b12726 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -28,7 +28,7 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "a", + id: Name("a"), range: 8..9, }, annotation: None, @@ -40,7 +40,7 @@ Module( Parameter { range: 14..19, name: Identifier { - id: "args", + id: Name("args"), range: 15..19, }, annotation: None, @@ -52,7 +52,7 @@ Module( parameter: Parameter { range: 21..22, name: Identifier { - id: "b", + id: Name("b"), range: 21..22, }, annotation: None, @@ -83,7 +83,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 67..70, }, type_params: None, @@ -96,7 +96,7 @@ Module( parameter: Parameter { range: 71..72, name: Identifier { - id: "a", + id: Name("a"), range: 71..72, }, annotation: None, @@ -108,7 +108,7 @@ Module( Parameter { range: 74..80, name: Identifier { - id: "args1", + id: Name("args1"), range: 75..80, }, annotation: None, @@ -120,7 +120,7 @@ Module( parameter: Parameter { range: 90..91, name: Identifier { - id: "b", + id: Name("b"), range: 90..91, }, annotation: None, @@ -151,7 +151,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 102..105, }, type_params: None, @@ -164,7 +164,7 @@ Module( parameter: Parameter { range: 106..107, name: Identifier { - id: "a", + id: Name("a"), range: 106..107, }, annotation: None, @@ -176,7 +176,7 @@ Module( Parameter { range: 109..115, name: Identifier { - id: "args1", + id: Name("args1"), range: 110..115, }, annotation: None, @@ -188,7 +188,7 @@ Module( parameter: Parameter { range: 117..118, name: Identifier { - id: "b", + id: Name("b"), range: 117..118, }, annotation: None, @@ -200,7 +200,7 @@ 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 e469e48e3846e..1e21ad9cffcdd 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -48,7 +48,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 20..23, }, type_params: None, @@ -61,7 +61,7 @@ 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 641923a7a0df0..7a8bfb02667da 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -28,7 +28,7 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "a", + id: Name("a"), range: 8..9, }, annotation: None, @@ -49,7 +49,7 @@ Module( parameter: Parameter { range: 14..15, name: Identifier { - id: "b", + id: Name("b"), range: 14..15, }, annotation: None, @@ -61,14 +61,14 @@ 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 a22c22b5bfde7..3537459b4815f 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -27,7 +27,7 @@ Module( Parameter { range: 8..10, name: Identifier { - id: "a", + id: Name("a"), range: 9..10, }, annotation: None, @@ -57,7 +57,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 24..27, }, type_params: None, @@ -69,7 +69,7 @@ Module( parameter: Parameter { range: 28..29, name: Identifier { - id: "a", + id: Name("a"), range: 28..29, }, annotation: None, @@ -82,7 +82,7 @@ Module( Parameter { range: 31..36, name: Identifier { - id: "args", + id: Name("args"), range: 32..36, }, annotation: None, @@ -94,7 +94,7 @@ Module( parameter: Parameter { range: 38..39, name: Identifier { - id: "b", + id: Name("b"), range: 38..39, }, annotation: None, @@ -125,7 +125,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 53..56, }, type_params: None, @@ -137,7 +137,7 @@ Module( parameter: Parameter { range: 57..58, name: Identifier { - id: "a", + id: Name("a"), range: 57..58, }, annotation: None, @@ -153,7 +153,7 @@ Module( parameter: Parameter { range: 66..67, name: Identifier { - id: "b", + id: Name("b"), range: 66..67, }, annotation: None, @@ -184,7 +184,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 78..81, }, type_params: None, @@ -196,7 +196,7 @@ Module( parameter: Parameter { range: 82..83, name: Identifier { - id: "a", + id: Name("a"), range: 82..83, }, annotation: None, @@ -212,7 +212,7 @@ Module( parameter: Parameter { range: 88..89, name: Identifier { - id: "b", + id: Name("b"), range: 88..89, }, annotation: None, @@ -224,7 +224,7 @@ Module( parameter: Parameter { range: 91..92, name: Identifier { - id: "c", + id: Name("c"), range: 91..92, }, annotation: None, @@ -236,7 +236,7 @@ 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 4f43b9e0f1506..4bf045bfe2bb0 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -28,7 +28,7 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "a", + id: Name("a"), range: 8..9, }, annotation: None, @@ -40,7 +40,7 @@ Module( Parameter { range: 11..16, name: Identifier { - id: "args", + id: Name("args"), range: 12..16, }, annotation: None, @@ -52,7 +52,7 @@ Module( parameter: Parameter { range: 21..22, name: Identifier { - id: "b", + id: Name("b"), range: 21..22, }, annotation: None, @@ -83,7 +83,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 33..36, }, type_params: None, @@ -96,7 +96,7 @@ Module( parameter: Parameter { range: 37..38, name: Identifier { - id: "a", + id: Name("a"), range: 37..38, }, annotation: None, @@ -108,7 +108,7 @@ Module( Parameter { range: 40..45, name: Identifier { - id: "args", + id: Name("args"), range: 41..45, }, annotation: None, @@ -120,7 +120,7 @@ Module( parameter: Parameter { range: 47..48, name: Identifier { - id: "b", + id: Name("b"), range: 47..48, }, annotation: None, @@ -132,7 +132,7 @@ 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 014b96b8e30a0..592ed1aee9e92 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -28,7 +28,7 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "a", + id: Name("a"), range: 8..9, }, annotation: None, @@ -42,7 +42,7 @@ 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 2e02269531855..6d7e25d0ed922 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -28,7 +28,7 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "a", + id: Name("a"), range: 8..9, }, annotation: None, @@ -40,7 +40,7 @@ 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 ea3cd182b7c15..9791d1587c1ea 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,7 @@ Module( Name( ExprName { range: 6..7, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -28,7 +28,7 @@ Module( value: Name( ExprName { range: 14..15, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -45,7 +45,7 @@ Module( Name( ExprName { range: 22..23, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -58,7 +58,7 @@ Module( Name( ExprName { range: 35..36, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -75,7 +75,7 @@ Module( Name( ExprName { range: 43..44, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -84,7 +84,7 @@ 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 0fe739737d244..1bc1f4ae38161 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,7 @@ Module( value: Name( ExprName { range: 7..8, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -41,7 +41,7 @@ Module( Name( ExprName { range: 21..22, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -59,7 +59,7 @@ 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 0e6aec6ac5202..812e245d45244 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,7 @@ Module( Name( ExprName { range: 6..7, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -29,7 +29,7 @@ Module( Name( ExprName { range: 13..14, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -48,7 +48,7 @@ Module( Name( ExprName { range: 22..23, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -61,14 +61,14 @@ 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 4e97be69714ea..529daca484bdb 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,7 @@ Module( Name( ExprName { range: 6..7, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -44,14 +44,14 @@ 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 +75,14 @@ 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 +96,7 @@ 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 2a3c1866e7999..3fab1c73c4864 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,7 @@ Module( func: Name( ExprName { range: 51..55, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -28,7 +28,7 @@ Module( Name( ExprName { range: 56..59, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -47,7 +47,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "bar", + id: Name("bar"), range: 64..67, }, type_params: None, @@ -78,7 +78,7 @@ Module( func: Name( ExprName { range: 116..120, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -88,7 +88,7 @@ Module( Name( ExprName { range: 121..124, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -104,7 +104,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "bar", + id: Name("bar"), range: 133..136, }, type_params: None, @@ -139,7 +139,7 @@ Module( func: Name( ExprName { range: 231..235, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -149,7 +149,7 @@ Module( Name( ExprName { range: 236..239, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -165,7 +165,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "bar", + id: Name("bar"), range: 250..253, }, type_params: None, @@ -200,7 +200,7 @@ Module( func: Name( ExprName { range: 347..351, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -210,7 +210,7 @@ Module( Name( ExprName { range: 352..355, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -226,7 +226,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "bar", + id: Name("bar"), range: 373..376, }, type_params: None, @@ -261,7 +261,7 @@ Module( func: Name( ExprName { range: 456..460, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -271,7 +271,7 @@ Module( Name( ExprName { range: 461..464, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -282,14 +282,14 @@ 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 +309,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "bar", + id: Name("bar"), range: 480..483, }, type_params: None, @@ -344,7 +344,7 @@ Module( func: Name( ExprName { range: 567..571, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -354,7 +354,7 @@ Module( Name( ExprName { range: 572..575, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -365,14 +365,14 @@ 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 +392,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "bar", + id: Name("bar"), range: 592..595, }, type_params: None, @@ -427,7 +427,7 @@ Module( func: Name( ExprName { range: 775..779, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -437,7 +437,7 @@ Module( Name( ExprName { range: 780..783, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -448,14 +448,14 @@ 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 +475,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "bar", + id: Name("bar"), range: 805..808, }, type_params: None, @@ -510,7 +510,7 @@ Module( func: Name( ExprName { range: 890..894, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -538,7 +538,7 @@ Module( expression: Name( ExprName { range: 904..905, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -571,7 +571,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "bar", + id: Name("bar"), range: 914..917, }, type_params: None, @@ -606,7 +606,7 @@ Module( func: Name( ExprName { range: 939..943, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -648,7 +648,7 @@ 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 72eca32ab69cf..ae531a84c9e80 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,7 @@ Module( func: Name( ExprName { range: 3..7, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -28,7 +28,7 @@ Module( Name( ExprName { range: 8..11, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -39,14 +39,14 @@ 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 +66,7 @@ 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 d11a5cf9263c2..a0bb006446740 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,7 @@ Module( func: Name( ExprName { range: 3..7, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -28,7 +28,7 @@ Module( Name( ExprName { range: 8..11, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -39,14 +39,14 @@ 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 +66,7 @@ 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 a4c68ae7d325e..19a53beeb7c9d 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,7 @@ Module( value: Name( ExprName { range: 192..198, - id: "format", + id: Name("format"), ctx: Load, }, ), @@ -97,7 +97,7 @@ Module( value: Name( ExprName { range: 199..203, - id: "spec", + id: Name("spec"), ctx: Load, }, ), @@ -272,7 +272,7 @@ Module( value: Name( ExprName { range: 285..291, - id: "format", + id: Name("format"), ctx: Load, }, ), @@ -284,7 +284,7 @@ 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 55113bd113f12..c0853fa67c81b 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,7 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -28,14 +28,14 @@ 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 +52,7 @@ 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 3b106ee408149..618e14d6131e7 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,7 @@ Module( func: Name( ExprName { range: 0..4, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -28,14 +28,14 @@ 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 +52,7 @@ 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 c5aa38428f4a8..92b3156f984c5 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,7 @@ 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 b4683fc253ad9..e41ff841620b0 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,7 @@ 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 70289856fd145..04335263b3c37 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,7 @@ Module( func: Name( ExprName { range: 234..238, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -40,7 +40,7 @@ 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 1c3fdfc0d03e4..855ddd3692ed7 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,7 @@ Module( value: Name( ExprName { range: 8..8, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -40,7 +40,7 @@ Module( Name( ExprName { range: 22..23, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -60,7 +60,7 @@ Module( value: Name( ExprName { range: 42..43, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -76,7 +76,7 @@ Module( Name( ExprName { range: 51..52, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -111,14 +111,14 @@ 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 1ba39f2032e4a..9f142a7f3098f 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,7 @@ Module( value: Name( ExprName { range: 0..1, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -27,7 +27,7 @@ Module( test: Name( ExprName { range: 6..7, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -43,7 +43,7 @@ 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 4e626de9d3ab4..249e3eeaf2b7e 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,7 @@ Module( value: Name( ExprName { range: 0..1, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -27,7 +27,7 @@ Module( value: Name( ExprName { range: 2..3, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -42,7 +42,7 @@ Module( left: Name( ExprName { range: 4..5, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -50,7 +50,7 @@ Module( right: Name( ExprName { range: 8..9, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -67,7 +67,7 @@ Module( left: Name( ExprName { range: 10..11, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -75,7 +75,7 @@ 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 16efe8b16c8cd..74c0737192489 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "keyword", + id: Name("keyword"), range: 800..807, }, type_params: Some( @@ -26,7 +26,7 @@ Module( TypeParamTypeVar { range: 808..809, name: Identifier { - id: "A", + id: Name("A"), range: 808..809, }, bound: None, @@ -37,7 +37,7 @@ Module( TypeParamTypeVar { range: 811..816, name: Identifier { - id: "await", + id: Name("await"), range: 811..816, }, bound: None, @@ -76,7 +76,7 @@ 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 +87,7 @@ Module( TypeParamTypeVar { range: 847..848, name: Identifier { - id: "A", + id: Name("A"), range: 847..848, }, bound: None, @@ -98,7 +98,7 @@ Module( TypeParamTypeVar { range: 853..854, name: Identifier { - id: "B", + id: Name("B"), range: 853..854, }, bound: None, @@ -137,7 +137,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "multiple_commas", + id: Name("multiple_commas"), range: 868..883, }, type_params: Some( @@ -148,7 +148,7 @@ Module( TypeParamTypeVar { range: 884..885, name: Identifier { - id: "A", + id: Name("A"), range: 884..885, }, bound: None, @@ -159,7 +159,7 @@ Module( TypeParamTypeVar { range: 887..888, name: Identifier { - id: "B", + id: Name("B"), range: 887..888, }, bound: None, @@ -198,7 +198,7 @@ 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 +209,7 @@ Module( TypeParamTypeVar { range: 927..928, name: Identifier { - id: "A", + id: Name("A"), range: 927..928, }, bound: None, @@ -248,7 +248,7 @@ 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 +259,7 @@ 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 bff02e86c476e..b5aee39941586 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,7 @@ Module( left: Name( ExprName { range: 129..130, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -41,7 +41,7 @@ Module( right: Name( ExprName { range: 133..134, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -65,7 +65,7 @@ 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 393c745df591e..93d999de17484 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,7 @@ Module( annotation: Name( ExprName { range: 221..224, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -97,14 +97,14 @@ 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 +132,7 @@ Module( target: Name( ExprName { range: 316..317, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -167,7 +167,7 @@ Module( left: Name( ExprName { range: 329..330, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -175,7 +175,7 @@ Module( right: Name( ExprName { range: 333..334, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -203,7 +203,7 @@ Module( operand: Name( ExprName { range: 341..342, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -237,7 +237,7 @@ Module( parameter: Parameter { range: 356..357, name: Identifier { - id: "_", + id: Name("_"), range: 356..357, }, annotation: None, @@ -281,21 +281,21 @@ 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 +375,7 @@ Module( Name( ExprName { range: 401..402, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -403,7 +403,7 @@ Module( elt: Name( ExprName { range: 410..411, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -413,14 +413,14 @@ 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 +451,7 @@ Module( elt: Name( ExprName { range: 431..432, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -461,14 +461,14 @@ 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 +499,7 @@ Module( key: Name( ExprName { range: 452..453, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -509,7 +509,7 @@ Module( left: Name( ExprName { range: 455..456, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -530,14 +530,14 @@ 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 +568,7 @@ Module( elt: Name( ExprName { range: 480..481, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -578,14 +578,14 @@ 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 +617,7 @@ Module( value: Name( ExprName { range: 506..507, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -645,7 +645,7 @@ Module( Name( ExprName { range: 520..521, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -673,7 +673,7 @@ Module( value: Name( ExprName { range: 540..542, - id: "xs", + id: Name("xs"), ctx: Load, }, ), @@ -700,7 +700,7 @@ Module( left: Name( ExprName { range: 549..550, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -712,14 +712,14 @@ 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 +747,7 @@ Module( func: Name( ExprName { range: 564..567, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -788,7 +788,7 @@ Module( expression: Name( ExprName { range: 579..583, - id: "quux", + id: Name("quux"), ctx: Load, }, ), @@ -839,7 +839,7 @@ Module( expression: Name( ExprName { range: 594..597, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -860,7 +860,7 @@ Module( expression: Name( ExprName { range: 604..607, - id: "bar", + id: Name("bar"), ctx: Load, }, ), @@ -1059,7 +1059,7 @@ Module( func: Name( ExprName { range: 678..681, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -1095,7 +1095,7 @@ Module( Name( ExprName { range: 690..691, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -1105,7 +1105,7 @@ Module( func: Name( ExprName { range: 693..696, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -1119,7 +1119,7 @@ Module( Name( ExprName { range: 700..701, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -1177,14 +1177,14 @@ 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 +1219,7 @@ Module( Name( ExprName { range: 735..736, - id: "d", + id: Name("d"), ctx: Store, }, ), @@ -1305,7 +1305,7 @@ Module( Name( ExprName { range: 760..761, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -1315,7 +1315,7 @@ Module( func: Name( ExprName { range: 763..766, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -1329,7 +1329,7 @@ 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 92fa9327512f3..c2a5904fdd5d4 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,14 @@ 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 +54,7 @@ Module( target: Name( ExprName { range: 111..112, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -88,7 +88,7 @@ Module( left: Name( ExprName { range: 125..126, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -96,7 +96,7 @@ Module( right: Name( ExprName { range: 129..130, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -123,7 +123,7 @@ Module( operand: Name( ExprName { range: 138..139, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -156,7 +156,7 @@ Module( parameter: Parameter { range: 154..155, name: Identifier { - id: "_", + id: Name("_"), range: 154..155, }, annotation: None, @@ -199,21 +199,21 @@ 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 +291,7 @@ Module( Name( ExprName { range: 202..203, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -318,7 +318,7 @@ Module( elt: Name( ExprName { range: 212..213, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -328,14 +328,14 @@ 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 +365,7 @@ Module( elt: Name( ExprName { range: 234..235, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -375,14 +375,14 @@ 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 +412,7 @@ Module( key: Name( ExprName { range: 256..257, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -422,7 +422,7 @@ Module( left: Name( ExprName { range: 259..260, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -443,14 +443,14 @@ 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 +480,7 @@ Module( elt: Name( ExprName { range: 285..286, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -490,14 +490,14 @@ 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 +528,7 @@ Module( value: Name( ExprName { range: 312..313, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -555,7 +555,7 @@ Module( Name( ExprName { range: 327..328, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -582,7 +582,7 @@ Module( value: Name( ExprName { range: 348..350, - id: "xs", + id: Name("xs"), ctx: Load, }, ), @@ -608,7 +608,7 @@ Module( left: Name( ExprName { range: 358..359, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -620,14 +620,14 @@ 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 +654,7 @@ Module( func: Name( ExprName { range: 374..377, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -694,7 +694,7 @@ Module( expression: Name( ExprName { range: 390..394, - id: "quux", + id: Name("quux"), ctx: Load, }, ), @@ -744,7 +744,7 @@ Module( expression: Name( ExprName { range: 406..409, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -765,7 +765,7 @@ Module( expression: Name( ExprName { range: 416..419, - id: "bar", + id: Name("bar"), ctx: Load, }, ), @@ -957,7 +957,7 @@ Module( func: Name( ExprName { range: 497..500, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -992,7 +992,7 @@ Module( Name( ExprName { range: 510..511, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -1002,7 +1002,7 @@ Module( func: Name( ExprName { range: 513..516, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -1016,7 +1016,7 @@ Module( Name( ExprName { range: 520..521, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -1073,14 +1073,14 @@ 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 +1115,7 @@ Module( Name( ExprName { range: 556..557, - id: "d", + id: Name("d"), ctx: Store, }, ), @@ -1200,7 +1200,7 @@ Module( Name( ExprName { range: 582..583, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -1210,7 +1210,7 @@ Module( func: Name( ExprName { range: 585..588, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -1224,7 +1224,7 @@ 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 3baeb69fe78ba..dc4b2f014ac71 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,7 @@ Module( subject: Name( ExprName { range: 6..13, - id: "subject", + id: Name("subject"), ctx: Load, }, ), @@ -28,7 +28,7 @@ Module( cls: Name( ExprName { range: 133..139, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -41,7 +41,7 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name("a"), range: 141..142, }, ), @@ -53,7 +53,7 @@ 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 78c331540125d..33420817cfa55 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,7 @@ Module( subject: Name( ExprName { range: 6..13, - id: "subject", + id: Name("subject"), ctx: Load, }, ), @@ -31,7 +31,7 @@ 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 736d318dfb882..876b3f9e0277b 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,7 @@ Module( subject: Name( ExprName { range: 6..13, - id: "subject", + id: Name("subject"), ctx: Load, }, ), @@ -32,7 +32,7 @@ Module( pattern: None, name: Some( Identifier { - id: "x", + id: Name("x"), range: 164..165, }, ), @@ -41,7 +41,7 @@ Module( ), name: Some( Identifier { - id: "y", + id: Name("y"), range: 169..170, }, ), @@ -70,7 +70,7 @@ 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 89f02bcde3991..b85e698131648 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,7 @@ Module( subject: Name( ExprName { range: 6..13, - id: "subject", + id: Name("subject"), ctx: Load, }, ), @@ -44,7 +44,7 @@ Module( pattern: None, name: Some( Identifier { - id: "x", + id: Name("x"), range: 110..111, }, ), @@ -53,7 +53,7 @@ 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 3b1a06c49d7a2..8504acd1c44e9 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,7 @@ Module( subject: Name( ExprName { range: 6..13, - id: "subject", + id: Name("subject"), ctx: Load, }, ), @@ -29,14 +29,14 @@ 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 +48,7 @@ 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 288f3909d4fc3..516051a1fd77e 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,7 @@ Module( subject: Name( ExprName { range: 50..57, - id: "subject", + id: Name("subject"), ctx: Load, }, ), @@ -28,7 +28,7 @@ Module( cls: Name( ExprName { range: 68..71, - id: "Foo", + id: Name("Foo"), ctx: Load, }, ), @@ -39,7 +39,7 @@ Module( PatternKeyword { range: 72..82, attr: Identifier { - id: "", + id: Name(""), range: 80..80, }, pattern: MatchValue( @@ -77,7 +77,7 @@ Module( cls: Name( ExprName { range: 107..110, - id: "Foo", + id: Name("Foo"), ctx: Load, }, ), @@ -88,7 +88,7 @@ Module( PatternKeyword { range: 111..120, attr: Identifier { - id: "", + id: Name(""), range: 118..118, }, pattern: MatchValue( @@ -126,7 +126,7 @@ Module( cls: Name( ExprName { range: 145..148, - id: "Foo", + id: Name("Foo"), ctx: Load, }, ), @@ -137,7 +137,7 @@ Module( PatternKeyword { range: 149..159, attr: Identifier { - id: "", + id: Name(""), range: 157..157, }, pattern: MatchValue( @@ -175,7 +175,7 @@ Module( cls: Name( ExprName { range: 184..187, - id: "Foo", + id: Name("Foo"), ctx: Load, }, ), @@ -186,7 +186,7 @@ Module( PatternKeyword { range: 188..202, attr: Identifier { - id: "", + id: Name(""), range: 200..200, }, pattern: MatchValue( @@ -224,7 +224,7 @@ Module( cls: Name( ExprName { range: 227..230, - id: "Foo", + id: Name("Foo"), ctx: Load, }, ), @@ -235,7 +235,7 @@ Module( PatternKeyword { range: 231..234, attr: Identifier { - id: "", + id: Name(""), range: 233..233, }, pattern: MatchValue( @@ -273,7 +273,7 @@ Module( cls: Name( ExprName { range: 259..262, - id: "Foo", + id: Name("Foo"), ctx: Load, }, ), @@ -284,7 +284,7 @@ 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 2185fc051d68d..36411e6e8a3a9 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,7 @@ Module( subject: Name( ExprName { range: 6..25, - id: "invalid_lhs_pattern", + id: Name("invalid_lhs_pattern"), ctx: Load, }, ), @@ -34,7 +34,7 @@ Module( func: Name( ExprName { range: 36..39, - id: "Foo", + id: Name("Foo"), ctx: Load, }, ), @@ -79,7 +79,7 @@ Module( left: Name( ExprName { range: 70..71, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -117,7 +117,7 @@ Module( left: Name( ExprName { range: 100..101, - id: "_", + id: Name("_"), ctx: Store, }, ), @@ -408,7 +408,7 @@ Module( func: Name( ExprName { range: 302..305, - id: "Foo", + id: Name("Foo"), ctx: Load, }, ), @@ -418,7 +418,7 @@ Module( Name( ExprName { range: 306..312, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -459,7 +459,7 @@ Module( subject: Name( ExprName { range: 340..359, - id: "invalid_rhs_pattern", + id: Name("invalid_rhs_pattern"), ctx: Load, }, ), @@ -487,7 +487,7 @@ Module( func: Name( ExprName { range: 374..377, - id: "Foo", + id: Name("Foo"), ctx: Load, }, ), @@ -531,7 +531,7 @@ Module( right: Name( ExprName { range: 407..408, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -568,7 +568,7 @@ Module( right: Name( ExprName { range: 436..437, - id: "_", + id: Name("_"), ctx: Store, }, ), @@ -807,7 +807,7 @@ Module( func: Name( ExprName { range: 600..603, - id: "Foo", + id: Name("Foo"), ctx: Load, }, ), @@ -817,7 +817,7 @@ Module( Name( ExprName { range: 604..610, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -848,7 +848,7 @@ Module( subject: Name( ExprName { range: 633..656, - id: "invalid_lhs_rhs_pattern", + id: Name("invalid_lhs_rhs_pattern"), ctx: Load, }, ), @@ -867,7 +867,7 @@ Module( func: Name( ExprName { range: 667..670, - id: "Foo", + id: Name("Foo"), ctx: Load, }, ), @@ -885,7 +885,7 @@ 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 c86688b9b0fbc..9140a01656a08 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,7 @@ Module( subject: Name( ExprName { range: 67..74, - id: "subject", + id: Name("subject"), ctx: Load, }, ), @@ -32,7 +32,7 @@ Module( value: Name( ExprName { range: 87..90, - id: "key", + id: Name("key"), ctx: Store, }, ), @@ -47,7 +47,7 @@ Module( value: Name( ExprName { range: 90..90, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -78,7 +78,7 @@ Module( value: Name( ExprName { range: 117..120, - id: "key", + id: Name("key"), ctx: Store, }, ), @@ -125,7 +125,7 @@ Module( value: Name( ExprName { range: 150..153, - id: "key", + id: Name("key"), ctx: Store, }, ), @@ -172,7 +172,7 @@ Module( value: Name( ExprName { range: 182..185, - id: "key", + id: Name("key"), ctx: Store, }, ), @@ -192,7 +192,7 @@ Module( value: Name( ExprName { range: 185..185, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -233,7 +233,7 @@ Module( subject: Name( ExprName { range: 311..318, - id: "subject", + id: Name("subject"), ctx: Load, }, ), @@ -267,7 +267,7 @@ Module( ], rest: Some( Identifier { - id: "rest", + id: Name("rest"), range: 332..336, }, ), @@ -311,7 +311,7 @@ Module( ], rest: Some( Identifier { - id: "rest2", + id: Name("rest2"), range: 382..387, }, ), @@ -355,7 +355,7 @@ Module( ], rest: Some( Identifier { - id: "rest2", + id: Name("rest2"), range: 442..447, }, ), @@ -379,7 +379,7 @@ Module( subject: Name( ExprName { range: 470..477, - id: "subject", + id: Name("subject"), ctx: Load, }, ), @@ -396,7 +396,7 @@ Module( func: Name( ExprName { range: 489..492, - id: "Foo", + id: Name("Foo"), ctx: Load, }, ), @@ -406,7 +406,7 @@ 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 ed6a2f1cdc4f3..229fca0ccdbe7 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,7 @@ Module( subject: Name( ExprName { range: 63..70, - id: "subject", + id: Name("subject"), ctx: Load, }, ), @@ -52,7 +52,7 @@ Module( ), name: Some( Identifier { - id: "x", + id: Name("x"), range: 113..114, }, ), @@ -74,7 +74,7 @@ Module( range: 138..142, name: Some( Identifier { - id: "foo", + id: Name("foo"), range: 139..142, }, ), @@ -100,7 +100,7 @@ Module( range: 166..170, name: Some( Identifier { - id: "foo", + id: Name("foo"), range: 167..170, }, ), @@ -155,7 +155,7 @@ Module( range: 202..206, name: Some( Identifier { - id: "foo", + id: Name("foo"), range: 203..206, }, ), @@ -181,7 +181,7 @@ Module( cls: Name( ExprName { range: 230..233, - id: "Foo", + id: Name("Foo"), ctx: Load, }, ), @@ -216,7 +216,7 @@ Module( cls: Name( ExprName { range: 261..264, - id: "Foo", + id: Name("Foo"), ctx: Load, }, ), @@ -227,7 +227,7 @@ Module( PatternKeyword { range: 265..269, attr: Identifier { - id: "x", + id: Name("x"), range: 265..266, }, pattern: MatchStar( @@ -262,7 +262,7 @@ Module( value: Name( ExprName { range: 296..297, - id: "_", + id: Name("_"), ctx: Store, }, ), @@ -277,7 +277,7 @@ Module( value: Name( ExprName { range: 297..297, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -308,7 +308,7 @@ Module( value: Name( ExprName { range: 324..325, - id: "_", + id: Name("_"), ctx: Store, }, ), @@ -398,7 +398,7 @@ 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 b17e7f476e63e..5aef2aa00c4c6 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,7 @@ Module( subject: Name( ExprName { range: 80..87, - id: "subject", + id: Name("subject"), ctx: Load, }, ), @@ -196,7 +196,7 @@ Module( cls: Name( ExprName { range: 194..197, - id: "Foo", + id: Name("Foo"), ctx: Load, }, ), @@ -207,7 +207,7 @@ Module( PatternKeyword { range: 198..202, attr: Identifier { - id: "x", + id: Name("x"), range: 198..199, }, pattern: MatchValue( @@ -233,7 +233,7 @@ 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 c37a03be19985..fc798e5a57a7a 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,14 @@ 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 +70,14 @@ 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 +93,7 @@ Module( context_expr: Name( ExprName { range: 213..214, - id: "f", + id: Name("f"), ctx: Load, }, ), @@ -128,14 +128,14 @@ 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 +151,7 @@ Module( context_expr: Name( ExprName { range: 241..246, - id: "item3", + id: Name("item3"), ctx: Load, }, ), @@ -185,7 +185,7 @@ Module( value: Name( ExprName { range: 260..264, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -222,7 +222,7 @@ Module( value: Name( ExprName { range: 278..282, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -233,7 +233,7 @@ Module( Name( ExprName { range: 287..288, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -267,7 +267,7 @@ Module( target: Name( ExprName { range: 300..304, - id: "item", + id: Name("item"), ctx: Store, }, ), @@ -285,7 +285,7 @@ Module( Name( ExprName { range: 314..315, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -316,7 +316,7 @@ Module( context_expr: Name( ExprName { range: 328..333, - id: "item1", + id: Name("item1"), ctx: Load, }, ), @@ -330,7 +330,7 @@ Module( target: Name( ExprName { range: 335..340, - id: "item2", + id: Name("item2"), ctx: Store, }, ), @@ -348,7 +348,7 @@ Module( Name( ExprName { range: 350..351, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -382,7 +382,7 @@ Module( elt: Name( ExprName { range: 364..365, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -392,7 +392,7 @@ Module( target: Name( ExprName { range: 370..371, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -402,7 +402,7 @@ Module( func: Name( ExprName { range: 375..380, - id: "range", + id: Name("range"), ctx: Load, }, ), @@ -436,7 +436,7 @@ Module( context_expr: Name( ExprName { range: 386..390, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -471,14 +471,14 @@ 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 +500,7 @@ Module( target: Name( ExprName { range: 415..416, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -510,7 +510,7 @@ Module( func: Name( ExprName { range: 420..425, - id: "range", + id: Name("range"), ctx: Load, }, ), @@ -557,7 +557,7 @@ Module( value: Name( ExprName { range: 504..508, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -597,7 +597,7 @@ Module( value: Name( ExprName { range: 524..525, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -610,14 +610,14 @@ 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 +635,7 @@ Module( context_expr: Name( ExprName { range: 541..545, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -670,7 +670,7 @@ Module( Name( ExprName { range: 558..563, - id: "item1", + id: Name("item1"), ctx: Load, }, ), @@ -680,7 +680,7 @@ Module( value: Name( ExprName { range: 566..567, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -705,7 +705,7 @@ Module( target: Name( ExprName { range: 572..573, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -716,14 +716,14 @@ 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 +756,7 @@ Module( context_expr: Name( ExprName { range: 601..602, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -764,7 +764,7 @@ Module( Name( ExprName { range: 606..607, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -778,7 +778,7 @@ Module( value: Name( ExprName { range: 610..611, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -815,7 +815,7 @@ Module( value: Name( ExprName { range: 625..626, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -829,7 +829,7 @@ Module( context_expr: Name( ExprName { range: 628..629, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -837,7 +837,7 @@ Module( Name( ExprName { range: 633..634, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -872,7 +872,7 @@ Module( Name( ExprName { range: 647..648, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -883,7 +883,7 @@ Module( Name( ExprName { range: 656..657, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -926,7 +926,7 @@ Module( Name( ExprName { range: 670..671, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -941,14 +941,14 @@ 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 +996,7 @@ Module( Name( ExprName { range: 696..697, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1006,7 +1006,7 @@ Module( value: Name( ExprName { range: 710..711, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -1044,7 +1044,7 @@ Module( context_expr: Name( ExprName { range: 724..725, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1052,7 +1052,7 @@ Module( Name( ExprName { range: 729..730, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -1063,7 +1063,7 @@ Module( context_expr: Name( ExprName { range: 732..733, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -1079,7 +1079,7 @@ Module( target: Name( ExprName { range: 738..739, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -1105,7 +1105,7 @@ Module( elt: Name( ExprName { range: 751..752, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1115,14 +1115,14 @@ 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 +1137,7 @@ Module( Name( ExprName { range: 770..771, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -1168,7 +1168,7 @@ Module( context_expr: Name( ExprName { range: 844..848, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -1176,7 +1176,7 @@ Module( Name( ExprName { range: 852..853, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -1206,7 +1206,7 @@ Module( context_expr: Name( ExprName { range: 868..872, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -1214,7 +1214,7 @@ Module( Name( ExprName { range: 876..877, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -1230,7 +1230,7 @@ Module( target: Name( ExprName { range: 880..881, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -1253,7 +1253,7 @@ Module( context_expr: Name( ExprName { range: 893..897, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -1261,7 +1261,7 @@ Module( Name( ExprName { range: 901..903, - id: "f1", + id: Name("f1"), ctx: Store, }, ), @@ -1277,7 +1277,7 @@ Module( target: Name( ExprName { range: 908..910, - id: "f2", + id: Name("f2"), ctx: Store, }, ), @@ -1300,7 +1300,7 @@ Module( context_expr: Name( ExprName { range: 922..927, - id: "item1", + id: Name("item1"), ctx: Load, }, ), @@ -1308,7 +1308,7 @@ Module( Name( ExprName { range: 931..932, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -1322,7 +1322,7 @@ 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 643131e041715..4020ae4c6f667 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,7 @@ Module( left: Name( ExprName { range: 100..101, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -45,7 +45,7 @@ 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 cb8bddca0d205..d57dd4fa5391c 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,7 @@ Module( context_expr: Name( ExprName { range: 6..6, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -36,7 +36,7 @@ Module( left: Name( ExprName { range: 9..10, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -44,7 +44,7 @@ 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 54267677e53e3..d6bbc87fdf0ae 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,7 @@ 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 cd69d7291a876..49acdd3d36702 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,7 @@ Module( context_expr: Name( ExprName { range: 91..95, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -45,7 +45,7 @@ Module( context_expr: Name( ExprName { range: 108..112, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -53,7 +53,7 @@ Module( Name( ExprName { range: 116..117, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -82,7 +82,7 @@ Module( value: Name( ExprName { range: 131..135, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -114,7 +114,7 @@ Module( value: Name( ExprName { range: 148..152, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -125,7 +125,7 @@ Module( Name( ExprName { range: 156..157, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -154,7 +154,7 @@ Module( value: Name( ExprName { range: 170..175, - id: "item1", + id: Name("item1"), ctx: Load, }, ), @@ -168,7 +168,7 @@ Module( context_expr: Name( ExprName { range: 177..182, - id: "item2", + id: Name("item2"), ctx: Load, }, ), @@ -176,7 +176,7 @@ Module( Name( ExprName { range: 186..187, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -202,7 +202,7 @@ Module( context_expr: Name( ExprName { range: 199..204, - id: "item1", + id: Name("item1"), ctx: Load, }, ), @@ -210,7 +210,7 @@ Module( Name( ExprName { range: 208..209, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -224,7 +224,7 @@ Module( value: Name( ExprName { range: 212..217, - id: "item2", + id: Name("item2"), ctx: Load, }, ), @@ -253,7 +253,7 @@ Module( context_expr: Name( ExprName { range: 229..233, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -273,7 +273,7 @@ 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 7b73799637c2d..3e669c93b2458 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,14 @@ 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 +63,7 @@ Module( Name( ExprName { range: 77..78, - id: "a", + id: Name("a"), ctx: Store, }, ), @@ -115,14 +115,14 @@ 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 +142,7 @@ 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 485b07c4d2ffe..6d0087f3914ff 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,7 @@ Module( value: Name( ExprName { range: 0..4, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -27,7 +27,7 @@ Module( value: Name( ExprName { range: 5..9, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -39,7 +39,7 @@ Module( value: Name( ExprName { range: 10..11, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -51,7 +51,7 @@ Module( name: Name( ExprName { range: 17..18, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -59,7 +59,7 @@ 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 35bdc091848b0..18d1aa88e9a6b 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,7 @@ Module( name: Name( ExprName { range: 5..6, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -26,7 +26,7 @@ Module( value: Name( ExprName { range: 10..11, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -41,7 +41,7 @@ Module( name: Name( ExprName { range: 17..18, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -53,7 +53,7 @@ Module( Name( ExprName { range: 27..28, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -68,7 +68,7 @@ Module( name: Name( ExprName { range: 34..35, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -79,7 +79,7 @@ Module( value: Name( ExprName { range: 49..50, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -93,7 +93,7 @@ Module( name: Name( ExprName { range: 56..57, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -101,7 +101,7 @@ 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 6ce990e253a44..0189a0298a22c 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,7 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -27,7 +27,7 @@ Module( TypeParamTypeVar { range: 7..14, name: Identifier { - id: "T", + id: Name("T"), range: 7..8, }, bound: Some( @@ -37,7 +37,7 @@ Module( value: Name( ExprName { range: 11..14, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -54,7 +54,7 @@ Module( value: Name( ExprName { range: 18..21, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -66,7 +66,7 @@ Module( name: Name( ExprName { range: 27..28, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -78,7 +78,7 @@ Module( TypeParamTypeVar { range: 29..39, name: Identifier { - id: "T", + id: Name("T"), range: 29..30, }, bound: Some( @@ -89,7 +89,7 @@ Module( Name( ExprName { range: 38..39, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -106,7 +106,7 @@ Module( value: Name( ExprName { range: 43..46, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -118,7 +118,7 @@ Module( name: Name( ExprName { range: 52..53, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -130,7 +130,7 @@ Module( TypeParamTypeVar { range: 54..69, name: Identifier { - id: "T", + id: Name("T"), range: 54..55, }, bound: Some( @@ -140,7 +140,7 @@ Module( value: Name( ExprName { range: 68..69, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -156,7 +156,7 @@ Module( value: Name( ExprName { range: 73..76, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -168,7 +168,7 @@ Module( name: Name( ExprName { range: 82..83, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -180,14 +180,14 @@ 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 +199,7 @@ Module( TypeParamTypeVar { range: 92..95, name: Identifier { - id: "int", + id: Name("int"), range: 92..95, }, bound: None, @@ -212,7 +212,7 @@ 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 c4a22ec121b32..a862c5c00fab0 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,7 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -27,7 +27,7 @@ Module( TypeParamTypeVar { range: 7..9, name: Identifier { - id: "T", + id: Name("T"), range: 7..8, }, bound: None, @@ -40,7 +40,7 @@ Module( value: Name( ExprName { range: 14..17, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -52,7 +52,7 @@ Module( name: Name( ExprName { range: 23..24, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -64,7 +64,7 @@ Module( TypeParamTypeVar { range: 25..28, name: Identifier { - id: "T1", + id: Name("T1"), range: 25..27, }, bound: None, @@ -75,7 +75,7 @@ Module( TypeParamTypeVar { range: 31..33, name: Identifier { - id: "T2", + id: Name("T2"), range: 31..33, }, bound: None, @@ -88,7 +88,7 @@ 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 976cdf2c1c493..0a397668bfd26 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,7 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -27,7 +27,7 @@ Module( TypeParamParamSpec { range: 7..10, name: Identifier { - id: "T", + id: Name("T"), range: 9..10, }, default: None, @@ -39,7 +39,7 @@ Module( value: Name( ExprName { range: 10..10, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -51,7 +51,7 @@ Module( value: Name( ExprName { range: 12..15, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -63,7 +63,7 @@ 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 dbaa4ecf56734..2b72b38ec4852 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,7 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -27,7 +27,7 @@ Module( TypeParamParamSpec { range: 7..17, name: Identifier { - id: "P", + id: Name("P"), range: 9..10, }, default: Some( @@ -37,7 +37,7 @@ Module( value: Name( ExprName { range: 14..17, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -53,7 +53,7 @@ Module( value: Name( ExprName { range: 21..24, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -65,7 +65,7 @@ Module( name: Name( ExprName { range: 30..31, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -77,7 +77,7 @@ Module( TypeParamParamSpec { range: 32..45, name: Identifier { - id: "P", + id: Name("P"), range: 34..35, }, default: Some( @@ -88,7 +88,7 @@ Module( Name( ExprName { range: 44..45, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -104,7 +104,7 @@ Module( value: Name( ExprName { range: 49..52, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -116,7 +116,7 @@ Module( name: Name( ExprName { range: 58..59, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -128,7 +128,7 @@ Module( TypeParamParamSpec { range: 60..78, name: Identifier { - id: "P", + id: Name("P"), range: 62..63, }, default: Some( @@ -138,7 +138,7 @@ Module( value: Name( ExprName { range: 77..78, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -153,7 +153,7 @@ Module( value: Name( ExprName { range: 82..85, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -165,7 +165,7 @@ Module( name: Name( ExprName { range: 91..92, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -177,14 +177,14 @@ 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 +195,7 @@ Module( TypeParamTypeVar { range: 104..107, name: Identifier { - id: "int", + id: Name("int"), range: 104..107, }, bound: None, @@ -208,7 +208,7 @@ Module( value: Name( ExprName { range: 111..114, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -220,7 +220,7 @@ Module( name: Name( ExprName { range: 120..121, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -232,7 +232,7 @@ Module( TypeParamParamSpec { range: 122..132, name: Identifier { - id: "P", + id: Name("P"), range: 124..125, }, default: Some( @@ -242,7 +242,7 @@ Module( value: Name( ExprName { range: 129..132, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -258,7 +258,7 @@ 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 26192a5aec7ee..8f0e5d21d679f 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,7 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -27,7 +27,7 @@ Module( TypeParamParamSpec { range: 7..12, name: Identifier { - id: "P", + id: Name("P"), range: 9..10, }, default: None, @@ -39,7 +39,7 @@ Module( value: Name( ExprName { range: 16..19, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -51,7 +51,7 @@ Module( name: Name( ExprName { range: 25..26, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -63,7 +63,7 @@ Module( TypeParamParamSpec { range: 27..32, name: Identifier { - id: "P", + id: Name("P"), range: 29..30, }, default: None, @@ -73,7 +73,7 @@ Module( TypeParamTypeVar { range: 34..36, name: Identifier { - id: "T2", + id: Name("T2"), range: 34..36, }, bound: None, @@ -86,7 +86,7 @@ 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 439efae18716c..cd92900925e73 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,7 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -27,7 +27,7 @@ Module( TypeParamTypeVar { range: 7..15, name: Identifier { - id: "T", + id: Name("T"), range: 7..8, }, bound: None, @@ -38,7 +38,7 @@ Module( value: Name( ExprName { range: 12..15, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -54,7 +54,7 @@ Module( value: Name( ExprName { range: 19..22, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -66,7 +66,7 @@ Module( name: Name( ExprName { range: 28..29, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -78,7 +78,7 @@ Module( TypeParamTypeVar { range: 30..41, name: Identifier { - id: "T", + id: Name("T"), range: 30..31, }, bound: None, @@ -90,7 +90,7 @@ Module( Name( ExprName { range: 40..41, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -106,7 +106,7 @@ Module( value: Name( ExprName { range: 45..48, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -118,7 +118,7 @@ Module( name: Name( ExprName { range: 54..55, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -130,7 +130,7 @@ Module( TypeParamTypeVar { range: 56..69, name: Identifier { - id: "T", + id: Name("T"), range: 56..57, }, bound: None, @@ -142,7 +142,7 @@ Module( Name( ExprName { range: 67..68, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -158,7 +158,7 @@ Module( value: Name( ExprName { range: 73..76, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -170,7 +170,7 @@ Module( name: Name( ExprName { range: 82..83, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -182,7 +182,7 @@ Module( TypeParamTypeVar { range: 84..100, name: Identifier { - id: "T", + id: Name("T"), range: 84..85, }, bound: None, @@ -193,7 +193,7 @@ Module( value: Name( ExprName { range: 99..100, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -208,7 +208,7 @@ Module( value: Name( ExprName { range: 104..107, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -220,7 +220,7 @@ Module( name: Name( ExprName { range: 113..114, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -232,7 +232,7 @@ Module( TypeParamTypeVar { range: 115..120, name: Identifier { - id: "T", + id: Name("T"), range: 115..116, }, bound: None, @@ -240,7 +240,7 @@ Module( Name( ExprName { range: 119..120, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -251,7 +251,7 @@ Module( TypeParamTypeVar { range: 124..127, name: Identifier { - id: "int", + id: Name("int"), range: 124..127, }, bound: None, @@ -264,7 +264,7 @@ Module( value: Name( ExprName { range: 131..134, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -276,7 +276,7 @@ Module( name: Name( ExprName { range: 140..141, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -288,14 +288,14 @@ 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 +307,7 @@ Module( value: Name( ExprName { range: 152..155, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -323,7 +323,7 @@ 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 7f4c56d9d7bb3..520d99051313b 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,7 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -27,7 +27,7 @@ Module( TypeParamTypeVar { range: 7..10, name: Identifier { - id: "T", + id: Name("T"), range: 7..8, }, bound: None, @@ -40,7 +40,7 @@ Module( value: Name( ExprName { range: 14..17, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -52,7 +52,7 @@ Module( name: Name( ExprName { range: 23..24, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -64,14 +64,14 @@ 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 +85,7 @@ Module( value: Name( ExprName { range: 37..40, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -97,7 +97,7 @@ Module( name: Name( ExprName { range: 46..47, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -109,7 +109,7 @@ Module( TypeParamTypeVar { range: 48..52, name: Identifier { - id: "T1", + id: Name("T1"), range: 48..50, }, bound: None, @@ -120,7 +120,7 @@ Module( TypeParamTypeVar { range: 54..56, name: Identifier { - id: "T2", + id: Name("T2"), range: 54..56, }, bound: None, @@ -133,7 +133,7 @@ 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 a5a86ddffdcda..7eef158c8eccb 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,7 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -27,7 +27,7 @@ Module( TypeParamTypeVarTuple { range: 7..9, name: Identifier { - id: "T", + id: Name("T"), range: 8..9, }, default: None, @@ -39,7 +39,7 @@ Module( value: Name( ExprName { range: 9..9, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -51,7 +51,7 @@ Module( value: Name( ExprName { range: 11..14, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -63,7 +63,7 @@ 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 b17121dac3536..93a91038fe881 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,7 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -27,7 +27,7 @@ Module( TypeParamTypeVarTuple { range: 7..17, name: Identifier { - id: "Ts", + id: Name("Ts"), range: 8..10, }, default: Some( @@ -37,7 +37,7 @@ Module( value: Name( ExprName { range: 14..17, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -53,7 +53,7 @@ Module( value: Name( ExprName { range: 21..24, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -65,7 +65,7 @@ Module( name: Name( ExprName { range: 30..31, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -77,7 +77,7 @@ Module( TypeParamTypeVarTuple { range: 32..49, name: Identifier { - id: "Ts", + id: Name("Ts"), range: 33..35, }, default: Some( @@ -92,14 +92,14 @@ 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 +118,7 @@ Module( value: Name( ExprName { range: 53..56, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -130,7 +130,7 @@ Module( name: Name( ExprName { range: 62..63, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -142,7 +142,7 @@ Module( TypeParamTypeVarTuple { range: 64..77, name: Identifier { - id: "Ts", + id: Name("Ts"), range: 65..67, }, default: Some( @@ -153,7 +153,7 @@ Module( Name( ExprName { range: 76..77, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -169,7 +169,7 @@ Module( value: Name( ExprName { range: 81..84, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -181,7 +181,7 @@ Module( name: Name( ExprName { range: 90..91, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -193,7 +193,7 @@ Module( TypeParamTypeVarTuple { range: 92..110, name: Identifier { - id: "Ts", + id: Name("Ts"), range: 93..95, }, default: Some( @@ -203,7 +203,7 @@ Module( value: Name( ExprName { range: 109..110, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -218,7 +218,7 @@ Module( value: Name( ExprName { range: 114..117, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -230,7 +230,7 @@ Module( name: Name( ExprName { range: 123..124, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -242,14 +242,14 @@ 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 +260,7 @@ Module( TypeParamTypeVar { range: 136..139, name: Identifier { - id: "int", + id: Name("int"), range: 136..139, }, bound: None, @@ -273,7 +273,7 @@ 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 c1fa0dfd5a7d2..289b8bb50c7c3 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,7 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -27,7 +27,7 @@ Module( TypeParamTypeVarTuple { range: 7..12, name: Identifier { - id: "Ts", + id: Name("Ts"), range: 8..10, }, default: None, @@ -39,7 +39,7 @@ Module( value: Name( ExprName { range: 16..19, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -51,7 +51,7 @@ Module( name: Name( ExprName { range: 25..26, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -63,7 +63,7 @@ Module( TypeParamTypeVarTuple { range: 27..32, name: Identifier { - id: "Ts", + id: Name("Ts"), range: 28..30, }, default: None, @@ -73,7 +73,7 @@ Module( TypeParamTypeVar { range: 34..36, name: Identifier { - id: "T2", + id: Name("T2"), range: 34..36, }, bound: None, @@ -86,7 +86,7 @@ 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 3baa5f941a44f..7bd405e6cb63c 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: Some( @@ -48,7 +48,7 @@ Module( name: Name( ExprName { range: 27..36, - id: "ListOrSet", + id: Name("ListOrSet"), ctx: Store, }, ), @@ -64,7 +64,7 @@ Module( left: Name( ExprName { range: 41..45, - id: "list", + id: Name("list"), ctx: Load, }, ), @@ -72,7 +72,7 @@ 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 56366ca7a45a4..671610d094cfe 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,7 @@ Module( expression: Name( ExprName { range: 23..24, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -159,7 +159,7 @@ Module( expression: Name( ExprName { range: 40..41, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -238,7 +238,7 @@ 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 f137f3aa87ea0..0db4304449ad9 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,7 @@ Module( value: Name( ExprName { range: 7..8, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -50,7 +50,7 @@ Module( Name( ExprName { range: 26..27, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -78,7 +78,7 @@ Module( test: Name( ExprName { range: 39..40, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -92,7 +92,7 @@ Module( target: Name( ExprName { range: 42..43, - id: "b", + id: Name("b"), ctx: Store, }, ), @@ -114,7 +114,7 @@ Module( target: Name( ExprName { range: 55..56, - id: "a", + id: Name("a"), ctx: Store, }, ), @@ -138,7 +138,7 @@ 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 e02b4c349f80a..4f0bdeffb3012 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,7 @@ 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 ae8c83e43eebf..87534e7c81f72 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,7 @@ Module( test: Name( ExprName { range: 5..5, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -40,7 +40,7 @@ Module( test: Name( ExprName { range: 17..17, - id: "", + id: Name(""), ctx: Invalid, }, ), @@ -52,7 +52,7 @@ 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 0e9639c5491a0..e7b496148997b 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,7 @@ Module( context_expr: Name( ExprName { range: 34..39, - id: "item1", + id: Name("item1"), ctx: Load, }, ), @@ -30,7 +30,7 @@ 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 d963f9c1b8b3d..5fb688d6275b4 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,7 @@ Module( context_expr: Name( ExprName { range: 6..11, - id: "item1", + id: Name("item1"), ctx: Load, }, ), @@ -30,7 +30,7 @@ Module( context_expr: Name( ExprName { range: 12..17, - id: "item2", + id: Name("item2"), ctx: Load, }, ), @@ -61,7 +61,7 @@ Module( context_expr: Name( ExprName { range: 30..35, - id: "item1", + id: Name("item1"), ctx: Load, }, ), @@ -69,7 +69,7 @@ Module( Name( ExprName { range: 39..41, - id: "f1", + id: Name("f1"), ctx: Store, }, ), @@ -80,7 +80,7 @@ Module( context_expr: Name( ExprName { range: 42..47, - id: "item2", + id: Name("item2"), ctx: Load, }, ), @@ -111,7 +111,7 @@ Module( context_expr: Name( ExprName { range: 60..65, - id: "item1", + id: Name("item1"), ctx: Load, }, ), @@ -122,7 +122,7 @@ Module( context_expr: Name( ExprName { range: 67..72, - id: "item2", + id: Name("item2"), ctx: Load, }, ), @@ -133,7 +133,7 @@ Module( context_expr: Name( ExprName { range: 73..78, - id: "item3", + id: Name("item3"), ctx: Load, }, ), @@ -144,7 +144,7 @@ Module( context_expr: Name( ExprName { range: 80..85, - id: "item4", + id: Name("item4"), ctx: Load, }, ), @@ -175,7 +175,7 @@ Module( context_expr: Name( ExprName { range: 98..103, - id: "item1", + id: Name("item1"), ctx: Load, }, ), @@ -186,7 +186,7 @@ Module( context_expr: Name( ExprName { range: 105..110, - id: "item2", + id: Name("item2"), ctx: Load, }, ), @@ -194,7 +194,7 @@ Module( Name( ExprName { range: 114..116, - id: "f1", + id: Name("f1"), ctx: Store, }, ), @@ -205,7 +205,7 @@ Module( context_expr: Name( ExprName { range: 117..122, - id: "item3", + id: Name("item3"), ctx: Load, }, ), @@ -216,7 +216,7 @@ Module( context_expr: Name( ExprName { range: 124..129, - id: "item4", + id: Name("item4"), ctx: Load, }, ), @@ -251,14 +251,14 @@ 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 500e275e86d26..3f93607ce7a07 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,14 @@ 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 +68,7 @@ Module( left: Name( ExprName { range: 150..151, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -79,7 +79,7 @@ Module( Name( ExprName { range: 160..161, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -118,7 +118,7 @@ Module( Name( ExprName { range: 202..203, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -130,14 +130,14 @@ 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 +184,14 @@ 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 +201,7 @@ Module( Name( ExprName { range: 239..240, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -244,7 +244,7 @@ Module( left: Name( ExprName { range: 252..253, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -252,7 +252,7 @@ Module( right: Name( ExprName { range: 256..257, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -262,7 +262,7 @@ Module( right: Name( ExprName { range: 262..263, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -272,7 +272,7 @@ Module( right: Name( ExprName { range: 266..267, - id: "d", + id: Name("d"), ctx: Load, }, ), @@ -311,7 +311,7 @@ Module( value: Name( ExprName { range: 318..319, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -333,7 +333,7 @@ Module( left: Name( ExprName { range: 326..327, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -341,7 +341,7 @@ 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 97ec50ffc2523..97bf4a9334a69 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,14 @@ 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 +80,7 @@ Module( elt: Name( ExprName { range: 35..36, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -90,14 +90,14 @@ 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 +111,7 @@ Module( orelse: Name( ExprName { range: 65..66, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -156,7 +156,7 @@ Module( elt: Name( ExprName { range: 78..79, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -166,14 +166,14 @@ 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 +187,7 @@ Module( orelse: Name( ExprName { range: 114..115, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -232,7 +232,7 @@ Module( value: Name( ExprName { range: 127..128, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -250,7 +250,7 @@ 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 540459aee88b8..ec8255148eca0 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,14 @@ 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 +36,14 @@ 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 +60,12 @@ 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 +74,7 @@ Module( annotation: Name( ExprName { range: 31..34, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -91,7 +91,7 @@ Module( value: Name( ExprName { range: 35..36, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -109,7 +109,7 @@ 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 9bfc041ffa657..d74795461d8f3 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,21 @@ 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 +55,14 @@ 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 +80,21 @@ 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 +119,14 @@ 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 3a09a0409687d..0a355ffeed733 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,14 @@ 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 0a0aab9974b02..e5e1e9a8eae58 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,7 @@ 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 5d3ae7ebf4ed1..e1886955dd2f4 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,7 @@ 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 d9745c2286926..32b37cdae5227 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,7 @@ Module( range: 0..14, decorator_list: [], name: Identifier { - id: "Foo", + id: Name("Foo"), range: 6..9, }, type_params: None, @@ -38,7 +38,7 @@ 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 f4728ee98772f..7f9dac2758a4a 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,14 @@ 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 2de88d6127742..ee24dd07e7550 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,14 @@ 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 +40,14 @@ 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 +65,14 @@ 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 +89,14 @@ 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 c404f5613ca9a..356e3792857f1 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,7 @@ Module( Alias { range: 7..12, name: Identifier { - id: "a.b.c", + id: Name("a.b.c"), range: 7..12, }, asname: None, @@ -31,7 +31,7 @@ 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 d9ddd2be7c2d1..f94b60ff29646 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,14 @@ 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 +64,14 @@ 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 +96,14 @@ 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 0d4e1b3d358cb..be722844ec285 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,7 @@ Module( func: Name( ExprName { range: 102..106, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -40,7 +40,7 @@ Module( func: Name( ExprName { range: 109..113, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -50,14 +50,14 @@ 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 +77,7 @@ Module( func: Name( ExprName { range: 120..124, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -87,14 +87,14 @@ 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 +114,7 @@ Module( func: Name( ExprName { range: 150..154, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -126,7 +126,7 @@ Module( range: 155..158, arg: Some( Identifier { - id: "x", + id: Name("x"), range: 155..156, }, ), @@ -143,7 +143,7 @@ Module( range: 160..163, arg: Some( Identifier { - id: "y", + id: Name("y"), range: 160..161, }, ), @@ -171,7 +171,7 @@ Module( func: Name( ExprName { range: 165..169, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -184,7 +184,7 @@ Module( value: Name( ExprName { range: 171..172, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -207,7 +207,7 @@ Module( func: Name( ExprName { range: 174..178, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -221,7 +221,7 @@ Module( value: Name( ExprName { range: 181..182, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -241,7 +241,7 @@ Module( func: Name( ExprName { range: 193..197, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -251,7 +251,7 @@ Module( Name( ExprName { range: 198..199, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -261,7 +261,7 @@ Module( range: 201..204, arg: Some( Identifier { - id: "y", + id: Name("y"), range: 201..202, }, ), @@ -289,7 +289,7 @@ Module( func: Name( ExprName { range: 206..210, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -299,7 +299,7 @@ Module( Name( ExprName { range: 211..212, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -309,7 +309,7 @@ Module( value: Name( ExprName { range: 215..216, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -332,7 +332,7 @@ Module( func: Name( ExprName { range: 218..222, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -342,7 +342,7 @@ Module( Name( ExprName { range: 223..224, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -354,7 +354,7 @@ Module( value: Name( ExprName { range: 228..229, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -374,7 +374,7 @@ Module( func: Name( ExprName { range: 231..235, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -387,7 +387,7 @@ Module( value: Name( ExprName { range: 242..243, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -400,7 +400,7 @@ Module( range: 236..239, arg: Some( Identifier { - id: "x", + id: Name("x"), range: 236..237, }, ), @@ -428,7 +428,7 @@ Module( func: Name( ExprName { range: 245..249, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -440,7 +440,7 @@ Module( range: 250..253, arg: Some( Identifier { - id: "x", + id: Name("x"), range: 250..251, }, ), @@ -459,7 +459,7 @@ Module( value: Name( ExprName { range: 257..258, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -479,7 +479,7 @@ Module( func: Name( ExprName { range: 260..264, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -492,7 +492,7 @@ Module( value: Name( ExprName { range: 266..267, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -507,7 +507,7 @@ Module( value: Name( ExprName { range: 271..272, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -527,7 +527,7 @@ Module( func: Name( ExprName { range: 274..278, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -540,7 +540,7 @@ Module( value: Name( ExprName { range: 280..281, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -550,14 +550,14 @@ 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 +577,7 @@ Module( func: Name( ExprName { range: 289..293, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -591,7 +591,7 @@ Module( value: Name( ExprName { range: 296..297, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -600,7 +600,7 @@ Module( range: 299..302, arg: Some( Identifier { - id: "y", + id: Name("y"), range: 299..300, }, ), @@ -617,7 +617,7 @@ Module( range: 304..307, arg: Some( Identifier { - id: "z", + id: Name("z"), range: 304..305, }, ), @@ -645,7 +645,7 @@ Module( func: Name( ExprName { range: 309..313, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -658,7 +658,7 @@ Module( value: Name( ExprName { range: 315..317, - id: "x1", + id: Name("x1"), ctx: Load, }, ), @@ -671,7 +671,7 @@ Module( value: Name( ExprName { range: 320..322, - id: "x2", + id: Name("x2"), ctx: Load, }, ), @@ -686,7 +686,7 @@ Module( value: Name( ExprName { range: 326..328, - id: "y1", + id: Name("y1"), ctx: Load, }, ), @@ -697,7 +697,7 @@ Module( value: Name( ExprName { range: 332..334, - id: "y2", + id: Name("y2"), ctx: Load, }, ), @@ -717,7 +717,7 @@ Module( func: Name( ExprName { range: 336..340, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -729,7 +729,7 @@ Module( range: 341..344, arg: Some( Identifier { - id: "x", + id: Name("x"), range: 341..342, }, ), @@ -748,7 +748,7 @@ Module( value: Name( ExprName { range: 348..349, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -757,7 +757,7 @@ Module( range: 351..354, arg: Some( Identifier { - id: "z", + id: Name("z"), range: 351..352, }, ), @@ -785,7 +785,7 @@ Module( func: Name( ExprName { range: 378..382, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -797,7 +797,7 @@ Module( range: 383..401, arg: Some( Identifier { - id: "x", + id: Name("x"), range: 383..384, }, ), @@ -844,7 +844,7 @@ Module( func: Name( ExprName { range: 403..407, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -856,7 +856,7 @@ Module( range: 408..417, arg: Some( Identifier { - id: "x", + id: Name("x"), range: 408..409, }, ), @@ -866,7 +866,7 @@ Module( value: Name( ExprName { range: 416..417, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -888,7 +888,7 @@ Module( func: Name( ExprName { range: 419..423, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -900,7 +900,7 @@ Module( range: 424..437, arg: Some( Identifier { - id: "x", + id: Name("x"), range: 424..425, }, ), @@ -917,7 +917,7 @@ Module( parameter: Parameter { range: 433..434, name: Identifier { - id: "y", + id: Name("y"), range: 433..434, }, annotation: None, @@ -933,7 +933,7 @@ Module( body: Name( ExprName { range: 436..437, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -955,7 +955,7 @@ Module( func: Name( ExprName { range: 439..443, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -967,7 +967,7 @@ Module( range: 444..454, arg: Some( Identifier { - id: "x", + id: Name("x"), range: 444..445, }, ), @@ -977,7 +977,7 @@ Module( target: Name( ExprName { range: 447..448, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -1007,7 +1007,7 @@ Module( func: Name( ExprName { range: 476..480, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -1021,7 +1021,7 @@ Module( Name( ExprName { range: 488..489, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1044,7 +1044,7 @@ Module( func: Name( ExprName { range: 492..496, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -1057,7 +1057,7 @@ Module( value: Name( ExprName { range: 509..510, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1079,7 +1079,7 @@ Module( func: Name( ExprName { range: 533..537, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -1092,7 +1092,7 @@ Module( target: Name( ExprName { range: 538..539, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -1122,7 +1122,7 @@ Module( func: Name( ExprName { range: 546..550, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -1138,7 +1138,7 @@ Module( target: Name( ExprName { range: 551..552, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -1158,14 +1158,14 @@ 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 +1192,7 @@ Module( func: Name( ExprName { range: 596..600, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -1210,14 +1210,14 @@ 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 +1243,7 @@ Module( func: Name( ExprName { range: 611..615, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -1259,7 +1259,7 @@ Module( left: Name( ExprName { range: 617..618, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1267,7 +1267,7 @@ Module( right: Name( ExprName { range: 621..622, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -1292,7 +1292,7 @@ Module( func: Name( ExprName { range: 624..628, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -1308,7 +1308,7 @@ Module( value: Name( ExprName { range: 636..637, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1333,7 +1333,7 @@ Module( func: Name( ExprName { range: 639..643, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -1356,7 +1356,7 @@ Module( parameter: Parameter { range: 652..653, name: Identifier { - id: "x", + id: Name("x"), range: 652..653, }, annotation: None, @@ -1372,7 +1372,7 @@ Module( body: Name( ExprName { range: 655..656, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1397,7 +1397,7 @@ Module( func: Name( ExprName { range: 658..662, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -1419,14 +1419,14 @@ 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 +1451,7 @@ Module( func: Name( ExprName { range: 700..704, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -1465,7 +1465,7 @@ Module( value: Name( ExprName { range: 707..708, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1485,7 +1485,7 @@ Module( func: Name( ExprName { range: 710..714, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -1504,14 +1504,14 @@ 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 +1534,7 @@ Module( func: Name( ExprName { range: 726..730, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -1551,7 +1551,7 @@ Module( value: Name( ExprName { range: 739..740, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1573,7 +1573,7 @@ Module( func: Name( ExprName { range: 742..746, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -1596,14 +1596,14 @@ 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 +1625,7 @@ Module( func: Name( ExprName { range: 767..771, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -1643,7 +1643,7 @@ Module( Name( ExprName { range: 781..782, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1666,7 +1666,7 @@ Module( func: Name( ExprName { range: 785..789, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -1690,7 +1690,7 @@ Module( parameter: Parameter { range: 799..800, name: Identifier { - id: "x", + id: Name("x"), range: 799..800, }, annotation: None, @@ -1706,7 +1706,7 @@ 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 abf8605d69a7e..18528873b51ec 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,12 @@ 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 +43,12 @@ 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 +75,7 @@ Module( func: Name( ExprName { range: 24..29, - id: "value", + id: Name("value"), ctx: Load, }, ), @@ -87,7 +87,7 @@ Module( }, ), attr: Identifier { - id: "attr", + id: Name("attr"), range: 32..36, }, ctx: Load, @@ -113,7 +113,7 @@ Module( func: Name( ExprName { range: 37..42, - id: "value", + id: Name("value"), ctx: Load, }, ), @@ -125,7 +125,7 @@ Module( }, ), attr: Identifier { - id: "attr", + id: Name("attr"), range: 45..49, }, ctx: Load, @@ -139,7 +139,7 @@ Module( }, ), attr: Identifier { - id: "foo", + id: Name("foo"), range: 52..55, }, ctx: Load, @@ -159,19 +159,19 @@ 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 +194,12 @@ 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 +213,7 @@ 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 e000166f052dd..89a451aebba6e 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,7 @@ Module( value: Name( ExprName { range: 6..7, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -38,7 +38,7 @@ Module( value: Name( ExprName { range: 14..15, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -71,7 +71,7 @@ Module( value: Name( ExprName { range: 26..27, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -80,7 +80,7 @@ Module( Name( ExprName { range: 32..33, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -101,7 +101,7 @@ Module( func: Name( ExprName { range: 40..41, - id: "f", + id: Name("f"), ctx: Load, }, ), @@ -198,7 +198,7 @@ Module( Name( ExprName { range: 77..78, - id: "i", + id: Name("i"), ctx: Load, }, ), @@ -343,7 +343,7 @@ Module( value: Name( ExprName { range: 127..128, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -374,7 +374,7 @@ Module( value: Name( ExprName { range: 155..156, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -409,7 +409,7 @@ Module( parameter: Parameter { range: 173..174, name: Identifier { - id: "x", + id: Name("x"), range: 173..174, }, annotation: None, @@ -425,7 +425,7 @@ Module( body: Name( ExprName { range: 176..177, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -447,7 +447,7 @@ Module( value: Name( ExprName { range: 185..186, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -461,7 +461,7 @@ Module( operand: Name( ExprName { range: 191..192, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -483,7 +483,7 @@ Module( value: Name( ExprName { range: 199..200, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -496,7 +496,7 @@ 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 982687c7f1007..a6cc4528a1bfe 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,7 @@ Module( left: Name( ExprName { range: 390..391, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1030,7 +1030,7 @@ 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 2cf78690b7e87..d1cc881f7fa23 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,14 @@ 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 +47,21 @@ 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 +81,14 @@ 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 +108,21 @@ 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 +147,14 @@ 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 +164,7 @@ Module( Name( ExprName { range: 52..53, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -189,21 +189,21 @@ 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 +213,7 @@ Module( Name( ExprName { range: 71..72, - id: "d", + id: Name("d"), ctx: Load, }, ), @@ -225,14 +225,14 @@ 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 +242,7 @@ Module( Name( ExprName { range: 87..88, - id: "g", + id: Name("g"), ctx: Load, }, ), @@ -267,7 +267,7 @@ Module( Name( ExprName { range: 89..90, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -278,7 +278,7 @@ Module( operand: Name( ExprName { range: 99..100, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -290,7 +290,7 @@ Module( Name( ExprName { range: 104..105, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -319,14 +319,14 @@ 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 +336,7 @@ Module( Name( ExprName { range: 123..124, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -368,7 +368,7 @@ Module( operand: Name( ExprName { range: 129..130, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -377,7 +377,7 @@ Module( Name( ExprName { range: 135..136, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -387,7 +387,7 @@ 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 7234aa72add9d..b65a20feb6971 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,7 @@ Module( func: Name( ExprName { range: 114..118, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -43,12 +43,12 @@ 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 +75,7 @@ Module( value: Name( ExprName { range: 133..142, - id: "subscript", + id: Name("subscript"), ctx: Load, }, ), @@ -128,7 +128,7 @@ Module( value: Name( ExprName { range: 151..156, - id: "slice", + id: Name("slice"), ctx: Load, }, ), @@ -268,7 +268,7 @@ Module( elt: Name( ExprName { range: 188..189, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -278,14 +278,14 @@ 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 +426,7 @@ 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 bd19b33575a9c..abdf83ff7f0c3 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,7 @@ Module( left: Name( ExprName { range: 9..10, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -29,7 +29,7 @@ Module( Name( ExprName { range: 14..15, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -47,7 +47,7 @@ Module( left: Name( ExprName { range: 16..17, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -58,7 +58,7 @@ Module( Name( ExprName { range: 20..21, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -76,7 +76,7 @@ Module( left: Name( ExprName { range: 22..23, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -87,7 +87,7 @@ Module( Name( ExprName { range: 26..27, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -105,7 +105,7 @@ Module( left: Name( ExprName { range: 28..29, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -116,7 +116,7 @@ Module( Name( ExprName { range: 33..34, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -134,7 +134,7 @@ Module( left: Name( ExprName { range: 35..36, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -145,7 +145,7 @@ Module( Name( ExprName { range: 40..41, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -163,7 +163,7 @@ Module( left: Name( ExprName { range: 42..43, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -174,7 +174,7 @@ Module( Name( ExprName { range: 47..48, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -192,7 +192,7 @@ Module( left: Name( ExprName { range: 49..50, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -203,7 +203,7 @@ Module( Name( ExprName { range: 54..55, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -221,7 +221,7 @@ Module( left: Name( ExprName { range: 56..57, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -232,7 +232,7 @@ Module( Name( ExprName { range: 61..62, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -250,7 +250,7 @@ Module( left: Name( ExprName { range: 63..64, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -261,7 +261,7 @@ Module( Name( ExprName { range: 72..73, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -279,7 +279,7 @@ Module( left: Name( ExprName { range: 74..75, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -290,7 +290,7 @@ Module( Name( ExprName { range: 83..84, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -308,7 +308,7 @@ Module( left: Name( ExprName { range: 110..111, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -323,35 +323,35 @@ 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 +372,7 @@ Module( left: Name( ExprName { range: 177..178, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -380,7 +380,7 @@ Module( right: Name( ExprName { range: 181..182, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -397,7 +397,7 @@ Module( left: Name( ExprName { range: 185..186, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -405,7 +405,7 @@ Module( right: Name( ExprName { range: 189..190, - id: "d", + id: Name("d"), ctx: Load, }, ), @@ -417,7 +417,7 @@ Module( left: Name( ExprName { range: 198..199, - id: "e", + id: Name("e"), ctx: Load, }, ), @@ -425,7 +425,7 @@ Module( right: Name( ExprName { range: 202..203, - id: "f", + id: Name("f"), ctx: Load, }, ), @@ -449,7 +449,7 @@ Module( left: Name( ExprName { range: 383..384, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -460,7 +460,7 @@ Module( Name( ExprName { range: 392..393, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -482,7 +482,7 @@ Module( Name( ExprName { range: 395..396, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -497,7 +497,7 @@ Module( left: Name( ExprName { range: 400..401, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -508,7 +508,7 @@ Module( Name( ExprName { range: 409..410, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -518,7 +518,7 @@ Module( Name( ExprName { range: 415..416, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -539,7 +539,7 @@ Module( left: Name( ExprName { range: 417..418, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -553,7 +553,7 @@ Module( value: Name( ExprName { range: 428..429, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -573,7 +573,7 @@ Module( left: Name( ExprName { range: 430..431, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -587,7 +587,7 @@ Module( value: Name( ExprName { range: 445..446, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -607,7 +607,7 @@ Module( left: Name( ExprName { range: 489..490, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -626,63 +626,63 @@ 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 502274b405e34..6a3ec4f15217f 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,7 @@ Module( Name( ExprName { range: 26..27, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -103,7 +103,7 @@ Module( Name( ExprName { range: 32..33, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -306,7 +306,7 @@ Module( parameter: Parameter { range: 163..164, name: Identifier { - id: "x", + id: Name("x"), range: 163..164, }, annotation: None, @@ -322,7 +322,7 @@ Module( body: Name( ExprName { range: 166..167, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -384,7 +384,7 @@ Module( parameter: Parameter { range: 185..186, name: Identifier { - id: "p", + id: Name("p"), range: 185..186, }, annotation: None, @@ -429,7 +429,7 @@ Module( value: Name( ExprName { range: 199..200, - id: "C", + id: Name("C"), ctx: Load, }, ), @@ -454,7 +454,7 @@ Module( target: Name( ExprName { range: 226..227, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -472,7 +472,7 @@ Module( value: Name( ExprName { range: 235..236, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -497,7 +497,7 @@ Module( target: Name( ExprName { range: 240..241, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -518,7 +518,7 @@ Module( target: Name( ExprName { range: 250..251, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -550,7 +550,7 @@ Module( value: Name( ExprName { range: 287..288, - id: "d", + id: Name("d"), ctx: Load, }, ), @@ -572,7 +572,7 @@ Module( Name( ExprName { range: 291..292, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -580,7 +580,7 @@ Module( value: Name( ExprName { range: 294..295, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -590,7 +590,7 @@ Module( value: Name( ExprName { range: 299..300, - id: "d", + id: Name("d"), ctx: Load, }, ), @@ -612,7 +612,7 @@ Module( value: Name( ExprName { range: 305..306, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -622,7 +622,7 @@ Module( value: Name( ExprName { range: 310..311, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -684,7 +684,7 @@ Module( value: Name( ExprName { range: 326..327, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -831,7 +831,7 @@ Module( left: Name( ExprName { range: 369..370, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -853,7 +853,7 @@ Module( left: Name( ExprName { range: 376..377, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -877,7 +877,7 @@ Module( func: Name( ExprName { range: 386..390, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -910,7 +910,7 @@ Module( operand: Name( ExprName { range: 468..469, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -952,14 +952,14 @@ 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 +989,14 @@ 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 +1005,7 @@ Module( value: Name( ExprName { range: 535..536, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -1015,7 +1015,7 @@ Module( target: Name( ExprName { range: 541..542, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -1025,7 +1025,7 @@ Module( func: Name( ExprName { range: 546..551, - id: "range", + id: Name("range"), ctx: Load, }, ), @@ -1053,7 +1053,7 @@ Module( target: Name( ExprName { range: 560..561, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -1063,7 +1063,7 @@ Module( func: Name( ExprName { range: 565..570, - id: "range", + id: Name("range"), ctx: Load, }, ), @@ -1138,7 +1138,7 @@ Module( Name( ExprName { range: 588..589, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1188,7 +1188,7 @@ Module( Name( ExprName { range: 603..604, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1196,7 +1196,7 @@ Module( value: Name( ExprName { range: 608..609, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -1206,7 +1206,7 @@ Module( Name( ExprName { range: 613..614, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -1214,7 +1214,7 @@ 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 13565f213c85a..6cda239001f00 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,7 @@ Module( elt: Name( ExprName { range: 1..2, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -28,7 +28,7 @@ Module( target: Name( ExprName { range: 7..8, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -82,14 +82,14 @@ 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 +99,14 @@ 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 +130,7 @@ Module( left: Name( ExprName { range: 44..45, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -169,7 +169,7 @@ Module( target: Name( ExprName { range: 59..60, - id: "i", + id: Name("i"), ctx: Store, }, ), @@ -179,7 +179,7 @@ Module( func: Name( ExprName { range: 64..69, - id: "range", + id: Name("range"), ctx: Load, }, ), @@ -216,7 +216,7 @@ Module( key: Name( ExprName { range: 75..76, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -226,7 +226,7 @@ Module( left: Name( ExprName { range: 78..79, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -247,14 +247,14 @@ 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 +265,7 @@ Module( left: Name( ExprName { range: 98..99, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -276,7 +276,7 @@ Module( Name( ExprName { range: 103..104, - id: "w", + id: Name("w"), ctx: Load, }, ), @@ -291,14 +291,14 @@ 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 +308,7 @@ Module( Name( ExprName { range: 120..121, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -329,7 +329,7 @@ Module( key: Name( ExprName { range: 124..125, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -339,7 +339,7 @@ Module( left: Name( ExprName { range: 127..128, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -360,14 +360,14 @@ 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 +380,14 @@ 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 +402,14 @@ 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 +420,7 @@ Module( left: Name( ExprName { range: 170..171, - id: "k", + id: Name("k"), ctx: Load, }, ), @@ -431,7 +431,7 @@ Module( Name( ExprName { range: 174..175, - id: "h", + id: Name("h"), ctx: Load, }, ), @@ -455,14 +455,14 @@ 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 +472,14 @@ 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 +492,14 @@ 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 +514,14 @@ 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 +532,7 @@ Module( left: Name( ExprName { range: 225..226, - id: "k", + id: Name("k"), ctx: Load, }, ), @@ -543,7 +543,7 @@ Module( Name( ExprName { range: 229..230, - id: "h", + id: Name("h"), ctx: Load, }, ), @@ -567,14 +567,14 @@ 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 +588,14 @@ 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 +607,7 @@ Module( iter: Name( ExprName { range: 250..251, - id: "d", + id: Name("d"), ctx: Load, }, ), @@ -628,14 +628,14 @@ 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 +645,7 @@ Module( target: Name( ExprName { range: 401..402, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -656,7 +656,7 @@ Module( Name( ExprName { range: 413..414, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -680,14 +680,14 @@ 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 +697,7 @@ Module( target: Name( ExprName { range: 427..428, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -707,7 +707,7 @@ Module( value: Name( ExprName { range: 444..445, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -730,14 +730,14 @@ 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 +747,7 @@ Module( target: Name( ExprName { range: 458..459, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -764,7 +764,7 @@ Module( parameter: Parameter { range: 471..472, name: Identifier { - id: "y", + id: Name("y"), range: 471..472, }, annotation: None, @@ -780,7 +780,7 @@ Module( body: Name( ExprName { range: 474..475, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -803,14 +803,14 @@ 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 +820,14 @@ 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 +839,7 @@ Module( Name( ExprName { range: 508..509, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -863,14 +863,14 @@ 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 +880,14 @@ 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 +898,7 @@ Module( value: Name( ExprName { range: 547..548, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -921,14 +921,14 @@ 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 +938,14 @@ 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 +963,7 @@ Module( parameter: Parameter { range: 582..583, name: Identifier { - id: "y", + id: Name("y"), range: 582..583, }, annotation: None, @@ -979,7 +979,7 @@ 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 cc523d29a6d89..011f027e163ca 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,7 @@ Module( expression: Name( ExprName { range: 60..63, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -521,7 +521,7 @@ Module( expression: Name( ExprName { range: 124..127, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -567,7 +567,7 @@ Module( expression: Name( ExprName { range: 139..142, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -625,7 +625,7 @@ Module( expression: Name( ExprName { range: 160..163, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -862,7 +862,7 @@ Module( left: Name( ExprName { range: 234..235, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -870,7 +870,7 @@ Module( right: Name( ExprName { range: 238..239, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -932,7 +932,7 @@ Module( subject: Name( ExprName { range: 260..263, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -1046,7 +1046,7 @@ Module( expression: Name( ExprName { range: 351..354, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -1067,7 +1067,7 @@ Module( expression: Name( ExprName { range: 357..360, - id: "bar", + id: Name("bar"), ctx: Load, }, ), @@ -1152,7 +1152,7 @@ Module( expression: Name( ExprName { range: 390..393, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -1205,7 +1205,7 @@ Module( expression: Name( ExprName { range: 428..431, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -1257,7 +1257,7 @@ Module( expression: Name( ExprName { range: 451..454, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -1278,7 +1278,7 @@ Module( expression: Name( ExprName { range: 469..472, - id: "bar", + id: Name("bar"), ctx: Load, }, ), @@ -1299,7 +1299,7 @@ Module( expression: Name( ExprName { range: 477..482, - id: "three", + id: Name("three"), ctx: Load, }, ), @@ -1352,7 +1352,7 @@ Module( expression: Name( ExprName { range: 497..500, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -1373,7 +1373,7 @@ Module( expression: Name( ExprName { range: 505..508, - id: "bar", + id: Name("bar"), ctx: Load, }, ), @@ -1394,7 +1394,7 @@ Module( expression: Name( ExprName { range: 513..516, - id: "baz", + id: Name("baz"), ctx: Load, }, ), @@ -1415,7 +1415,7 @@ Module( expression: Name( ExprName { range: 521..527, - id: "foobar", + id: Name("foobar"), ctx: Load, }, ), @@ -1462,7 +1462,7 @@ Module( expression: Name( ExprName { range: 540..541, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1515,7 +1515,7 @@ Module( expression: Name( ExprName { range: 553..554, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1550,7 +1550,7 @@ Module( }, ), attr: Identifier { - id: "pop", + id: Name("pop"), range: 560..563, }, ctx: Load, @@ -1615,7 +1615,7 @@ Module( parameter: Parameter { range: 580..581, name: Identifier { - id: "x", + id: Name("x"), range: 580..581, }, annotation: None, @@ -1635,7 +1635,7 @@ Module( Name( ExprName { range: 583..584, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1681,7 +1681,7 @@ Module( expression: Name( ExprName { range: 592..593, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1727,7 +1727,7 @@ Module( expression: Name( ExprName { range: 605..606, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1773,7 +1773,7 @@ Module( expression: Name( ExprName { range: 615..616, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1819,7 +1819,7 @@ Module( expression: Name( ExprName { range: 625..626, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1872,7 +1872,7 @@ Module( expression: Name( ExprName { range: 640..641, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1930,7 +1930,7 @@ Module( expression: Name( ExprName { range: 657..658, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1995,7 +1995,7 @@ Module( expression: Name( ExprName { range: 679..680, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -2038,7 +2038,7 @@ Module( expression: Name( ExprName { range: 686..687, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -2065,7 +2065,7 @@ Module( expression: Name( ExprName { range: 693..694, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -2108,7 +2108,7 @@ Module( expression: Name( ExprName { range: 700..701, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -2171,7 +2171,7 @@ Module( Name( ExprName { range: 740..747, - id: "command", + id: Name("command"), ctx: Load, }, ), @@ -2181,7 +2181,7 @@ Module( value: Name( ExprName { range: 750..754, - id: "args", + id: Name("args"), ctx: Load, }, ), @@ -2242,7 +2242,7 @@ Module( expression: Name( ExprName { range: 766..767, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -2410,7 +2410,7 @@ Module( expression: Name( ExprName { range: 860..863, - id: "bar", + id: Name("bar"), ctx: Load, }, ), @@ -2486,7 +2486,7 @@ Module( expression: Name( ExprName { range: 889..892, - id: "bar", + id: Name("bar"), ctx: Load, }, ), @@ -2562,7 +2562,7 @@ Module( expression: Name( ExprName { range: 919..922, - id: "bar", + id: Name("bar"), ctx: Load, }, ), @@ -2644,7 +2644,7 @@ 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 784a0126258ac..b40fccc33aca3 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,7 @@ Module( elt: Name( ExprName { range: 1..2, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -28,14 +28,14 @@ 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 +57,7 @@ Module( elt: Name( ExprName { range: 24..25, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -67,14 +67,14 @@ 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 +96,7 @@ Module( elt: Name( ExprName { range: 53..54, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -106,14 +106,14 @@ 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 +124,7 @@ Module( left: Name( ExprName { range: 77..78, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -135,7 +135,7 @@ Module( Name( ExprName { range: 82..83, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -150,14 +150,14 @@ 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 +167,7 @@ Module( Name( ExprName { range: 98..99, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -189,7 +189,7 @@ Module( elt: Name( ExprName { range: 102..103, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -199,14 +199,14 @@ 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 +219,14 @@ 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 +241,14 @@ 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 +259,7 @@ Module( left: Name( ExprName { range: 160..161, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -270,7 +270,7 @@ Module( Name( ExprName { range: 164..165, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -295,7 +295,7 @@ Module( elt: Name( ExprName { range: 168..169, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -305,14 +305,14 @@ 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 +325,14 @@ 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 +347,14 @@ 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 +365,7 @@ Module( left: Name( ExprName { range: 232..233, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -376,7 +376,7 @@ Module( Name( ExprName { range: 236..237, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -404,7 +404,7 @@ Module( target: Name( ExprName { range: 260..261, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -414,7 +414,7 @@ Module( left: Name( ExprName { range: 265..266, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -437,14 +437,14 @@ 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 +469,21 @@ 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 +495,14 @@ 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 +543,7 @@ Module( }, ), attr: Identifier { - id: "join", + id: Name("join"), range: 344..348, }, ctx: Load, @@ -558,7 +558,7 @@ Module( elt: Name( ExprName { range: 354..357, - id: "sql", + id: Name("sql"), ctx: Load, }, ), @@ -568,7 +568,7 @@ Module( target: Name( ExprName { range: 366..369, - id: "sql", + id: Name("sql"), ctx: Store, }, ), @@ -582,7 +582,7 @@ Module( test: Name( ExprName { range: 405..410, - id: "limit", + id: Name("limit"), ctx: Load, }, ), @@ -611,7 +611,7 @@ Module( right: Name( ExprName { range: 396..401, - id: "limit", + id: Name("limit"), ctx: Load, }, ), @@ -630,7 +630,7 @@ Module( test: Name( ExprName { range: 456..462, - id: "offset", + id: Name("offset"), ctx: Load, }, ), @@ -659,7 +659,7 @@ 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 cb7c075732d0d..6bbdd72b0ab5e 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,14 @@ 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 +48,7 @@ Module( test: Name( ExprName { range: 24..25, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -58,7 +58,7 @@ Module( func: Name( ExprName { range: 17..18, - id: "f", + id: Name("f"), ctx: Load, }, ), @@ -87,14 +87,14 @@ 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 +104,21 @@ 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 +175,7 @@ Module( right: Name( ExprName { range: 66..67, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -208,7 +208,7 @@ Module( test: Name( ExprName { range: 96..97, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -220,14 +220,14 @@ 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 +253,7 @@ Module( test: Name( ExprName { range: 119..120, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -263,7 +263,7 @@ Module( left: Name( ExprName { range: 109..110, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -274,7 +274,7 @@ Module( Name( ExprName { range: 114..115, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -284,7 +284,7 @@ Module( orelse: Name( ExprName { range: 126..127, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -306,14 +306,14 @@ 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 +357,7 @@ Module( test: Name( ExprName { range: 163..164, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -372,7 +372,7 @@ Module( orelse: Name( ExprName { range: 170..171, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -400,7 +400,7 @@ Module( body: Name( ExprName { range: 214..215, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -417,7 +417,7 @@ Module( parameter: Parameter { range: 236..237, name: Identifier { - id: "y", + id: Name("y"), range: 236..237, }, annotation: None, @@ -433,7 +433,7 @@ Module( body: Name( ExprName { range: 239..240, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -456,7 +456,7 @@ Module( Name( ExprName { range: 314..315, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -466,14 +466,14 @@ 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 +493,7 @@ Module( value: Name( ExprName { range: 341..342, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -502,14 +502,14 @@ 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 +536,7 @@ Module( parameter: Parameter { range: 364..365, name: Identifier { - id: "x", + id: Name("x"), range: 364..365, }, annotation: None, @@ -552,7 +552,7 @@ Module( body: Name( ExprName { range: 367..368, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -561,14 +561,14 @@ 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 +585,21 @@ 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 b0c41a886a7ff..75ce5de1a7aeb 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,7 @@ Module( body: Name( ExprName { range: 8..9, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -62,7 +62,7 @@ Module( parameter: Parameter { range: 27..28, name: Identifier { - id: "x", + id: Name("x"), range: 27..28, }, annotation: None, @@ -103,7 +103,7 @@ Module( parameter: Parameter { range: 39..40, name: Identifier { - id: "x", + id: Name("x"), range: 39..40, }, annotation: None, @@ -115,7 +115,7 @@ Module( parameter: Parameter { range: 42..43, name: Identifier { - id: "y", + id: Name("y"), range: 42..43, }, annotation: None, @@ -153,7 +153,7 @@ Module( parameter: Parameter { range: 56..57, name: Identifier { - id: "a", + id: Name("a"), range: 56..57, }, annotation: None, @@ -165,7 +165,7 @@ Module( parameter: Parameter { range: 59..60, name: Identifier { - id: "b", + id: Name("b"), range: 59..60, }, annotation: None, @@ -177,7 +177,7 @@ Module( parameter: Parameter { range: 62..63, name: Identifier { - id: "c", + id: Name("c"), range: 62..63, }, annotation: None, @@ -218,7 +218,7 @@ Module( parameter: Parameter { range: 74..75, name: Identifier { - id: "a", + id: Name("a"), range: 74..75, }, annotation: None, @@ -230,7 +230,7 @@ Module( parameter: Parameter { range: 77..78, name: Identifier { - id: "b", + id: Name("b"), range: 77..78, }, annotation: None, @@ -251,7 +251,7 @@ Module( parameter: Parameter { range: 83..84, name: Identifier { - id: "c", + id: Name("c"), range: 83..84, }, annotation: None, @@ -301,7 +301,7 @@ Module( parameter: Parameter { range: 98..99, name: Identifier { - id: "x", + id: Name("x"), range: 98..99, }, annotation: None, @@ -313,7 +313,7 @@ Module( parameter: Parameter { range: 101..102, name: Identifier { - id: "y", + id: Name("y"), range: 101..102, }, annotation: None, @@ -332,7 +332,7 @@ Module( left: Name( ExprName { range: 104..105, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -340,7 +340,7 @@ Module( right: Name( ExprName { range: 108..109, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -366,7 +366,7 @@ Module( parameter: Parameter { range: 117..118, name: Identifier { - id: "y", + id: Name("y"), range: 117..118, }, annotation: None, @@ -378,7 +378,7 @@ Module( parameter: Parameter { range: 120..121, name: Identifier { - id: "z", + id: Name("z"), range: 120..121, }, annotation: None, @@ -406,7 +406,7 @@ Module( left: Name( ExprName { range: 125..126, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -414,7 +414,7 @@ Module( right: Name( ExprName { range: 129..130, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -439,7 +439,7 @@ Module( Parameter { range: 138..140, name: Identifier { - id: "a", + id: Name("a"), range: 139..140, }, annotation: None, @@ -452,7 +452,7 @@ Module( body: Name( ExprName { range: 142..143, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -475,7 +475,7 @@ Module( Parameter { range: 151..153, name: Identifier { - id: "a", + id: Name("a"), range: 152..153, }, annotation: None, @@ -487,7 +487,7 @@ Module( parameter: Parameter { range: 155..156, name: Identifier { - id: "z", + id: Name("z"), range: 155..156, }, annotation: None, @@ -499,7 +499,7 @@ Module( parameter: Parameter { range: 158..159, name: Identifier { - id: "x", + id: Name("x"), range: 158..159, }, annotation: None, @@ -546,7 +546,7 @@ Module( parameter: Parameter { range: 177..178, name: Identifier { - id: "a", + id: Name("a"), range: 177..178, }, annotation: None, @@ -558,7 +558,7 @@ Module( parameter: Parameter { range: 180..181, name: Identifier { - id: "b", + id: Name("b"), range: 180..181, }, annotation: None, @@ -570,7 +570,7 @@ Module( parameter: Parameter { range: 183..184, name: Identifier { - id: "c", + id: Name("c"), range: 183..184, }, annotation: None, @@ -611,7 +611,7 @@ Module( parameter: Parameter { range: 198..199, name: Identifier { - id: "a", + id: Name("a"), range: 198..199, }, annotation: None, @@ -623,7 +623,7 @@ Module( parameter: Parameter { range: 201..202, name: Identifier { - id: "b", + id: Name("b"), range: 201..202, }, annotation: None, @@ -644,7 +644,7 @@ Module( parameter: Parameter { range: 207..208, name: Identifier { - id: "c", + id: Name("c"), range: 207..208, }, annotation: None, @@ -692,7 +692,7 @@ Module( parameter: Parameter { range: 222..223, name: Identifier { - id: "a", + id: Name("a"), range: 222..223, }, annotation: None, @@ -704,7 +704,7 @@ Module( parameter: Parameter { range: 225..226, name: Identifier { - id: "b", + id: Name("b"), range: 225..226, }, annotation: None, @@ -716,7 +716,7 @@ Module( parameter: Parameter { range: 228..229, name: Identifier { - id: "c", + id: Name("c"), range: 228..229, }, annotation: None, @@ -731,7 +731,7 @@ Module( parameter: Parameter { range: 234..235, name: Identifier { - id: "d", + id: Name("d"), range: 234..235, }, annotation: None, @@ -743,7 +743,7 @@ Module( parameter: Parameter { range: 237..238, name: Identifier { - id: "e", + id: Name("e"), range: 237..238, }, annotation: None, @@ -783,7 +783,7 @@ Module( Parameter { range: 249..257, name: Identifier { - id: "kwargs", + id: Name("kwargs"), range: 251..257, }, annotation: None, @@ -797,7 +797,7 @@ Module( func: Name( ExprName { range: 259..260, - id: "f", + id: Name("f"), ctx: Load, }, ), @@ -827,7 +827,7 @@ Module( Parameter { range: 270..275, name: Identifier { - id: "args", + id: Name("args"), range: 271..275, }, annotation: None, @@ -838,7 +838,7 @@ Module( Parameter { range: 277..285, name: Identifier { - id: "kwargs", + id: Name("kwargs"), range: 279..285, }, annotation: None, @@ -855,7 +855,7 @@ Module( func: Name( ExprName { range: 287..288, - id: "f", + id: Name("f"), ctx: Load, }, ), @@ -896,7 +896,7 @@ Module( Parameter { range: 302..307, name: Identifier { - id: "args", + id: Name("args"), range: 303..307, }, annotation: None, @@ -908,7 +908,7 @@ Module( parameter: Parameter { range: 309..310, name: Identifier { - id: "a", + id: Name("a"), range: 309..310, }, annotation: None, @@ -920,7 +920,7 @@ Module( parameter: Parameter { range: 312..313, name: Identifier { - id: "b", + id: Name("b"), range: 312..313, }, annotation: None, @@ -941,7 +941,7 @@ Module( Parameter { range: 317..325, name: Identifier { - id: "kwargs", + id: Name("kwargs"), range: 319..325, }, annotation: None, @@ -958,7 +958,7 @@ Module( func: Name( ExprName { range: 327..328, - id: "f", + id: Name("f"), ctx: Load, }, ), @@ -999,7 +999,7 @@ Module( parameter: Parameter { range: 342..343, name: Identifier { - id: "a", + id: Name("a"), range: 342..343, }, annotation: None, @@ -1037,7 +1037,7 @@ Module( parameter: Parameter { range: 359..360, name: Identifier { - id: "a", + id: Name("a"), range: 359..360, }, annotation: None, @@ -1051,7 +1051,7 @@ Module( parameter: Parameter { range: 365..366, name: Identifier { - id: "b", + id: Name("b"), range: 365..366, }, annotation: None, @@ -1088,7 +1088,7 @@ Module( parameter: Parameter { range: 379..380, name: Identifier { - id: "a", + id: Name("a"), range: 379..380, }, annotation: None, @@ -1135,7 +1135,7 @@ Module( parameter: Parameter { range: 399..400, name: Identifier { - id: "a", + id: Name("a"), range: 399..400, }, annotation: None, @@ -1147,7 +1147,7 @@ Module( parameter: Parameter { range: 402..403, name: Identifier { - id: "b", + id: Name("b"), range: 402..403, }, annotation: None, @@ -1163,7 +1163,7 @@ Module( parameter: Parameter { range: 411..412, name: Identifier { - id: "c", + id: Name("c"), range: 411..412, }, annotation: None, @@ -1199,7 +1199,7 @@ Module( parameter: Parameter { range: 425..427, name: Identifier { - id: "kw", + id: Name("kw"), range: 425..427, }, annotation: None, @@ -1223,7 +1223,7 @@ Module( parameter: Parameter { range: 434..435, name: Identifier { - id: "a", + id: Name("a"), range: 434..435, }, annotation: None, @@ -1258,7 +1258,7 @@ Module( parameter: Parameter { range: 448..449, name: Identifier { - id: "a", + id: Name("a"), range: 448..449, }, annotation: None, @@ -1270,7 +1270,7 @@ Module( parameter: Parameter { range: 451..452, name: Identifier { - id: "b", + id: Name("b"), range: 451..452, }, annotation: None, @@ -1293,7 +1293,7 @@ Module( parameter: Parameter { range: 460..461, name: Identifier { - id: "c", + id: Name("c"), range: 460..461, }, annotation: None, @@ -1342,7 +1342,7 @@ Module( parameter: Parameter { range: 475..476, name: Identifier { - id: "a", + id: Name("a"), range: 475..476, }, annotation: None, @@ -1354,7 +1354,7 @@ Module( parameter: Parameter { range: 478..479, name: Identifier { - id: "b", + id: Name("b"), range: 478..479, }, annotation: None, @@ -1368,7 +1368,7 @@ Module( parameter: Parameter { range: 484..485, name: Identifier { - id: "c", + id: Name("c"), range: 484..485, }, annotation: None, @@ -1383,7 +1383,7 @@ Module( parameter: Parameter { range: 490..491, name: Identifier { - id: "d", + id: Name("d"), range: 490..491, }, annotation: None, @@ -1395,7 +1395,7 @@ Module( parameter: Parameter { range: 493..494, name: Identifier { - id: "e", + id: Name("e"), range: 493..494, }, annotation: None, @@ -1433,7 +1433,7 @@ Module( parameter: Parameter { range: 505..506, name: Identifier { - id: "a", + id: Name("a"), range: 505..506, }, annotation: None, @@ -1445,7 +1445,7 @@ Module( parameter: Parameter { range: 508..509, name: Identifier { - id: "b", + id: Name("b"), range: 508..509, }, annotation: None, @@ -1459,7 +1459,7 @@ Module( parameter: Parameter { range: 514..515, name: Identifier { - id: "c", + id: Name("c"), range: 514..515, }, annotation: None, @@ -1471,7 +1471,7 @@ Module( Parameter { range: 517..519, name: Identifier { - id: "d", + id: Name("d"), range: 518..519, }, annotation: None, @@ -1483,7 +1483,7 @@ Module( parameter: Parameter { range: 521..522, name: Identifier { - id: "e", + id: Name("e"), range: 521..522, }, annotation: None, @@ -1495,7 +1495,7 @@ 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 ede492d09f77a..82745bd5d6b76 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,7 @@ Module( target: Name( ExprName { range: 171..172, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -343,7 +343,7 @@ Module( target: Name( ExprName { range: 180..181, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -384,7 +384,7 @@ Module( target: Name( ExprName { range: 193..194, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -433,7 +433,7 @@ Module( value: Name( ExprName { range: 228..229, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -478,7 +478,7 @@ Module( left: Name( ExprName { range: 239..240, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -486,7 +486,7 @@ Module( right: Name( ExprName { range: 243..244, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -585,7 +585,7 @@ Module( Name( ExprName { range: 294..295, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -595,7 +595,7 @@ Module( left: Name( ExprName { range: 297..298, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -603,7 +603,7 @@ Module( right: Name( ExprName { range: 301..302, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -612,7 +612,7 @@ Module( Name( ExprName { range: 304..305, - id: "d", + id: Name("d"), ctx: Load, }, ), @@ -628,21 +628,21 @@ 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 +658,7 @@ Module( Name( ExprName { range: 320..321, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -681,7 +681,7 @@ Module( target: Name( ExprName { range: 327..328, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -714,7 +714,7 @@ Module( func: Name( ExprName { range: 336..341, - id: "call1", + id: Name("call1"), ctx: Load, }, ), @@ -730,7 +730,7 @@ Module( func: Name( ExprName { range: 342..347, - id: "call2", + id: Name("call2"), ctx: Load, }, ), @@ -746,12 +746,12 @@ 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 +775,14 @@ 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 079ddce8eeb07..8d4bd9f912742 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,7 @@ Module( Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -27,7 +27,7 @@ Module( elt: Name( ExprName { range: 5..6, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -37,7 +37,7 @@ Module( target: Name( ExprName { range: 11..12, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -91,7 +91,7 @@ Module( elt: Name( ExprName { range: 29..30, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -101,7 +101,7 @@ Module( target: Name( ExprName { range: 35..36, - id: "i", + id: Name("i"), ctx: Store, }, ), @@ -111,7 +111,7 @@ Module( func: Name( ExprName { range: 40..45, - id: "range", + id: Name("range"), ctx: Load, }, ), @@ -148,7 +148,7 @@ Module( elt: Name( ExprName { range: 51..52, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -158,14 +158,14 @@ 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 +176,7 @@ Module( left: Name( ExprName { range: 67..68, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -187,7 +187,7 @@ Module( Name( ExprName { range: 72..73, - id: "w", + id: Name("w"), ctx: Load, }, ), @@ -202,14 +202,14 @@ 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 +219,7 @@ Module( Name( ExprName { range: 89..90, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -240,7 +240,7 @@ Module( elt: Name( ExprName { range: 93..94, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -250,14 +250,14 @@ 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 +270,14 @@ 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 +292,14 @@ 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 +310,7 @@ Module( left: Name( ExprName { range: 131..132, - id: "k", + id: Name("k"), ctx: Load, }, ), @@ -321,7 +321,7 @@ Module( Name( ExprName { range: 135..136, - id: "h", + id: Name("h"), ctx: Load, }, ), @@ -345,7 +345,7 @@ Module( elt: Name( ExprName { range: 139..140, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -355,14 +355,14 @@ 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 +375,14 @@ 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 +397,14 @@ 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 +415,7 @@ Module( left: Name( ExprName { range: 183..184, - id: "k", + id: Name("k"), ctx: Load, }, ), @@ -426,7 +426,7 @@ Module( Name( ExprName { range: 187..188, - id: "h", + id: Name("h"), ctx: Load, }, ), @@ -461,7 +461,7 @@ Module( target: Name( ExprName { range: 197..198, - id: "i", + id: Name("i"), ctx: Store, }, ), @@ -471,7 +471,7 @@ Module( left: Name( ExprName { range: 202..203, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -482,7 +482,7 @@ Module( Name( ExprName { range: 207..208, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -506,7 +506,7 @@ Module( elt: Name( ExprName { range: 211..212, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -520,14 +520,14 @@ 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 +539,7 @@ Module( iter: Name( ExprName { range: 225..226, - id: "G", + id: Name("G"), ctx: Load, }, ), @@ -563,7 +563,7 @@ Module( value: Name( ExprName { range: 240..241, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -579,14 +579,14 @@ 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 +598,7 @@ Module( iter: Name( ExprName { range: 254..255, - id: "C", + id: Name("C"), ctx: Load, }, ), @@ -619,7 +619,7 @@ Module( elt: Name( ExprName { range: 259..260, - id: "i", + id: Name("i"), ctx: Load, }, ), @@ -629,7 +629,7 @@ Module( target: Name( ExprName { range: 265..266, - id: "i", + id: Name("i"), ctx: Store, }, ), @@ -639,7 +639,7 @@ Module( value: Name( ExprName { range: 276..277, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -652,7 +652,7 @@ Module( left: Name( ExprName { range: 281..287, - id: "entity", + id: Name("entity"), ctx: Load, }, ), @@ -685,7 +685,7 @@ Module( elt: Name( ExprName { range: 302..303, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -695,7 +695,7 @@ Module( target: Name( ExprName { range: 308..309, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -711,14 +711,14 @@ 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 +728,7 @@ Module( Name( ExprName { range: 335..336, - id: "T", + id: Name("T"), ctx: Load, }, ), @@ -749,7 +749,7 @@ Module( elt: Name( ExprName { range: 339..340, - id: "i", + id: Name("i"), ctx: Load, }, ), @@ -759,7 +759,7 @@ Module( target: Name( ExprName { range: 345..346, - id: "i", + id: Name("i"), ctx: Store, }, ), @@ -778,7 +778,7 @@ Module( value: Name( ExprName { range: 357..358, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -787,7 +787,7 @@ Module( orelse: Name( ExprName { range: 372..373, - id: "X", + id: Name("X"), ctx: Load, }, ), @@ -797,7 +797,7 @@ Module( Name( ExprName { range: 378..379, - id: "F", + id: Name("F"), ctx: Load, }, ), @@ -818,7 +818,7 @@ Module( elt: Name( ExprName { range: 382..383, - id: "i", + id: Name("i"), ctx: Load, }, ), @@ -828,7 +828,7 @@ Module( target: Name( ExprName { range: 388..389, - id: "i", + id: Name("i"), ctx: Store, }, ), @@ -847,14 +847,14 @@ 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 +866,7 @@ Module( Name( ExprName { range: 421..422, - id: "F", + id: Name("F"), ctx: Load, }, ), @@ -887,7 +887,7 @@ Module( elt: Name( ExprName { range: 425..426, - id: "f", + id: Name("f"), ctx: Load, }, ), @@ -897,7 +897,7 @@ Module( target: Name( ExprName { range: 431..432, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -907,7 +907,7 @@ Module( func: Name( ExprName { range: 436..437, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -926,7 +926,7 @@ Module( body: Name( ExprName { range: 438..439, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -961,7 +961,7 @@ Module( elt: Name( ExprName { range: 597..598, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -971,7 +971,7 @@ Module( target: Name( ExprName { range: 603..604, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -982,7 +982,7 @@ Module( Name( ExprName { range: 615..616, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -1006,7 +1006,7 @@ Module( elt: Name( ExprName { range: 620..621, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1016,7 +1016,7 @@ Module( target: Name( ExprName { range: 626..627, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -1026,7 +1026,7 @@ Module( value: Name( ExprName { range: 643..644, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -1049,7 +1049,7 @@ Module( elt: Name( ExprName { range: 648..649, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1059,7 +1059,7 @@ Module( target: Name( ExprName { range: 654..655, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -1076,7 +1076,7 @@ Module( parameter: Parameter { range: 667..668, name: Identifier { - id: "y", + id: Name("y"), range: 667..668, }, annotation: None, @@ -1092,7 +1092,7 @@ Module( body: Name( ExprName { range: 670..671, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -1115,7 +1115,7 @@ Module( elt: Name( ExprName { range: 675..676, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1125,14 +1125,14 @@ 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 +1144,7 @@ Module( Name( ExprName { range: 701..702, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -1168,7 +1168,7 @@ Module( elt: Name( ExprName { range: 706..707, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1178,14 +1178,14 @@ 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 +1196,7 @@ Module( value: Name( ExprName { range: 737..738, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -1219,7 +1219,7 @@ Module( elt: Name( ExprName { range: 742..743, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1229,14 +1229,14 @@ 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 +1254,7 @@ Module( parameter: Parameter { range: 769..770, name: Identifier { - id: "y", + id: Name("y"), range: 769..770, }, annotation: None, @@ -1270,7 +1270,7 @@ 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 243594adfa0d6..cb22e7e03cfe2 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,7 @@ Module( value: Name( ExprName { range: 0..1, - id: "_", + id: Name("_"), ctx: Load, }, ), @@ -27,7 +27,7 @@ Module( value: Name( ExprName { range: 3..4, - id: "_", + id: Name("_"), ctx: Load, }, ), @@ -39,7 +39,7 @@ Module( value: Name( ExprName { range: 6..8, - id: "__", + id: Name("__"), ctx: Load, }, ), @@ -51,7 +51,7 @@ Module( value: Name( ExprName { range: 9..17, - id: "__init__", + id: Name("__init__"), ctx: Load, }, ), @@ -63,7 +63,7 @@ Module( value: Name( ExprName { range: 18..22, - id: "name", + id: Name("name"), ctx: Load, }, ), @@ -75,7 +75,7 @@ Module( value: Name( ExprName { range: 24..28, - id: "name", + id: Name("name"), ctx: Load, }, ), @@ -87,7 +87,7 @@ Module( value: Name( ExprName { range: 60..65, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -99,7 +99,7 @@ Module( value: Name( ExprName { range: 66..70, - id: "case", + id: Name("case"), ctx: Load, }, ), @@ -111,7 +111,7 @@ 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 de7a542cf0316..1a8216e067977 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,7 @@ Module( target: Name( ExprName { range: 1..5, - id: "name", + id: Name("name"), ctx: Store, }, ), @@ -43,7 +43,7 @@ Module( target: Name( ExprName { range: 13..17, - id: "name", + id: Name("name"), ctx: Store, }, ), @@ -53,7 +53,7 @@ Module( left: Name( ExprName { range: 22..23, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -61,7 +61,7 @@ Module( right: Name( ExprName { range: 26..27, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -80,7 +80,7 @@ Module( target: Name( ExprName { range: 31..35, - id: "name", + id: Name("name"), ctx: Store, }, ), @@ -119,7 +119,7 @@ Module( target: Name( ExprName { range: 47..51, - id: "name", + id: Name("name"), ctx: Store, }, ), @@ -133,7 +133,7 @@ Module( value: Name( ExprName { range: 57..58, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -143,7 +143,7 @@ Module( Name( ExprName { range: 60..61, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -165,7 +165,7 @@ Module( target: Name( ExprName { range: 65..69, - id: "name", + id: Name("name"), ctx: Store, }, ), @@ -181,14 +181,14 @@ 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 +207,7 @@ Module( target: Name( ExprName { range: 92..96, - id: "name", + id: Name("name"), ctx: Store, }, ), @@ -224,7 +224,7 @@ Module( parameter: Parameter { range: 107..108, name: Identifier { - id: "x", + id: Name("x"), range: 107..108, }, annotation: None, @@ -240,7 +240,7 @@ Module( body: Name( ExprName { range: 110..111, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -259,7 +259,7 @@ Module( target: Name( ExprName { range: 114..118, - id: "name", + id: Name("name"), ctx: Store, }, ), @@ -270,7 +270,7 @@ Module( Name( ExprName { range: 129..130, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -290,7 +290,7 @@ Module( target: Name( ExprName { range: 134..138, - id: "name", + id: Name("name"), ctx: Store, }, ), @@ -300,7 +300,7 @@ 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 52cb6df41a5a1..e5527f4a6d035 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,7 @@ Module( Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -38,7 +38,7 @@ Module( Name( ExprName { range: 14..15, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -60,7 +60,7 @@ Module( Name( ExprName { range: 25..26, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -82,7 +82,7 @@ Module( Name( ExprName { range: 32..33, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -104,7 +104,7 @@ Module( Name( ExprName { range: 39..40, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -126,7 +126,7 @@ Module( Name( ExprName { range: 48..49, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -148,7 +148,7 @@ Module( Name( ExprName { range: 57..58, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -170,7 +170,7 @@ Module( Name( ExprName { range: 74..75, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -192,7 +192,7 @@ Module( Name( ExprName { range: 98..99, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -214,7 +214,7 @@ Module( Name( ExprName { range: 132..133, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -236,7 +236,7 @@ Module( Name( ExprName { range: 156..157, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -259,7 +259,7 @@ Module( Name( ExprName { range: 171..172, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -282,7 +282,7 @@ Module( Name( ExprName { range: 196..197, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -304,7 +304,7 @@ Module( Name( ExprName { range: 208..209, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -326,7 +326,7 @@ Module( Name( ExprName { range: 219..220, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -348,7 +348,7 @@ Module( Name( ExprName { range: 229..230, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -370,7 +370,7 @@ Module( Name( ExprName { range: 245..246, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -392,7 +392,7 @@ Module( Name( ExprName { range: 255..256, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -414,7 +414,7 @@ Module( Name( ExprName { range: 286..287, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -431,7 +431,7 @@ Module( }, ), attr: Identifier { - id: "imag", + id: Name("imag"), range: 294..298, }, ctx: Load, @@ -446,7 +446,7 @@ Module( Name( ExprName { range: 299..300, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -463,7 +463,7 @@ Module( }, ), attr: Identifier { - id: "imag", + id: Name("imag"), range: 308..312, }, ctx: Load, @@ -478,7 +478,7 @@ Module( Name( ExprName { range: 313..314, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -495,7 +495,7 @@ Module( }, ), attr: Identifier { - id: "real", + id: Name("real"), range: 322..326, }, ctx: Load, @@ -510,7 +510,7 @@ Module( Name( ExprName { range: 327..328, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -530,7 +530,7 @@ Module( }, ), attr: Identifier { - id: "hex", + id: Name("hex"), range: 351..354, }, ctx: Load, @@ -552,7 +552,7 @@ Module( Name( ExprName { range: 357..358, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -569,7 +569,7 @@ Module( }, ), attr: Identifier { - id: "real", + id: Name("real"), range: 392..396, }, ctx: Load, @@ -584,7 +584,7 @@ Module( Name( ExprName { range: 397..398, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -604,7 +604,7 @@ Module( }, ), attr: Identifier { - id: "conjugate", + id: Name("conjugate"), range: 422..431, }, ctx: Load, @@ -626,7 +626,7 @@ Module( Name( ExprName { range: 434..435, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -644,7 +644,7 @@ Module( }, ), attr: Identifier { - id: "real", + id: Name("real"), range: 449..453, }, ctx: Load, @@ -659,7 +659,7 @@ Module( Name( ExprName { range: 454..455, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -680,7 +680,7 @@ Module( }, ), attr: Identifier { - id: "__add__", + id: Name("__add__"), range: 479..486, }, ctx: Load, @@ -704,7 +704,7 @@ Module( }, ), attr: Identifier { - id: "bit_length", + id: Name("bit_length"), range: 494..504, }, ctx: Load, @@ -731,7 +731,7 @@ Module( Name( ExprName { range: 508..509, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -751,7 +751,7 @@ Module( }, ), attr: Identifier { - id: "conjugate", + id: Name("conjugate"), range: 520..529, }, ctx: Load, @@ -773,7 +773,7 @@ Module( Name( ExprName { range: 532..533, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -793,7 +793,7 @@ Module( }, ), attr: Identifier { - id: "conjugate", + id: Name("conjugate"), range: 544..553, }, ctx: Load, @@ -815,7 +815,7 @@ Module( Name( ExprName { range: 556..557, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -832,7 +832,7 @@ Module( }, ), attr: Identifier { - id: "real", + id: Name("real"), range: 567..571, }, ctx: Load, @@ -847,7 +847,7 @@ Module( Name( ExprName { range: 572..573, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -867,7 +867,7 @@ Module( }, ), attr: Identifier { - id: "hex", + id: Name("hex"), range: 590..593, }, ctx: Load, @@ -889,7 +889,7 @@ Module( Name( ExprName { range: 596..597, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -926,7 +926,7 @@ Module( }, ), attr: Identifier { - id: "real", + id: Name("real"), range: 619..623, }, ctx: Load, @@ -954,7 +954,7 @@ Module( Name( ExprName { range: 677..678, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -973,7 +973,7 @@ Module( slice: Name( ExprName { range: 685..687, - id: "no", + id: Name("no"), ctx: Load, }, ), @@ -989,7 +989,7 @@ Module( Name( ExprName { range: 689..690, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -1011,7 +1011,7 @@ 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 8ac5d39e1e28e..82afb5a34ca12 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,7 @@ Module( value: Name( ExprName { range: 1..5, - id: "expr", + id: Name("expr"), ctx: Load, }, ), @@ -30,7 +30,7 @@ Module( func: Name( ExprName { range: 8..12, - id: "expr", + id: Name("expr"), ctx: Load, }, ), @@ -58,7 +58,7 @@ Module( func: Name( ExprName { range: 17..21, - id: "expr", + id: Name("expr"), ctx: Load, }, ), @@ -101,14 +101,14 @@ 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 +118,7 @@ Module( Name( ExprName { range: 42..43, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -143,7 +143,7 @@ Module( parameter: Parameter { range: 53..54, name: Identifier { - id: "x", + id: Name("x"), range: 53..54, }, annotation: None, @@ -159,7 +159,7 @@ Module( body: Name( ExprName { range: 56..57, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -176,7 +176,7 @@ Module( target: Name( ExprName { range: 60..61, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -202,7 +202,7 @@ Module( Name( ExprName { range: 75..76, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -220,7 +220,7 @@ 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 38620ecf79059..cff618b029407 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,7 @@ Module( target: Name( ExprName { range: 168..169, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -329,7 +329,7 @@ Module( target: Name( ExprName { range: 180..181, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -377,7 +377,7 @@ Module( target: Name( ExprName { range: 196..197, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -417,7 +417,7 @@ Module( value: Name( ExprName { range: 230..231, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -461,7 +461,7 @@ Module( left: Name( ExprName { range: 241..242, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -469,7 +469,7 @@ Module( right: Name( ExprName { range: 245..246, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -527,14 +527,14 @@ 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 +583,7 @@ Module( Name( ExprName { range: 301..302, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -591,7 +591,7 @@ Module( value: Name( ExprName { range: 304..305, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -601,7 +601,7 @@ 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 22272a00a019f..306eb2d153c82 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,7 @@ Module( elt: Name( ExprName { range: 1..2, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -28,14 +28,14 @@ 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 +56,7 @@ Module( elt: Name( ExprName { range: 17..18, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -66,14 +66,14 @@ 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 +84,7 @@ Module( left: Name( ExprName { range: 33..34, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -95,7 +95,7 @@ Module( Name( ExprName { range: 38..39, - id: "w", + id: Name("w"), ctx: Load, }, ), @@ -110,14 +110,14 @@ 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 +127,7 @@ Module( Name( ExprName { range: 55..56, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -148,7 +148,7 @@ Module( elt: Name( ExprName { range: 59..60, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -158,14 +158,14 @@ 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 +178,14 @@ 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 +200,14 @@ 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 +218,7 @@ Module( left: Name( ExprName { range: 97..98, - id: "k", + id: Name("k"), ctx: Load, }, ), @@ -229,7 +229,7 @@ Module( Name( ExprName { range: 101..102, - id: "h", + id: Name("h"), ctx: Load, }, ), @@ -253,7 +253,7 @@ Module( elt: Name( ExprName { range: 105..106, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -263,14 +263,14 @@ 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 +283,14 @@ 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 +305,14 @@ 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 +323,7 @@ Module( left: Name( ExprName { range: 149..150, - id: "k", + id: Name("k"), ctx: Load, }, ), @@ -334,7 +334,7 @@ Module( Name( ExprName { range: 153..154, - id: "h", + id: Name("h"), ctx: Load, }, ), @@ -358,7 +358,7 @@ Module( elt: Name( ExprName { range: 157..158, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -372,14 +372,14 @@ 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 +391,7 @@ Module( iter: Name( ExprName { range: 171..172, - id: "G", + id: Name("G"), ctx: Load, }, ), @@ -412,7 +412,7 @@ Module( elt: Name( ExprName { range: 313..314, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -422,7 +422,7 @@ Module( target: Name( ExprName { range: 319..320, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -433,7 +433,7 @@ Module( Name( ExprName { range: 331..332, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -457,7 +457,7 @@ Module( elt: Name( ExprName { range: 336..337, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -467,7 +467,7 @@ Module( target: Name( ExprName { range: 342..343, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -477,7 +477,7 @@ Module( value: Name( ExprName { range: 359..360, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -500,7 +500,7 @@ Module( elt: Name( ExprName { range: 364..365, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -510,7 +510,7 @@ Module( target: Name( ExprName { range: 370..371, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -527,7 +527,7 @@ Module( parameter: Parameter { range: 383..384, name: Identifier { - id: "y", + id: Name("y"), range: 383..384, }, annotation: None, @@ -543,7 +543,7 @@ Module( body: Name( ExprName { range: 386..387, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -566,7 +566,7 @@ Module( elt: Name( ExprName { range: 391..392, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -576,14 +576,14 @@ 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 +595,7 @@ Module( Name( ExprName { range: 417..418, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -619,7 +619,7 @@ Module( elt: Name( ExprName { range: 422..423, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -629,14 +629,14 @@ 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 +647,7 @@ Module( value: Name( ExprName { range: 453..454, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -670,7 +670,7 @@ Module( elt: Name( ExprName { range: 458..459, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -680,14 +680,14 @@ 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 +705,7 @@ Module( parameter: Parameter { range: 485..486, name: Identifier { - id: "y", + id: Name("y"), range: 485..486, }, annotation: None, @@ -721,7 +721,7 @@ 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 dd3211144fa38..a282c8d2a65a6 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,7 @@ Module( value: Name( ExprName { range: 23..24, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -44,7 +44,7 @@ Module( value: Name( ExprName { range: 28..29, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -79,7 +79,7 @@ Module( value: Name( ExprName { range: 34..35, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -114,7 +114,7 @@ Module( value: Name( ExprName { range: 40..41, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -158,7 +158,7 @@ Module( value: Name( ExprName { range: 47..48, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -184,7 +184,7 @@ Module( value: Name( ExprName { range: 53..54, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -219,7 +219,7 @@ Module( value: Name( ExprName { range: 60..61, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -254,7 +254,7 @@ Module( value: Name( ExprName { range: 67..68, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -298,7 +298,7 @@ Module( value: Name( ExprName { range: 75..76, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -333,7 +333,7 @@ Module( value: Name( ExprName { range: 82..83, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -377,7 +377,7 @@ Module( value: Name( ExprName { range: 90..91, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -421,7 +421,7 @@ Module( value: Name( ExprName { range: 98..99, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -474,7 +474,7 @@ Module( value: Name( ExprName { range: 127..128, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -484,7 +484,7 @@ Module( target: Name( ExprName { range: 129..130, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -512,7 +512,7 @@ Module( value: Name( ExprName { range: 137..138, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -526,7 +526,7 @@ Module( target: Name( ExprName { range: 140..141, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -559,7 +559,7 @@ Module( value: Name( ExprName { range: 150..151, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -573,7 +573,7 @@ Module( target: Name( ExprName { range: 152..153, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -606,7 +606,7 @@ 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 2d9041f3a70f1..4cb6dab7b77df 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,7 @@ Module( value: Name( ExprName { range: 1..2, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -39,7 +39,7 @@ Module( left: Name( ExprName { range: 5..6, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -71,12 +71,12 @@ 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 +94,7 @@ Module( Name( ExprName { range: 21..32, - id: "array_slice", + id: Name("array_slice"), ctx: Store, }, ), @@ -105,7 +105,7 @@ Module( value: Name( ExprName { range: 35..40, - id: "array", + id: Name("array"), ctx: Load, }, ), @@ -127,7 +127,7 @@ Module( value: Name( ExprName { range: 45..52, - id: "indexes", + id: Name("indexes"), ctx: Load, }, ), @@ -168,7 +168,7 @@ Module( value: Name( ExprName { range: 58..63, - id: "array", + id: Name("array"), ctx: Load, }, ), @@ -190,7 +190,7 @@ Module( value: Name( ExprName { range: 68..75, - id: "indexes", + id: Name("indexes"), ctx: Load, }, ), @@ -223,7 +223,7 @@ Module( value: Name( ExprName { range: 83..94, - id: "array_slice", + id: Name("array_slice"), ctx: Load, }, ), @@ -238,7 +238,7 @@ Module( value: Name( ExprName { range: 95..100, - id: "array", + id: Name("array"), ctx: Load, }, ), @@ -252,7 +252,7 @@ Module( value: Name( ExprName { range: 102..119, - id: "indexes_to_select", + id: Name("indexes_to_select"), ctx: Load, }, ), @@ -265,7 +265,7 @@ Module( value: Name( ExprName { range: 122..139, - id: "indexes_to_select", + id: Name("indexes_to_select"), ctx: Load, }, ), @@ -291,7 +291,7 @@ Module( value: Name( ExprName { range: 141..146, - id: "array", + id: Name("array"), ctx: Load, }, ), @@ -331,7 +331,7 @@ 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 c7f4cca392b9d..23929c13facf3 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,7 @@ Module( value: Name( ExprName { range: 0..4, - id: "data", + id: Name("data"), ctx: Load, }, ), @@ -58,7 +58,7 @@ Module( value: Name( ExprName { range: 11..15, - id: "data", + id: Name("data"), ctx: Load, }, ), @@ -101,7 +101,7 @@ Module( value: Name( ExprName { range: 22..26, - id: "data", + id: Name("data"), ctx: Load, }, ), @@ -145,7 +145,7 @@ Module( value: Name( ExprName { range: 32..36, - id: "data", + id: Name("data"), ctx: Load, }, ), @@ -197,7 +197,7 @@ Module( value: Name( ExprName { range: 44..48, - id: "data", + id: Name("data"), ctx: Load, }, ), @@ -258,7 +258,7 @@ Module( value: Name( ExprName { range: 57..61, - id: "data", + id: Name("data"), ctx: Load, }, ), @@ -316,7 +316,7 @@ Module( Name( ExprName { range: 72..73, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -328,7 +328,7 @@ Module( left: Name( ExprName { range: 74..75, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -366,7 +366,7 @@ Module( value: Name( ExprName { range: 81..85, - id: "data", + id: Name("data"), ctx: Load, }, ), @@ -376,14 +376,14 @@ 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 +403,7 @@ Module( value: Name( ExprName { range: 94..98, - id: "data", + id: Name("data"), ctx: Load, }, ), @@ -455,7 +455,7 @@ Module( value: Name( ExprName { range: 107..111, - id: "data", + id: Name("data"), ctx: Load, }, ), @@ -506,7 +506,7 @@ Module( value: Name( ExprName { range: 121..125, - id: "data", + id: Name("data"), ctx: Load, }, ), @@ -517,7 +517,7 @@ Module( operand: Name( ExprName { range: 127..131, - id: "flag", + id: Name("flag"), ctx: Load, }, ), @@ -537,7 +537,7 @@ Module( value: Name( ExprName { range: 133..137, - id: "data", + id: Name("data"), ctx: Load, }, ), @@ -551,7 +551,7 @@ Module( target: Name( ExprName { range: 139..140, - id: "a", + id: Name("a"), ctx: Store, }, ), @@ -584,7 +584,7 @@ Module( value: Name( ExprName { range: 149..153, - id: "data", + id: Name("data"), ctx: Load, }, ), @@ -598,7 +598,7 @@ Module( target: Name( ExprName { range: 155..156, - id: "a", + id: Name("a"), ctx: Store, }, ), @@ -617,7 +617,7 @@ Module( Name( ExprName { range: 163..164, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -639,7 +639,7 @@ Module( value: Name( ExprName { range: 226..230, - id: "data", + id: Name("data"), ctx: Load, }, ), @@ -653,7 +653,7 @@ Module( value: Name( ExprName { range: 232..233, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -679,7 +679,7 @@ Module( value: Name( ExprName { range: 235..239, - id: "data", + id: Name("data"), ctx: Load, }, ), @@ -698,14 +698,14 @@ 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 +734,7 @@ Module( value: Name( ExprName { range: 250..254, - id: "data", + id: Name("data"), ctx: Load, }, ), @@ -751,14 +751,14 @@ 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 e425e62a839b6..5b1045b1961a8 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,7 @@ Module( Name( ExprName { range: 39..40, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -96,14 +96,14 @@ 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 +124,14 @@ 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 +152,14 @@ 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 +180,7 @@ Module( Name( ExprName { range: 90..91, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -201,14 +201,14 @@ 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 +229,14 @@ 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 +260,7 @@ Module( value: Name( ExprName { range: 127..128, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -284,7 +284,7 @@ Module( Name( ExprName { range: 130..131, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -294,7 +294,7 @@ Module( value: Name( ExprName { range: 134..135, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -324,7 +324,7 @@ Module( left: Name( ExprName { range: 137..138, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -332,7 +332,7 @@ Module( right: Name( ExprName { range: 141..142, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -350,7 +350,7 @@ Module( value: Name( ExprName { range: 151..152, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -401,7 +401,7 @@ Module( value: Name( ExprName { range: 164..165, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -425,7 +425,7 @@ Module( Name( ExprName { range: 169..170, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -435,7 +435,7 @@ Module( value: Name( ExprName { range: 173..174, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -465,7 +465,7 @@ Module( left: Name( ExprName { range: 178..179, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -473,7 +473,7 @@ Module( right: Name( ExprName { range: 182..183, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -491,7 +491,7 @@ Module( value: Name( ExprName { range: 192..193, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -542,7 +542,7 @@ Module( target: Name( ExprName { range: 225..226, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -573,7 +573,7 @@ Module( Name( ExprName { range: 235..236, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -583,7 +583,7 @@ Module( target: Name( ExprName { range: 238..239, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -614,7 +614,7 @@ Module( Name( ExprName { range: 247..248, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -624,7 +624,7 @@ Module( target: Name( ExprName { range: 250..251, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -641,7 +641,7 @@ Module( Name( ExprName { range: 258..259, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -662,7 +662,7 @@ Module( Name( ExprName { range: 261..262, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -672,7 +672,7 @@ Module( target: Name( ExprName { range: 265..266, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -689,7 +689,7 @@ 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 6ea92294227a1..32622f70b8045 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,7 @@ Module( operand: Name( ExprName { range: 22..23, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -197,7 +197,7 @@ Module( operand: Name( ExprName { range: 62..63, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -364,7 +364,7 @@ Module( operand: Name( ExprName { range: 216..217, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -373,7 +373,7 @@ Module( Name( ExprName { range: 222..223, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -395,7 +395,7 @@ Module( left: Name( ExprName { range: 231..232, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -403,7 +403,7 @@ Module( right: Name( ExprName { range: 235..236, - id: "d", + id: Name("d"), ctx: Load, }, ), @@ -418,7 +418,7 @@ Module( operand: Name( ExprName { range: 245..246, - id: "e", + id: Name("e"), ctx: Load, }, ), @@ -445,7 +445,7 @@ Module( target: Name( ExprName { range: 252..253, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -476,7 +476,7 @@ Module( left: Name( ExprName { range: 264..265, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -488,7 +488,7 @@ 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 8eda1ccf6082c..dc9d2aa3ca062 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,7 @@ Module( Name( ExprName { range: 12..13, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -52,7 +52,7 @@ Module( left: Name( ExprName { range: 20..21, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -87,14 +87,14 @@ 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 +119,7 @@ Module( func: Name( ExprName { range: 46..50, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -222,7 +222,7 @@ Module( Name( ExprName { range: 86..87, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -258,14 +258,14 @@ 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 +293,14 @@ 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 +327,7 @@ Module( left: Name( ExprName { range: 122..123, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -338,7 +338,7 @@ Module( Name( ExprName { range: 127..128, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -363,7 +363,7 @@ Module( target: Name( ExprName { range: 136..137, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -395,7 +395,7 @@ Module( value: Name( ExprName { range: 151..152, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -421,7 +421,7 @@ Module( Name( ExprName { range: 159..160, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -431,7 +431,7 @@ Module( value: Name( ExprName { range: 163..164, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -465,7 +465,7 @@ Module( value: Name( ExprName { range: 172..173, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -498,7 +498,7 @@ Module( left: Name( ExprName { range: 182..183, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -506,7 +506,7 @@ 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 d069483300c35..7bbc2b19c577a 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,7 @@ Module( value: Name( ExprName { range: 11..12, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -38,7 +38,7 @@ Module( left: Name( ExprName { range: 24..25, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -71,14 +71,14 @@ 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 +101,7 @@ Module( func: Name( ExprName { range: 60..64, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -198,7 +198,7 @@ Module( Name( ExprName { range: 115..116, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -232,14 +232,14 @@ 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 +264,7 @@ Module( left: Name( ExprName { range: 150..151, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -275,7 +275,7 @@ Module( Name( ExprName { range: 155..156, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -298,7 +298,7 @@ Module( target: Name( ExprName { range: 169..170, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -329,7 +329,7 @@ Module( Name( ExprName { range: 189..190, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -342,7 +342,7 @@ Module( left: Name( ExprName { range: 193..194, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -350,7 +350,7 @@ 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 04e9a2dd487de..96cbefeb69350 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,7 @@ Module( value: Name( ExprName { range: 4..5, - id: "d", + id: Name("d"), ctx: Load, }, ), @@ -29,7 +29,7 @@ Module( left: Name( ExprName { range: 6..7, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -40,7 +40,7 @@ Module( Name( ExprName { range: 11..12, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -53,7 +53,7 @@ Module( iter: Name( ExprName { range: 17..23, - id: "target", + id: Name("target"), ctx: Load, }, ), @@ -85,7 +85,7 @@ Module( left: Name( ExprName { range: 34..35, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -96,7 +96,7 @@ Module( Name( ExprName { range: 39..40, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -117,7 +117,7 @@ Module( iter: Name( ExprName { range: 48..52, - id: "iter", + id: Name("iter"), ctx: Load, }, ), @@ -149,7 +149,7 @@ Module( left: Name( ExprName { range: 63..64, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -160,7 +160,7 @@ Module( Name( ExprName { range: 68..69, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -168,7 +168,7 @@ Module( }, ), attr: Identifier { - id: "attr", + id: Name("attr"), range: 71..75, }, ctx: Store, @@ -177,7 +177,7 @@ 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 6f6153b29e1e3..f0ec9ce11206a 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,7 @@ Module( Alias { range: 12..13, name: Identifier { - id: "x", + id: Name("x"), range: 12..13, }, asname: None, @@ -34,7 +34,7 @@ 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 9ab3b52aba38a..f4926008389c8 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,7 @@ Module( range: 0..25, module: Some( Identifier { - id: "match", + id: Name("match"), range: 5..10, }, ), @@ -22,7 +22,7 @@ Module( Alias { range: 18..25, name: Identifier { - id: "pattern", + id: Name("pattern"), range: 18..25, }, asname: None, @@ -36,7 +36,7 @@ Module( range: 26..46, module: Some( Identifier { - id: "type", + id: Name("type"), range: 31..35, }, ), @@ -44,7 +44,7 @@ Module( Alias { range: 43..46, name: Identifier { - id: "bar", + id: Name("bar"), range: 43..46, }, asname: None, @@ -58,7 +58,7 @@ Module( range: 47..71, module: Some( Identifier { - id: "case", + id: Name("case"), range: 52..56, }, ), @@ -66,7 +66,7 @@ Module( Alias { range: 64..71, name: Identifier { - id: "pattern", + id: Name("pattern"), range: 64..71, }, asname: None, @@ -80,7 +80,7 @@ Module( range: 72..103, module: Some( Identifier { - id: "match.type.case", + id: Name("match.type.case"), range: 77..92, }, ), @@ -88,7 +88,7 @@ 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 9cee45ecf22fe..bb3a49d76895d 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,7 @@ Module( range: 0..20, module: Some( Identifier { - id: "a", + id: Name("a"), range: 5..6, }, ), @@ -22,7 +22,7 @@ Module( Alias { range: 15..16, name: Identifier { - id: "b", + id: Name("b"), range: 15..16, }, asname: None, @@ -30,7 +30,7 @@ Module( Alias { range: 18..19, name: Identifier { - id: "c", + id: Name("c"), range: 18..19, }, asname: None, @@ -44,7 +44,7 @@ Module( range: 21..41, module: Some( Identifier { - id: "a", + id: Name("a"), range: 26..27, }, ), @@ -52,7 +52,7 @@ Module( Alias { range: 36..37, name: Identifier { - id: "b", + id: Name("b"), range: 36..37, }, asname: None, @@ -60,7 +60,7 @@ Module( Alias { range: 39..40, name: Identifier { - id: "c", + id: Name("c"), range: 39..40, }, asname: None, @@ -79,14 +79,14 @@ 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 +102,7 @@ Module( range: 48..66, module: Some( Identifier { - id: "a", + id: Name("a"), range: 53..54, }, ), @@ -110,7 +110,7 @@ Module( Alias { range: 62..63, name: Identifier { - id: "b", + id: Name("b"), range: 62..63, }, asname: None, @@ -118,7 +118,7 @@ Module( Alias { range: 65..66, name: Identifier { - id: "c", + id: Name("c"), range: 65..66, }, asname: None, @@ -137,14 +137,14 @@ 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 +160,7 @@ Module( range: 73..91, module: Some( Identifier { - id: "a", + id: Name("a"), range: 78..79, }, ), @@ -168,7 +168,7 @@ Module( Alias { range: 87..88, name: Identifier { - id: "b", + id: Name("b"), range: 87..88, }, asname: None, @@ -176,7 +176,7 @@ Module( Alias { range: 90..91, name: Identifier { - id: "c", + id: Name("c"), range: 90..91, }, asname: None, @@ -195,14 +195,14 @@ 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 343825fcdb737..754e602e6fc3d 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,7 @@ Module( expression: Name( ExprName { range: 9..10, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -91,7 +91,7 @@ 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 c447efe4e7fac..1aac8eadc4970 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -28,14 +28,14 @@ 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 +48,14 @@ 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 +72,7 @@ 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 eb6c1f3cb195a..1a2e627a0a9cb 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -35,7 +35,7 @@ Module( Name( ExprName { range: 14..17, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -65,7 +65,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 29..32, }, type_params: None, @@ -85,14 +85,14 @@ 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 dce1c4cf133fb..4bc923b6ac106 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -34,7 +34,7 @@ Module( left: Name( ExprName { range: 13..16, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -42,7 +42,7 @@ Module( right: Name( ExprName { range: 19..22, - id: "str", + id: Name("str"), ctx: Load, }, ), @@ -69,7 +69,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 32..35, }, type_params: None, @@ -95,7 +95,7 @@ Module( parameter: Parameter { range: 48..49, name: Identifier { - id: "x", + id: Name("x"), range: 48..49, }, annotation: None, @@ -111,7 +111,7 @@ Module( body: Name( ExprName { range: 51..52, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -138,7 +138,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 62..65, }, type_params: None, @@ -158,7 +158,7 @@ Module( Name( ExprName { range: 78..79, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -186,7 +186,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 90..93, }, type_params: None, @@ -211,14 +211,14 @@ 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 3231376754bf1..e7710f07b7688 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,7 @@ Module( range: 0..8, names: [ Identifier { - id: "x", + id: Name("x"), range: 7..8, }, ], @@ -25,15 +25,15 @@ 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 b4e8a5ae633e5..782ca0132f9bc 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,12 @@ 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 +36,12 @@ 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 +56,12 @@ 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 7cdade0b91824..d29e3330c7da2 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,7 @@ Module( Alias { range: 7..8, name: Identifier { - id: "a", + id: Name("a"), range: 7..8, }, asname: None, @@ -24,7 +24,7 @@ Module( Alias { range: 10..11, name: Identifier { - id: "b", + id: Name("b"), range: 10..11, }, asname: None, @@ -39,7 +39,7 @@ Module( Alias { range: 20..21, name: Identifier { - id: "c", + id: Name("c"), range: 20..21, }, asname: None, @@ -47,7 +47,7 @@ Module( Alias { range: 23..24, name: Identifier { - id: "d", + id: Name("d"), range: 23..24, }, asname: None, @@ -62,7 +62,7 @@ Module( Alias { range: 32..33, name: Identifier { - id: "a", + id: Name("a"), range: 32..33, }, asname: None, @@ -70,7 +70,7 @@ Module( Alias { range: 35..36, name: Identifier { - id: "b", + id: Name("b"), range: 35..36, }, asname: None, @@ -88,14 +88,14 @@ 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 d86b646422a1b..f8854872e1f8a 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,7 @@ Module( parameter: Parameter { range: 7..8, name: Identifier { - id: "x", + id: Name("x"), range: 7..8, }, annotation: None, @@ -41,7 +41,7 @@ Module( body: Name( ExprName { range: 10..11, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -65,7 +65,7 @@ Module( parameter: Parameter { range: 19..20, name: Identifier { - id: "x", + id: Name("x"), range: 19..20, }, annotation: None, @@ -90,14 +90,14 @@ 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 +123,7 @@ Module( parameter: Parameter { range: 46..47, name: Identifier { - id: "x", + id: Name("x"), range: 46..47, }, annotation: None, @@ -142,7 +142,7 @@ Module( value: Name( ExprName { range: 55..56, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -168,7 +168,7 @@ Module( parameter: Parameter { range: 64..65, name: Identifier { - id: "x", + id: Name("x"), range: 64..65, }, annotation: None, @@ -194,7 +194,7 @@ Module( parameter: Parameter { range: 74..75, name: Identifier { - id: "y", + id: Name("y"), range: 74..75, }, annotation: None, @@ -213,7 +213,7 @@ Module( left: Name( ExprName { range: 77..78, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -221,7 +221,7 @@ Module( right: Name( ExprName { range: 81..82, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -249,7 +249,7 @@ Module( parameter: Parameter { range: 90..91, name: Identifier { - id: "x", + id: Name("x"), range: 90..91, }, annotation: None, @@ -269,7 +269,7 @@ Module( Name( ExprName { range: 100..101, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -300,7 +300,7 @@ Module( parameter: Parameter { range: 143..144, name: Identifier { - id: "x", + id: Name("x"), range: 143..144, }, annotation: None, @@ -316,7 +316,7 @@ Module( body: Name( ExprName { range: 146..147, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -328,7 +328,7 @@ 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 4fea0dcc1870c..621d2013c02de 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,7 @@ Module( subject: Name( ExprName { range: 6..9, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -28,7 +28,7 @@ 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 eecf69925d987..1270f7562b043 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,7 @@ Module( subject: Name( ExprName { range: 6..9, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -28,7 +28,7 @@ Module( pattern: None, name: Some( Identifier { - id: "case", + id: Name("case"), range: 20..24, }, ), @@ -56,7 +56,7 @@ Module( pattern: None, name: Some( Identifier { - id: "match", + id: Name("match"), range: 39..44, }, ), @@ -84,7 +84,7 @@ 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 fb3410108d3e7..924f3b9f1b4ee 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,7 @@ Module( subject: Name( ExprName { range: 6..9, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -31,12 +31,12 @@ 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 +69,12 @@ 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 +107,12 @@ 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 +160,47 @@ 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 21dd833fc8031..14eee06124b0d 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,7 @@ Module( left: Name( ExprName { range: 0..5, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -29,7 +29,7 @@ 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 c2023f5c4ac3a..7dfcfdd389100 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,7 @@ Module( value: Name( ExprName { range: 0..5, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -30,7 +30,7 @@ Module( left: Name( ExprName { range: 6..11, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -41,7 +41,7 @@ Module( Name( ExprName { range: 15..18, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -60,14 +60,14 @@ 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 +88,14 @@ 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 +115,14 @@ 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 +137,7 @@ Module( value: Name( ExprName { range: 58..63, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -149,14 +149,14 @@ 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 +174,7 @@ Module( Name( ExprName { range: 76..81, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -194,12 +194,12 @@ 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 +216,7 @@ Module( left: Name( ExprName { range: 93..98, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -224,7 +224,7 @@ Module( right: Name( ExprName { range: 101..104, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -241,7 +241,7 @@ Module( left: Name( ExprName { range: 105..110, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -249,7 +249,7 @@ Module( right: Name( ExprName { range: 114..117, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -268,14 +268,14 @@ 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 +293,7 @@ Module( left: Name( ExprName { range: 132..137, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -304,7 +304,7 @@ 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 b25b756c8ceba..628936b631eed 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,7 @@ Module( subject: Name( ExprName { range: 6..9, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -233,7 +233,7 @@ Module( expression: Name( ExprName { range: 147..148, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -344,7 +344,7 @@ Module( operand: Name( ExprName { range: 205..208, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -422,7 +422,7 @@ Module( operand: Name( ExprName { range: 263..266, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -467,7 +467,7 @@ Module( func: Name( ExprName { range: 296..299, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -523,7 +523,7 @@ Module( parameter: Parameter { range: 332..335, name: Identifier { - id: "foo", + id: Name("foo"), range: 332..335, }, annotation: None, @@ -539,7 +539,7 @@ 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 88a69846f4955..a467ea1997c13 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,7 @@ Module( subject: Name( ExprName { range: 6..11, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -52,7 +52,7 @@ Module( subject: Name( ExprName { range: 35..39, - id: "case", + id: Name("case"), ctx: Load, }, ), @@ -89,7 +89,7 @@ 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 67f1d122bc196..fa466c931a3fd 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,7 @@ Module( func: Name( ExprName { range: 0..5, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -112,7 +112,7 @@ Module( value: Name( ExprName { range: 68..73, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -201,7 +201,7 @@ Module( left: Name( ExprName { range: 134..139, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -209,7 +209,7 @@ Module( right: Name( ExprName { range: 142..145, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -226,7 +226,7 @@ Module( left: Name( ExprName { range: 160..165, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -234,7 +234,7 @@ Module( right: Name( ExprName { range: 168..171, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -252,7 +252,7 @@ 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 178abcfd53360..582fa2aeb80c3 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,7 @@ Module( subject: Name( ExprName { range: 6..13, - id: "subject", + id: Name("subject"), ctx: Load, }, ), @@ -32,7 +32,7 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name("a"), range: 25..26, }, ), @@ -44,7 +44,7 @@ Module( pattern: None, name: Some( Identifier { - id: "b", + id: Name("b"), range: 28..29, }, ), @@ -79,7 +79,7 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name("a"), range: 46..47, }, ), @@ -91,7 +91,7 @@ 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 cf7c08be263d6..e97bfca642719 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,7 @@ Module( subject: Name( ExprName { range: 6..13, - id: "subject", + id: Name("subject"), ctx: Load, }, ), @@ -28,7 +28,7 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name("a"), range: 24..25, }, ), @@ -56,7 +56,7 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name("a"), range: 40..41, }, ), @@ -66,7 +66,7 @@ Module( Name( ExprName { range: 45..46, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -96,7 +96,7 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name("a"), range: 61..62, }, ), @@ -108,7 +108,7 @@ Module( pattern: None, name: Some( Identifier { - id: "b", + id: Name("b"), range: 64..65, }, ), @@ -143,7 +143,7 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name("a"), range: 80..81, }, ), @@ -155,7 +155,7 @@ Module( pattern: None, name: Some( Identifier { - id: "b", + id: Name("b"), range: 83..84, }, ), @@ -168,7 +168,7 @@ 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 8fa7c0e2b49ad..06a266c5fb2db 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,7 @@ Module( target: Name( ExprName { range: 6..7, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -68,7 +68,7 @@ Module( target: Name( ExprName { range: 37..38, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -125,7 +125,7 @@ Module( left: Name( ExprName { range: 128..129, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -133,7 +133,7 @@ Module( right: Name( ExprName { range: 132..133, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -145,7 +145,7 @@ Module( Name( ExprName { range: 135..136, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -190,7 +190,7 @@ 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 0f30fcbe4dc7f..2707f21e7aaaa 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,7 @@ Module( subject: Name( ExprName { range: 6..7, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -28,7 +28,7 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name("y"), range: 18..19, }, ), @@ -41,7 +41,7 @@ Module( target: Name( ExprName { range: 23..24, - id: "a", + id: Name("a"), ctx: Store, }, ), @@ -78,7 +78,7 @@ Module( subject: Name( ExprName { range: 41..42, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -91,7 +91,7 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name("y"), range: 53..54, }, ), @@ -110,14 +110,14 @@ 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 +146,7 @@ Module( subject: Name( ExprName { range: 86..87, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -159,7 +159,7 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name("y"), range: 98..99, }, ), @@ -179,7 +179,7 @@ Module( parameter: Parameter { range: 110..111, name: Identifier { - id: "a", + id: Name("a"), range: 110..111, }, annotation: None, @@ -195,7 +195,7 @@ Module( body: Name( ExprName { range: 113..114, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -224,7 +224,7 @@ Module( subject: Name( ExprName { range: 126..127, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -237,7 +237,7 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name("y"), range: 138..139, }, ), @@ -251,7 +251,7 @@ 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 279f806735504..e9a65e64debad 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,7 @@ Module( range: 0..10, names: [ Identifier { - id: "x", + id: Name("x"), range: 9..10, }, ], @@ -25,15 +25,15 @@ 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 84bf123453bfc..932d2c2acd5e3 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,14 @@ 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 +57,14 @@ 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 +88,14 @@ 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 +138,19 @@ 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 +159,7 @@ Module( }, ], name: Identifier { - id: "f", + id: Name("f"), range: 120..121, }, type_params: None, @@ -196,7 +196,7 @@ Module( expression: Name( ExprName { range: 132..133, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -212,19 +212,19 @@ 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 +233,7 @@ Module( }, ], name: Identifier { - id: "f", + id: Name("f"), range: 145..146, }, type_params: None, @@ -269,7 +269,7 @@ Module( expression: Name( ExprName { range: 157..158, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -310,19 +310,19 @@ 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 +331,7 @@ Module( }, ], name: Identifier { - id: "T", + id: Name("T"), range: 179..180, }, type_params: None, @@ -363,7 +363,7 @@ Module( target: Name( ExprName { range: 189..190, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -392,14 +392,14 @@ 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 +421,7 @@ Module( parameter: Parameter { range: 222..223, name: Identifier { - id: "x", + id: Name("x"), range: 222..223, }, annotation: None, @@ -437,7 +437,7 @@ Module( body: Name( ExprName { range: 225..226, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -454,14 +454,14 @@ 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 +478,7 @@ Module( Name( ExprName { range: 244..245, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -498,7 +498,7 @@ Module( value: Name( ExprName { range: 250..251, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -511,7 +511,7 @@ Module( value: Name( ExprName { range: 254..255, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -526,7 +526,7 @@ Module( }, ], name: Identifier { - id: "f", + id: Name("f"), range: 261..262, }, type_params: None, @@ -566,7 +566,7 @@ Module( left: Name( ExprName { range: 361..362, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -574,7 +574,7 @@ Module( right: Name( ExprName { range: 364..365, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -583,7 +583,7 @@ Module( }, ], name: Identifier { - id: "foo", + id: Name("foo"), range: 370..373, }, type_params: None, @@ -620,7 +620,7 @@ Module( expression: Name( ExprName { range: 384..385, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -630,14 +630,14 @@ 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 3790baafca212..86bba2f1be2cd 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -28,14 +28,14 @@ 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 +69,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 27..30, }, type_params: None, @@ -82,7 +82,7 @@ Module( parameter: Parameter { range: 31..47, name: Identifier { - id: "arg", + id: Name("arg"), range: 31..34, }, annotation: Some( @@ -99,7 +99,7 @@ Module( parameter: Parameter { range: 43..44, name: Identifier { - id: "x", + id: Name("x"), range: 43..44, }, annotation: None, @@ -115,7 +115,7 @@ Module( body: Name( ExprName { range: 46..47, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -151,7 +151,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 58..61, }, type_params: None, @@ -164,7 +164,7 @@ Module( parameter: Parameter { range: 62..76, name: Identifier { - id: "arg", + id: Name("arg"), range: 62..65, }, annotation: Some( @@ -175,7 +175,7 @@ Module( Name( ExprName { range: 74..75, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -212,7 +212,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 87..90, }, type_params: None, @@ -225,7 +225,7 @@ Module( parameter: Parameter { range: 91..106, name: Identifier { - id: "arg", + id: Name("arg"), range: 91..94, }, annotation: Some( @@ -235,14 +235,14 @@ 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 7064b7751dfbd..672d824c615c2 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -28,7 +28,7 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "x", + id: Name("x"), range: 8..9, }, annotation: None, @@ -47,7 +47,7 @@ Module( parameter: Parameter { range: 17..18, name: Identifier { - id: "y", + id: Name("y"), range: 17..18, }, annotation: None, @@ -63,7 +63,7 @@ Module( body: Name( ExprName { range: 20..21, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -97,7 +97,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 32..35, }, type_params: None, @@ -110,7 +110,7 @@ Module( parameter: Parameter { range: 36..37, name: Identifier { - id: "x", + id: Name("x"), range: 36..37, }, annotation: None, @@ -171,7 +171,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 65..68, }, type_params: None, @@ -184,7 +184,7 @@ Module( parameter: Parameter { range: 69..70, name: Identifier { - id: "x", + id: Name("x"), range: 69..70, }, annotation: None, @@ -196,7 +196,7 @@ Module( value: Name( ExprName { range: 77..78, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -230,7 +230,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 89..92, }, type_params: None, @@ -243,7 +243,7 @@ Module( parameter: Parameter { range: 93..94, name: Identifier { - id: "x", + id: Name("x"), range: 93..94, }, annotation: None, @@ -256,7 +256,7 @@ 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 ca04a14fb094a..2965ea8635a59 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -27,7 +27,7 @@ Module( Parameter { range: 8..25, name: Identifier { - id: "args", + id: Name("args"), range: 9..13, }, annotation: Some( @@ -40,7 +40,7 @@ Module( left: Name( ExprName { range: 16..19, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -48,7 +48,7 @@ Module( right: Name( ExprName { range: 22..25, - id: "str", + id: Name("str"), ctx: Load, }, ), @@ -84,7 +84,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 36..39, }, type_params: None, @@ -96,7 +96,7 @@ Module( Parameter { range: 40..60, name: Identifier { - id: "args", + id: Name("args"), range: 41..45, }, annotation: Some( @@ -111,14 +111,14 @@ 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 50612e88137c7..fc7d497209afd 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -28,7 +28,7 @@ Module( parameter: Parameter { range: 8..9, name: Identifier { - id: "a", + id: Name("a"), range: 8..9, }, annotation: None, @@ -52,7 +52,7 @@ Module( parameter: Parameter { range: 17..18, name: Identifier { - id: "b", + id: Name("b"), range: 17..18, }, annotation: None, @@ -64,7 +64,7 @@ Module( parameter: Parameter { range: 20..21, name: Identifier { - id: "c", + id: Name("c"), range: 20..21, }, annotation: None, @@ -85,7 +85,7 @@ Module( parameter: Parameter { range: 26..27, name: Identifier { - id: "d", + id: Name("d"), range: 26..27, }, annotation: None, @@ -116,7 +116,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 38..41, }, type_params: None, @@ -129,7 +129,7 @@ Module( parameter: Parameter { range: 42..43, name: Identifier { - id: "a", + id: Name("a"), range: 42..43, }, annotation: None, @@ -150,7 +150,7 @@ Module( Parameter { range: 48..53, name: Identifier { - id: "args", + id: Name("args"), range: 49..53, }, annotation: None, @@ -162,7 +162,7 @@ Module( parameter: Parameter { range: 55..56, name: Identifier { - id: "b", + id: Name("b"), range: 55..56, }, annotation: None, @@ -174,7 +174,7 @@ Module( parameter: Parameter { range: 58..59, name: Identifier { - id: "c", + id: Name("c"), range: 58..59, }, annotation: None, @@ -195,7 +195,7 @@ 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 94fa821efab7c..2a20137386b78 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 4..7, }, type_params: None, @@ -30,7 +30,7 @@ Module( parameter: Parameter { range: 11..12, name: Identifier { - id: "a", + id: Name("a"), range: 11..12, }, annotation: None, @@ -42,7 +42,7 @@ Module( Parameter { range: 14..22, name: Identifier { - id: "kwargs", + id: Name("kwargs"), range: 16..22, }, annotation: None, @@ -70,7 +70,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 33..36, }, type_params: None, @@ -85,7 +85,7 @@ Module( parameter: Parameter { range: 40..41, name: Identifier { - id: "a", + id: Name("a"), range: 40..41, }, annotation: None, @@ -106,7 +106,7 @@ 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 fcef98b46ea4e..0caee363a4166 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,7 @@ 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 5cc4fa6255410..9b2a2f698fc91 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,7 @@ Module( Alias { range: 15..16, name: Identifier { - id: "a", + id: Name("a"), range: 15..16, }, asname: None, @@ -35,7 +35,7 @@ Module( range: 18..33, module: Some( Identifier { - id: "x", + id: Name("x"), range: 23..24, }, ), @@ -43,7 +43,7 @@ Module( Alias { range: 32..33, name: Identifier { - id: "y", + id: Name("y"), range: 32..33, }, asname: None, @@ -58,7 +58,7 @@ Module( value: Name( ExprName { range: 35..36, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -70,7 +70,7 @@ Module( name: Name( ExprName { range: 43..44, - id: "T", + id: Name("T"), ctx: Store, }, ), @@ -78,7 +78,7 @@ 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 b17e20da0f7ab..fd059ae0e28ad 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,7 @@ Module( context_expr: Name( ExprName { range: 594..598, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -50,7 +50,7 @@ Module( context_expr: Name( ExprName { range: 611..615, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -81,7 +81,7 @@ Module( context_expr: Name( ExprName { range: 656..660, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -112,7 +112,7 @@ Module( context_expr: Name( ExprName { range: 675..680, - id: "item1", + id: Name("item1"), ctx: Load, }, ), @@ -123,7 +123,7 @@ Module( context_expr: Name( ExprName { range: 682..687, - id: "item2", + id: Name("item2"), ctx: Load, }, ), @@ -154,7 +154,7 @@ Module( context_expr: Name( ExprName { range: 700..705, - id: "item1", + id: Name("item1"), ctx: Load, }, ), @@ -165,7 +165,7 @@ Module( context_expr: Name( ExprName { range: 707..712, - id: "item2", + id: Name("item2"), ctx: Load, }, ), @@ -196,7 +196,7 @@ Module( context_expr: Name( ExprName { range: 752..757, - id: "item1", + id: Name("item1"), ctx: Load, }, ), @@ -207,7 +207,7 @@ Module( context_expr: Name( ExprName { range: 761..766, - id: "item2", + id: Name("item2"), ctx: Load, }, ), @@ -218,7 +218,7 @@ Module( context_expr: Name( ExprName { range: 769..774, - id: "item3", + id: Name("item3"), ctx: Load, }, ), @@ -226,7 +226,7 @@ Module( Name( ExprName { range: 778..779, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -237,7 +237,7 @@ Module( context_expr: Name( ExprName { range: 782..787, - id: "item4", + id: Name("item4"), ctx: Load, }, ), @@ -272,14 +272,14 @@ 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 +295,7 @@ Module( context_expr: Name( ExprName { range: 817..822, - id: "item3", + id: Name("item3"), ctx: Load, }, ), @@ -330,14 +330,14 @@ 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 +350,7 @@ Module( Name( ExprName { range: 845..846, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -381,7 +381,7 @@ Module( context_expr: Name( ExprName { range: 859..864, - id: "item1", + id: Name("item1"), ctx: Load, }, ), @@ -389,7 +389,7 @@ Module( Name( ExprName { range: 868..870, - id: "f1", + id: Name("f1"), ctx: Store, }, ), @@ -400,7 +400,7 @@ Module( context_expr: Name( ExprName { range: 872..877, - id: "item2", + id: Name("item2"), ctx: Load, }, ), @@ -408,7 +408,7 @@ Module( Name( ExprName { range: 881..883, - id: "f2", + id: Name("f2"), ctx: Store, }, ), @@ -439,7 +439,7 @@ Module( context_expr: Name( ExprName { range: 896..901, - id: "item1", + id: Name("item1"), ctx: Load, }, ), @@ -447,7 +447,7 @@ Module( Name( ExprName { range: 905..907, - id: "f1", + id: Name("f1"), ctx: Store, }, ), @@ -458,7 +458,7 @@ Module( context_expr: Name( ExprName { range: 909..914, - id: "item2", + id: Name("item2"), ctx: Load, }, ), @@ -466,7 +466,7 @@ Module( Name( ExprName { range: 918..920, - id: "f2", + id: Name("f2"), ctx: Store, }, ), @@ -500,7 +500,7 @@ Module( left: Name( ExprName { range: 959..963, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -549,7 +549,7 @@ Module( target: Name( ExprName { range: 984..988, - id: "item", + id: Name("item"), ctx: Store, }, ), @@ -597,7 +597,7 @@ Module( target: Name( ExprName { range: 1009..1013, - id: "item", + id: Name("item"), ctx: Store, }, ), @@ -650,7 +650,7 @@ Module( value: Name( ExprName { range: 1036..1040, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -692,7 +692,7 @@ Module( target: Name( ExprName { range: 1056..1061, - id: "item1", + id: Name("item1"), ctx: Store, }, ), @@ -713,7 +713,7 @@ Module( context_expr: Name( ExprName { range: 1070..1075, - id: "item2", + id: Name("item2"), ctx: Load, }, ), @@ -744,7 +744,7 @@ Module( context_expr: Name( ExprName { range: 1088..1093, - id: "item1", + id: Name("item1"), ctx: Load, }, ), @@ -752,7 +752,7 @@ Module( Name( ExprName { range: 1097..1098, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -766,7 +766,7 @@ Module( target: Name( ExprName { range: 1101..1106, - id: "item2", + id: Name("item2"), ctx: Store, }, ), @@ -810,7 +810,7 @@ Module( func: Name( ExprName { range: 1126..1129, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -851,7 +851,7 @@ Module( func: Name( ExprName { range: 1144..1147, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -892,7 +892,7 @@ Module( func: Name( ExprName { range: 1163..1166, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -907,7 +907,7 @@ Module( Name( ExprName { range: 1172..1173, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -950,7 +950,7 @@ Module( expression: Name( ExprName { range: 1189..1193, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -1025,7 +1025,7 @@ Module( target: Name( ExprName { range: 1218..1222, - id: "item", + id: Name("item"), ctx: Store, }, ), @@ -1086,7 +1086,7 @@ Module( elt: Name( ExprName { range: 1245..1246, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1096,7 +1096,7 @@ Module( target: Name( ExprName { range: 1251..1252, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -1106,7 +1106,7 @@ Module( func: Name( ExprName { range: 1256..1261, - id: "range", + id: Name("range"), ctx: Load, }, ), @@ -1140,7 +1140,7 @@ Module( context_expr: Name( ExprName { range: 1268..1272, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -1171,7 +1171,7 @@ Module( context_expr: Name( ExprName { range: 1285..1289, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -1185,7 +1185,7 @@ Module( elt: Name( ExprName { range: 1292..1293, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1195,7 +1195,7 @@ Module( target: Name( ExprName { range: 1298..1299, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -1205,7 +1205,7 @@ Module( func: Name( ExprName { range: 1303..1308, - id: "range", + id: Name("range"), ctx: Load, }, ), @@ -1259,7 +1259,7 @@ Module( context_expr: Name( ExprName { range: 1326..1330, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -1273,7 +1273,7 @@ Module( elt: Name( ExprName { range: 1333..1334, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1283,7 +1283,7 @@ Module( target: Name( ExprName { range: 1339..1340, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -1293,7 +1293,7 @@ Module( func: Name( ExprName { range: 1344..1349, - id: "range", + id: Name("range"), ctx: Load, }, ), @@ -1327,7 +1327,7 @@ Module( context_expr: Name( ExprName { range: 1356..1360, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -1361,7 +1361,7 @@ Module( value: Name( ExprName { range: 1373..1377, - id: "data", + id: Name("data"), ctx: Load, }, ), @@ -1424,7 +1424,7 @@ Module( value: Name( ExprName { range: 1395..1399, - id: "data", + id: Name("data"), ctx: Load, }, ), @@ -1461,7 +1461,7 @@ Module( Name( ExprName { range: 1408..1409, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -1495,7 +1495,7 @@ Module( elt: Name( ExprName { range: 1423..1424, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1505,14 +1505,14 @@ 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 +1527,7 @@ Module( Name( ExprName { range: 1443..1444, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -1558,7 +1558,7 @@ Module( context_expr: Name( ExprName { range: 1669..1673, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -1566,7 +1566,7 @@ Module( Name( ExprName { range: 1678..1679, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -1600,7 +1600,7 @@ Module( target: Name( ExprName { range: 1691..1695, - id: "item", + id: Name("item"), ctx: Store, }, ), @@ -1644,7 +1644,7 @@ Module( target: Name( ExprName { range: 1714..1718, - id: "item", + id: Name("item"), ctx: Store, }, ), @@ -1662,7 +1662,7 @@ Module( Name( ExprName { range: 1729..1730, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -1696,7 +1696,7 @@ Module( target: Name( ExprName { range: 1744..1748, - id: "item", + id: Name("item"), ctx: Store, }, ), @@ -1740,7 +1740,7 @@ Module( target: Name( ExprName { range: 1769..1774, - id: "item1", + id: Name("item1"), ctx: Store, }, ), @@ -1761,7 +1761,7 @@ Module( context_expr: Name( ExprName { range: 1783..1788, - id: "item2", + id: Name("item2"), ctx: Load, }, ), @@ -1801,7 +1801,7 @@ Module( left: Name( ExprName { range: 1800..1804, - id: "root", + id: Name("root"), ctx: Load, }, ), @@ -1809,14 +1809,14 @@ 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 +1865,7 @@ Module( left: Name( ExprName { range: 1857..1861, - id: "root", + id: Name("root"), ctx: Load, }, ), @@ -1873,14 +1873,14 @@ 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 +1897,7 @@ Module( Name( ExprName { range: 1884..1885, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -1931,7 +1931,7 @@ Module( func: Name( ExprName { range: 1919..1922, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -1972,7 +1972,7 @@ Module( func: Name( ExprName { range: 1959..1962, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -1987,7 +1987,7 @@ Module( Name( ExprName { range: 1969..1970, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -2021,7 +2021,7 @@ Module( func: Name( ExprName { range: 2004..2007, - id: "foo", + id: Name("foo"), ctx: Load, }, ), @@ -2036,7 +2036,7 @@ Module( Name( ExprName { range: 2014..2015, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -2070,7 +2070,7 @@ Module( value: Name( ExprName { range: 2027..2031, - id: "data", + id: Name("data"), ctx: Load, }, ), @@ -2107,7 +2107,7 @@ Module( Name( ExprName { range: 2041..2042, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -2257,7 +2257,7 @@ Module( Name( ExprName { range: 2114..2115, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -2288,7 +2288,7 @@ Module( context_expr: Name( ExprName { range: 2149..2154, - id: "item1", + id: Name("item1"), ctx: Load, }, ), @@ -2299,7 +2299,7 @@ Module( context_expr: Name( ExprName { range: 2158..2163, - id: "item2", + id: Name("item2"), ctx: Load, }, ), @@ -2333,7 +2333,7 @@ Module( func: Name( ExprName { range: 2176..2180, - id: "open", + id: Name("open"), ctx: Load, }, ), @@ -2373,7 +2373,7 @@ Module( func: Name( ExprName { range: 2192..2196, - id: "open", + id: Name("open"), ctx: Load, }, ), @@ -2434,7 +2434,7 @@ Module( Name( ExprName { range: 2223..2224, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -2472,7 +2472,7 @@ Module( Name( ExprName { range: 2244..2245, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -2509,7 +2509,7 @@ Module( value: Name( ExprName { range: 2270..2271, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -2545,7 +2545,7 @@ Module( value: Name( ExprName { range: 2296..2297, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -2582,7 +2582,7 @@ Module( Name( ExprName { range: 2317..2318, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -2593,7 +2593,7 @@ Module( Name( ExprName { range: 2323..2324, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -2632,7 +2632,7 @@ Module( Name( ExprName { range: 2342..2343, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -2648,7 +2648,7 @@ Module( Name( ExprName { range: 2349..2350, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -2720,7 +2720,7 @@ Module( Name( ExprName { range: 2765..2766, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -2758,7 +2758,7 @@ Module( target: Name( ExprName { range: 2778..2782, - id: "item", + id: Name("item"), ctx: Store, }, ), @@ -2819,7 +2819,7 @@ Module( target: Name( ExprName { range: 2805..2809, - id: "item", + id: Name("item"), ctx: Store, }, ), @@ -2872,7 +2872,7 @@ Module( target: Name( ExprName { range: 2827..2832, - id: "item1", + id: Name("item1"), ctx: Store, }, ), @@ -2889,7 +2889,7 @@ Module( Name( ExprName { range: 2840..2845, - id: "item2", + id: Name("item2"), ctx: Load, }, ), @@ -2929,7 +2929,7 @@ Module( Name( ExprName { range: 2858..2863, - id: "item1", + id: Name("item1"), ctx: Load, }, ), @@ -2939,7 +2939,7 @@ Module( target: Name( ExprName { range: 2865..2870, - id: "item2", + id: Name("item2"), ctx: Store, }, ), @@ -2956,7 +2956,7 @@ Module( Name( ExprName { range: 2877..2882, - id: "item3", + id: Name("item3"), ctx: Load, }, ), @@ -2969,7 +2969,7 @@ Module( Name( ExprName { range: 2887..2888, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -3004,7 +3004,7 @@ Module( Name( ExprName { range: 2900..2904, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -3017,7 +3017,7 @@ Module( Name( ExprName { range: 2910..2911, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -3055,7 +3055,7 @@ Module( value: Name( ExprName { range: 2924..2928, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -3101,7 +3101,7 @@ Module( value: Name( ExprName { range: 2943..2947, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -3117,7 +3117,7 @@ Module( Name( ExprName { range: 2953..2954, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -3152,14 +3152,14 @@ 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 +3172,7 @@ Module( Name( ExprName { range: 2983..2984, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -3207,14 +3207,14 @@ 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 +3227,7 @@ Module( Name( ExprName { range: 3014..3015, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -3262,14 +3262,14 @@ 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 +3285,7 @@ Module( context_expr: Name( ExprName { range: 3042..3047, - id: "item3", + id: Name("item3"), ctx: Load, }, ), @@ -3324,14 +3324,14 @@ 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 +3343,7 @@ Module( Name( ExprName { range: 3075..3080, - id: "item3", + id: Name("item3"), ctx: Load, }, ), @@ -3356,7 +3356,7 @@ Module( Name( ExprName { range: 3085..3086, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -3391,7 +3391,7 @@ Module( Name( ExprName { range: 3098..3103, - id: "item1", + id: Name("item1"), ctx: Load, }, ), @@ -3407,7 +3407,7 @@ Module( context_expr: Name( ExprName { range: 3107..3112, - id: "item2", + id: Name("item2"), ctx: Load, }, ), @@ -3422,14 +3422,14 @@ 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 +3442,7 @@ Module( Name( ExprName { range: 3132..3133, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -3477,14 +3477,14 @@ 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 +3497,7 @@ Module( Name( ExprName { range: 3162..3164, - id: "f1", + id: Name("f1"), ctx: Store, }, ), @@ -3508,7 +3508,7 @@ Module( context_expr: Name( ExprName { range: 3166..3171, - id: "item3", + id: Name("item3"), ctx: Load, }, ), @@ -3516,7 +3516,7 @@ Module( Name( ExprName { range: 3175..3177, - id: "f2", + id: Name("f2"), ctx: Store, }, ), @@ -3551,7 +3551,7 @@ Module( Name( ExprName { range: 3189..3194, - id: "item1", + id: Name("item1"), ctx: Load, }, ), @@ -3561,7 +3561,7 @@ Module( value: Name( ExprName { range: 3197..3202, - id: "item2", + id: Name("item2"), ctx: Load, }, ), @@ -3604,7 +3604,7 @@ Module( Name( ExprName { range: 3215..3220, - id: "item1", + id: Name("item1"), ctx: Load, }, ), @@ -3614,7 +3614,7 @@ Module( value: Name( ExprName { range: 3223..3228, - id: "item2", + id: Name("item2"), ctx: Load, }, ), @@ -3630,7 +3630,7 @@ Module( Name( ExprName { range: 3233..3234, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -3668,7 +3668,7 @@ Module( target: Name( ExprName { range: 3246..3251, - id: "item1", + id: Name("item1"), ctx: Store, }, ), @@ -3688,7 +3688,7 @@ Module( value: Name( ExprName { range: 3260..3265, - id: "item2", + id: Name("item2"), ctx: Load, }, ), @@ -3734,7 +3734,7 @@ Module( target: Name( ExprName { range: 3279..3284, - id: "item1", + id: Name("item1"), ctx: Store, }, ), @@ -3754,7 +3754,7 @@ Module( value: Name( ExprName { range: 3294..3299, - id: "item2", + id: Name("item2"), ctx: Load, }, ), @@ -3796,7 +3796,7 @@ Module( elt: Name( ExprName { range: 3516..3517, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -3806,7 +3806,7 @@ Module( target: Name( ExprName { range: 3522..3523, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -3816,7 +3816,7 @@ Module( func: Name( ExprName { range: 3527..3532, - id: "range", + id: Name("range"), ctx: Load, }, ), @@ -3873,7 +3873,7 @@ Module( elt: Name( ExprName { range: 3549..3550, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -3883,7 +3883,7 @@ Module( target: Name( ExprName { range: 3561..3562, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -3893,7 +3893,7 @@ Module( func: Name( ExprName { range: 3566..3571, - id: "range", + id: Name("range"), ctx: Load, }, ), @@ -3950,7 +3950,7 @@ Module( elt: Name( ExprName { range: 3588..3589, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -3960,7 +3960,7 @@ Module( target: Name( ExprName { range: 3594..3595, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -3970,7 +3970,7 @@ Module( func: Name( ExprName { range: 3599..3604, - id: "range", + id: Name("range"), ctx: Load, }, ), @@ -4004,7 +4004,7 @@ 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 e8e067797ddce..52cf9055be13d 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,14 @@ 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 +36,14 @@ 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 +66,7 @@ Module( target: Name( ExprName { range: 19..20, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -102,7 +102,7 @@ Module( target: Name( ExprName { range: 29..30, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -115,14 +115,14 @@ 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 +133,7 @@ Module( right: Name( ExprName { range: 45..48, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -167,7 +167,7 @@ Module( target: Name( ExprName { range: 56..57, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -183,14 +183,14 @@ 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 +215,7 @@ Module( target: Name( ExprName { range: 84..85, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -232,7 +232,7 @@ Module( parameter: Parameter { range: 94..95, name: Identifier { - id: "x", + id: Name("x"), range: 94..95, }, annotation: None, @@ -248,7 +248,7 @@ 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 28fa1f948839f..efffa253aa5a9 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,7 @@ Module( func: Name( ExprName { range: 20..24, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -75,14 +75,14 @@ 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 +108,7 @@ Module( parameter: Parameter { range: 56..57, name: Identifier { - id: "x", + id: Name("x"), range: 56..57, }, annotation: None, @@ -124,7 +124,7 @@ Module( body: Name( ExprName { range: 59..60, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -142,7 +142,7 @@ Module( value: Name( ExprName { range: 74..75, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -166,14 +166,14 @@ 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 +188,7 @@ Module( test: Name( ExprName { range: 108..109, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -220,7 +220,7 @@ Module( test: Name( ExprName { range: 126..127, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -238,7 +238,7 @@ Module( parameter: Parameter { range: 136..137, name: Identifier { - id: "x", + id: Name("x"), range: 136..137, }, annotation: None, @@ -254,7 +254,7 @@ Module( body: Name( ExprName { range: 139..140, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -269,7 +269,7 @@ Module( test: Name( ExprName { range: 148..149, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -280,7 +280,7 @@ Module( value: Name( ExprName { range: 157..158, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -295,7 +295,7 @@ Module( test: Name( ExprName { range: 166..167, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -312,14 +312,14 @@ 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 fc6bd9d7b8d5e..da466356e5199 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,7 @@ Module( Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -67,14 +67,14 @@ 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 +130,14 @@ 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 +191,12 @@ 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 +248,14 @@ 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 +309,7 @@ Module( Name( ExprName { range: 91..92, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -319,7 +319,7 @@ Module( value: Name( ExprName { range: 95..96, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -377,7 +377,7 @@ Module( value: Name( ExprName { range: 260..263, - id: "foo", + id: Name("foo"), ctx: Store, }, ), @@ -406,21 +406,21 @@ 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 +474,21 @@ 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 +543,7 @@ Module( value: Name( ExprName { range: 315..316, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -616,7 +616,7 @@ Module( value: Name( ExprName { range: 431..432, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -741,12 +741,12 @@ 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 +789,7 @@ Module( }, ), attr: Identifier { - id: "y", + id: Name("y"), range: 675..676, }, ctx: Store, @@ -813,7 +813,7 @@ Module( Name( ExprName { range: 683..686, - id: "foo", + id: Name("foo"), ctx: Store, }, ), @@ -846,7 +846,7 @@ Module( value: Name( ExprName { range: 699..703, - id: "data", + id: Name("data"), ctx: Load, }, ), @@ -874,7 +874,7 @@ Module( value: Name( ExprName { range: 710..714, - id: "data", + id: Name("data"), ctx: Load, }, ), @@ -894,14 +894,14 @@ 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 +914,7 @@ Module( value: Name( ExprName { range: 722..724, - id: "ab", + id: Name("ab"), ctx: Load, }, ), @@ -927,14 +927,14 @@ 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 +942,7 @@ 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 1e995986d3491..6b5b9e25823b5 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,7 @@ Module( target: Name( ExprName { range: 0..1, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -39,12 +39,12 @@ 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 +95,14 @@ 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 +151,7 @@ Module( target: Name( ExprName { range: 86..87, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -172,7 +172,7 @@ Module( target: Name( ExprName { range: 93..94, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -193,7 +193,7 @@ Module( target: Name( ExprName { range: 100..101, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -214,7 +214,7 @@ Module( target: Name( ExprName { range: 107..108, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -235,7 +235,7 @@ Module( target: Name( ExprName { range: 114..115, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -256,7 +256,7 @@ Module( target: Name( ExprName { range: 122..123, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -277,7 +277,7 @@ Module( target: Name( ExprName { range: 129..130, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -298,7 +298,7 @@ Module( target: Name( ExprName { range: 137..138, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -319,7 +319,7 @@ Module( target: Name( ExprName { range: 144..145, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -340,7 +340,7 @@ Module( target: Name( ExprName { range: 151..152, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -361,7 +361,7 @@ Module( target: Name( ExprName { range: 158..159, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -382,7 +382,7 @@ Module( target: Name( ExprName { range: 166..167, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -403,7 +403,7 @@ Module( target: Name( ExprName { range: 174..175, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -424,7 +424,7 @@ Module( target: Name( ExprName { range: 190..191, - id: "a", + id: Name("a"), ctx: Store, }, ), @@ -438,7 +438,7 @@ Module( left: Name( ExprName { range: 197..198, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -446,7 +446,7 @@ Module( right: Name( ExprName { range: 201..202, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -459,7 +459,7 @@ 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 0da461c58410c..1bf6e9f03e411 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,7 @@ Module( range: 0..19, decorator_list: [], name: Identifier { - id: "Test", + id: Name("Test"), range: 6..10, }, type_params: None, @@ -38,7 +38,7 @@ Module( range: 22..80, decorator_list: [], name: Identifier { - id: "Test", + id: Name("Test"), range: 28..32, }, type_params: None, @@ -56,7 +56,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "__init__", + id: Name("__init__"), range: 48..56, }, type_params: None, @@ -69,7 +69,7 @@ Module( parameter: Parameter { range: 57..61, name: Identifier { - id: "self", + id: Name("self"), range: 57..61, }, annotation: None, @@ -99,7 +99,7 @@ Module( range: 83..116, decorator_list: [], name: Identifier { - id: "Test", + id: Name("Test"), range: 89..93, }, type_params: None, @@ -113,7 +113,7 @@ Module( value: Name( ExprName { range: 100..101, - id: "A", + id: Name("A"), ctx: Load, }, ), @@ -126,7 +126,7 @@ Module( range: 94..97, arg: Some( Identifier { - id: "a", + id: Name("a"), range: 94..95, }, ), @@ -145,7 +145,7 @@ Module( value: Name( ExprName { range: 105..106, - id: "k", + id: Name("k"), ctx: Load, }, ), @@ -172,7 +172,7 @@ Module( range: 119..168, decorator_list: [], name: Identifier { - id: "Test", + id: Name("Test"), range: 125..129, }, type_params: None, @@ -184,7 +184,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "method", + id: Name("method"), range: 139..145, }, type_params: None, @@ -209,14 +209,14 @@ 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 +229,7 @@ Module( value: Name( ExprName { range: 164..168, - id: "data", + id: Name("data"), ctx: Load, }, ), @@ -246,7 +246,7 @@ Module( range: 171..289, decorator_list: [], name: Identifier { - id: "Test", + id: Name("Test"), range: 177..181, }, type_params: None, @@ -257,14 +257,14 @@ 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 +279,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "__init__", + id: Name("__init__"), range: 197..205, }, type_params: None, @@ -292,7 +292,7 @@ Module( parameter: Parameter { range: 206..210, name: Identifier { - id: "self", + id: Name("self"), range: 206..210, }, annotation: None, @@ -320,7 +320,7 @@ 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 +333,7 @@ Module( parameter: Parameter { range: 255..259, name: Identifier { - id: "self", + id: Name("self"), range: 255..259, }, annotation: None, @@ -345,7 +345,7 @@ Module( parameter: Parameter { range: 261..264, name: Identifier { - id: "arg", + id: Name("arg"), range: 261..264, }, annotation: None, @@ -394,7 +394,7 @@ Module( range: 331..351, decorator_list: [], name: Identifier { - id: "Test", + id: Name("Test"), range: 337..341, }, type_params: Some( @@ -405,7 +405,7 @@ Module( TypeParamTypeVar { range: 342..343, name: Identifier { - id: "T", + id: Name("T"), range: 342..343, }, bound: None, @@ -441,7 +441,7 @@ Module( range: 376..402, decorator_list: [], name: Identifier { - id: "Test", + id: Name("Test"), range: 382..386, }, type_params: Some( @@ -452,7 +452,7 @@ Module( TypeParamTypeVar { range: 387..394, name: Identifier { - id: "T", + id: Name("T"), range: 387..388, }, bound: None, @@ -460,7 +460,7 @@ Module( Name( ExprName { range: 391..394, - id: "str", + id: Name("str"), ctx: Load, }, ), @@ -496,7 +496,7 @@ Module( range: 425..450, decorator_list: [], name: Identifier { - id: "Test", + id: Name("Test"), range: 431..435, }, type_params: Some( @@ -507,14 +507,14 @@ 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 +551,7 @@ Module( range: 485..522, decorator_list: [], name: Identifier { - id: "Test", + id: Name("Test"), range: 491..495, }, type_params: Some( @@ -562,7 +562,7 @@ Module( TypeParamTypeVar { range: 496..514, name: Identifier { - id: "T", + id: Name("T"), range: 496..497, }, bound: Some( @@ -572,7 +572,7 @@ Module( left: Name( ExprName { range: 499..502, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -580,7 +580,7 @@ Module( right: Name( ExprName { range: 505..508, - id: "str", + id: Name("str"), ctx: Load, }, ), @@ -591,7 +591,7 @@ Module( Name( ExprName { range: 511..514, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -627,7 +627,7 @@ Module( range: 551..585, decorator_list: [], name: Identifier { - id: "Test", + id: Name("Test"), range: 557..561, }, type_params: Some( @@ -638,7 +638,7 @@ Module( TypeParamTypeVar { range: 562..577, name: Identifier { - id: "T", + id: Name("T"), range: 562..563, }, bound: Some( @@ -649,14 +649,14 @@ 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 +698,7 @@ Module( range: 606..629, decorator_list: [], name: Identifier { - id: "Test", + id: Name("Test"), range: 612..616, }, type_params: Some( @@ -709,7 +709,7 @@ Module( TypeParamTypeVar { range: 617..618, name: Identifier { - id: "T", + id: Name("T"), range: 617..618, }, bound: None, @@ -720,7 +720,7 @@ Module( TypeParamTypeVar { range: 620..621, name: Identifier { - id: "U", + id: Name("U"), range: 620..621, }, bound: None, @@ -756,7 +756,7 @@ Module( range: 648..672, decorator_list: [], name: Identifier { - id: "Test", + id: Name("Test"), range: 654..658, }, type_params: Some( @@ -767,7 +767,7 @@ Module( TypeParamTypeVar { range: 659..660, name: Identifier { - id: "T", + id: Name("T"), range: 659..660, }, bound: None, @@ -778,7 +778,7 @@ Module( TypeParamTypeVar { range: 662..663, name: Identifier { - id: "U", + id: Name("U"), range: 662..663, }, bound: None, @@ -814,7 +814,7 @@ Module( range: 689..711, decorator_list: [], name: Identifier { - id: "Test", + id: Name("Test"), range: 695..699, }, type_params: Some( @@ -825,7 +825,7 @@ Module( TypeParamTypeVarTuple { range: 700..703, name: Identifier { - id: "Ts", + id: Name("Ts"), range: 701..703, }, default: None, @@ -860,7 +860,7 @@ Module( range: 741..789, decorator_list: [], name: Identifier { - id: "Test", + id: Name("Test"), range: 747..751, }, type_params: Some( @@ -871,7 +871,7 @@ Module( TypeParamTypeVarTuple { range: 752..781, name: Identifier { - id: "Ts", + id: Name("Ts"), range: 753..755, }, default: Some( @@ -881,7 +881,7 @@ Module( value: Name( ExprName { range: 758..764, - id: "Unpack", + id: Name("Unpack"), ctx: Load, }, ), @@ -891,7 +891,7 @@ Module( value: Name( ExprName { range: 765..770, - id: "tuple", + id: Name("tuple"), ctx: Load, }, ), @@ -902,14 +902,14 @@ 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 +956,7 @@ Module( range: 827..868, decorator_list: [], name: Identifier { - id: "Test", + id: Name("Test"), range: 833..837, }, type_params: Some( @@ -967,7 +967,7 @@ Module( TypeParamTypeVarTuple { range: 838..860, name: Identifier { - id: "Ts", + id: Name("Ts"), range: 839..841, }, default: Some( @@ -980,7 +980,7 @@ Module( value: Name( ExprName { range: 845..850, - id: "tuple", + id: Name("tuple"), ctx: Load, }, ), @@ -991,14 +991,14 @@ 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 +1045,7 @@ Module( range: 882..904, decorator_list: [], name: Identifier { - id: "Test", + id: Name("Test"), range: 888..892, }, type_params: Some( @@ -1056,7 +1056,7 @@ Module( TypeParamParamSpec { range: 893..896, name: Identifier { - id: "P", + id: Name("P"), range: 895..896, }, default: None, @@ -1091,7 +1091,7 @@ Module( range: 931..966, decorator_list: [], name: Identifier { - id: "Test", + id: Name("Test"), range: 937..941, }, type_params: Some( @@ -1102,7 +1102,7 @@ Module( TypeParamParamSpec { range: 942..958, name: Identifier { - id: "P", + id: Name("P"), range: 944..945, }, default: Some( @@ -1113,14 +1113,14 @@ 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 +1160,7 @@ Module( range: 982..1022, decorator_list: [], name: Identifier { - id: "Test", + id: Name("Test"), range: 988..992, }, type_params: Some( @@ -1171,7 +1171,7 @@ Module( TypeParamTypeVar { range: 993..994, name: Identifier { - id: "X", + id: Name("X"), range: 993..994, }, bound: None, @@ -1182,14 +1182,14 @@ 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 +1201,7 @@ Module( TypeParamTypeVarTuple { range: 1004..1006, name: Identifier { - id: "U", + id: Name("U"), range: 1005..1006, }, default: None, @@ -1211,7 +1211,7 @@ 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 68494f4681372..ac37e09701198 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,7 @@ Module( Name( ExprName { range: 4..5, - id: "x", + id: Name("x"), ctx: Del, }, ), @@ -30,7 +30,7 @@ Module( Name( ExprName { range: 11..12, - id: "x", + id: Name("x"), ctx: Del, }, ), @@ -44,14 +44,14 @@ 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 +65,7 @@ Module( Name( ExprName { range: 28..29, - id: "a", + id: Name("a"), ctx: Del, }, ), @@ -76,14 +76,14 @@ 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 +95,7 @@ Module( Name( ExprName { range: 39..40, - id: "d", + id: Name("d"), ctx: Del, }, ), @@ -113,14 +113,14 @@ 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 +142,7 @@ Module( Name( ExprName { range: 57..58, - id: "a", + id: Name("a"), ctx: Del, }, ), @@ -153,14 +153,14 @@ 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 +171,7 @@ Module( Name( ExprName { range: 68..69, - id: "d", + id: Name("d"), ctx: Del, }, ), @@ -192,12 +192,12 @@ 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 +216,14 @@ 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 +244,7 @@ Module( Name( ExprName { range: 98..99, - id: "x", + id: Name("x"), ctx: Del, }, ), @@ -254,12 +254,12 @@ 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 +271,14 @@ 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 2eaca10f37a7c..721da442b2dbe 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,14 @@ 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 +44,7 @@ Module( target: Name( ExprName { range: 34..40, - id: "target", + id: Name("target"), ctx: Store, }, ), @@ -101,12 +101,12 @@ 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 +118,7 @@ Module( func: Name( ExprName { range: 84..88, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -149,7 +149,7 @@ Module( value: Name( ExprName { range: 106..112, - id: "target", + id: Name("target"), ctx: Load, }, ), @@ -170,12 +170,12 @@ 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 +198,7 @@ Module( target: Name( ExprName { range: 141..147, - id: "target", + id: Name("target"), ctx: Store, }, ), @@ -208,7 +208,7 @@ Module( left: Name( ExprName { range: 151..152, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -219,7 +219,7 @@ Module( Name( ExprName { range: 156..157, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -243,7 +243,7 @@ Module( target: Name( ExprName { range: 173..179, - id: "target", + id: Name("target"), ctx: Store, }, ), @@ -255,14 +255,14 @@ 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 +290,21 @@ 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 +316,7 @@ Module( iter: Name( ExprName { range: 218..222, - id: "iter", + id: Name("iter"), ctx: Load, }, ), @@ -341,14 +341,14 @@ 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 +360,7 @@ Module( iter: Name( ExprName { range: 248..252, - id: "iter", + id: Name("iter"), ctx: Load, }, ), @@ -381,7 +381,7 @@ Module( target: Name( ExprName { range: 268..274, - id: "target", + id: Name("target"), ctx: Store, }, ), @@ -394,12 +394,12 @@ 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 +425,7 @@ Module( target: Name( ExprName { range: 301..307, - id: "target", + id: Name("target"), ctx: Store, }, ), @@ -473,7 +473,7 @@ Module( value: Name( ExprName { range: 334..340, - id: "target", + id: Name("target"), ctx: Store, }, ), @@ -487,21 +487,21 @@ 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 +533,7 @@ Module( target: Name( ExprName { range: 383..389, - id: "target", + id: Name("target"), ctx: Store, }, ), @@ -546,7 +546,7 @@ Module( left: Name( ExprName { range: 394..395, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -554,7 +554,7 @@ Module( right: Name( ExprName { range: 398..399, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -585,7 +585,7 @@ Module( target: Name( ExprName { range: 409..415, - id: "target", + id: Name("target"), ctx: Store, }, ), @@ -598,7 +598,7 @@ Module( value: Name( ExprName { range: 426..427, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -629,7 +629,7 @@ Module( target: Name( ExprName { range: 437..443, - id: "target", + id: Name("target"), ctx: Store, }, ), @@ -639,7 +639,7 @@ Module( value: Name( ExprName { range: 453..454, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -667,7 +667,7 @@ Module( target: Name( ExprName { range: 464..470, - id: "target", + id: Name("target"), ctx: Store, }, ), @@ -684,7 +684,7 @@ Module( parameter: Parameter { range: 481..482, name: Identifier { - id: "x", + id: Name("x"), range: 481..482, }, annotation: None, @@ -700,7 +700,7 @@ Module( body: Name( ExprName { range: 484..485, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -728,7 +728,7 @@ Module( target: Name( ExprName { range: 495..501, - id: "target", + id: Name("target"), ctx: Store, }, ), @@ -744,14 +744,14 @@ 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 +778,7 @@ Module( test: Name( ExprName { range: 531..532, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -790,14 +790,14 @@ 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 4e64f74abfb30..1fa1095351b46 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,7 @@ Module( range: 0..15, module: Some( Identifier { - id: "a", + id: Name("a"), range: 5..6, }, ), @@ -22,7 +22,7 @@ Module( Alias { range: 14..15, name: Identifier { - id: "b", + id: Name("b"), range: 14..15, }, asname: None, @@ -39,7 +39,7 @@ Module( Alias { range: 41..42, name: Identifier { - id: "a", + id: Name("a"), range: 41..42, }, asname: None, @@ -53,7 +53,7 @@ Module( range: 43..85, module: Some( Identifier { - id: "foo.bar", + id: Name("foo.bar"), range: 48..55, }, ), @@ -61,12 +61,12 @@ 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 +74,12 @@ 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 +93,7 @@ Module( range: 86..102, module: Some( Identifier { - id: "a", + id: Name("a"), range: 92..93, }, ), @@ -101,7 +101,7 @@ Module( Alias { range: 101..102, name: Identifier { - id: "b", + id: Name("b"), range: 101..102, }, asname: None, @@ -118,7 +118,7 @@ Module( Alias { range: 119..120, name: Identifier { - id: "c", + id: Name("c"), range: 119..120, }, asname: None, @@ -135,7 +135,7 @@ Module( Alias { range: 160..161, name: Identifier { - id: "d", + id: Name("d"), range: 160..161, }, asname: None, @@ -149,7 +149,7 @@ Module( range: 162..207, module: Some( Identifier { - id: "a.b.c", + id: Name("a.b.c"), range: 193..198, }, ), @@ -157,7 +157,7 @@ Module( Alias { range: 206..207, name: Identifier { - id: "d", + id: Name("d"), range: 206..207, }, asname: None, @@ -171,7 +171,7 @@ Module( range: 208..242, module: Some( Identifier { - id: "module", + id: Name("module"), range: 213..219, }, ), @@ -179,7 +179,7 @@ Module( Alias { range: 228..229, name: Identifier { - id: "a", + id: Name("a"), range: 228..229, }, asname: None, @@ -187,12 +187,12 @@ 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 +200,7 @@ Module( Alias { range: 239..240, name: Identifier { - id: "c", + id: Name("c"), range: 239..240, }, asname: None, @@ -214,7 +214,7 @@ Module( range: 243..258, module: Some( Identifier { - id: "a", + id: Name("a"), range: 248..249, }, ), @@ -222,7 +222,7 @@ 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 3f741ebf3321d..2124ada639c52 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,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "no_parameters", + id: Name("no_parameters"), range: 4..17, }, type_params: None, @@ -43,7 +43,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "positional_parameters", + id: Name("positional_parameters"), range: 36..57, }, type_params: None, @@ -56,7 +56,7 @@ Module( parameter: Parameter { range: 58..59, name: Identifier { - id: "a", + id: Name("a"), range: 58..59, }, annotation: None, @@ -68,7 +68,7 @@ Module( parameter: Parameter { range: 61..62, name: Identifier { - id: "b", + id: Name("b"), range: 61..62, }, annotation: None, @@ -80,7 +80,7 @@ Module( parameter: Parameter { range: 64..65, name: Identifier { - id: "c", + id: Name("c"), range: 64..65, }, annotation: None, @@ -108,7 +108,7 @@ 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 +121,7 @@ Module( parameter: Parameter { range: 125..126, name: Identifier { - id: "a", + id: Name("a"), range: 125..126, }, annotation: None, @@ -133,7 +133,7 @@ Module( parameter: Parameter { range: 128..129, name: Identifier { - id: "b", + id: Name("b"), range: 128..129, }, annotation: None, @@ -154,7 +154,7 @@ Module( parameter: Parameter { range: 134..135, name: Identifier { - id: "c", + id: Name("c"), range: 134..135, }, annotation: None, @@ -191,7 +191,7 @@ 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 +203,7 @@ Module( parameter: Parameter { range: 199..200, name: Identifier { - id: "a", + id: Name("a"), range: 199..200, }, annotation: None, @@ -215,7 +215,7 @@ Module( parameter: Parameter { range: 202..203, name: Identifier { - id: "b", + id: Name("b"), range: 202..203, }, annotation: None, @@ -238,7 +238,7 @@ Module( parameter: Parameter { range: 211..212, name: Identifier { - id: "c", + id: Name("c"), range: 211..212, }, annotation: None, @@ -275,7 +275,7 @@ 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 +287,7 @@ Module( parameter: Parameter { range: 275..276, name: Identifier { - id: "a", + id: Name("a"), range: 275..276, }, annotation: None, @@ -301,7 +301,7 @@ Module( parameter: Parameter { range: 281..282, name: Identifier { - id: "b", + id: Name("b"), range: 281..282, }, annotation: None, @@ -313,7 +313,7 @@ Module( parameter: Parameter { range: 284..285, name: Identifier { - id: "c", + id: Name("c"), range: 284..285, }, annotation: None, @@ -341,7 +341,7 @@ 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 +353,7 @@ Module( parameter: Parameter { range: 349..350, name: Identifier { - id: "a", + id: Name("a"), range: 349..350, }, annotation: None, @@ -365,7 +365,7 @@ Module( parameter: Parameter { range: 352..353, name: Identifier { - id: "b", + id: Name("b"), range: 352..353, }, annotation: None, @@ -388,7 +388,7 @@ Module( parameter: Parameter { range: 361..362, name: Identifier { - id: "c", + id: Name("c"), range: 361..362, }, annotation: None, @@ -409,7 +409,7 @@ Module( Parameter { range: 367..372, name: Identifier { - id: "args", + id: Name("args"), range: 368..372, }, annotation: None, @@ -420,7 +420,7 @@ Module( Parameter { range: 374..382, name: Identifier { - id: "kwargs", + id: Name("kwargs"), range: 376..382, }, annotation: None, @@ -443,7 +443,7 @@ 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 +458,7 @@ Module( parameter: Parameter { range: 427..428, name: Identifier { - id: "a", + id: Name("a"), range: 427..428, }, annotation: None, @@ -470,7 +470,7 @@ Module( parameter: Parameter { range: 430..431, name: Identifier { - id: "b", + id: Name("b"), range: 430..431, }, annotation: None, @@ -482,7 +482,7 @@ Module( parameter: Parameter { range: 433..434, name: Identifier { - id: "c", + id: Name("c"), range: 433..434, }, annotation: None, @@ -508,7 +508,7 @@ 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 +523,7 @@ Module( parameter: Parameter { range: 493..494, name: Identifier { - id: "a", + id: Name("a"), range: 493..494, }, annotation: None, @@ -535,7 +535,7 @@ Module( parameter: Parameter { range: 496..497, name: Identifier { - id: "b", + id: Name("b"), range: 496..497, }, annotation: None, @@ -556,7 +556,7 @@ Module( parameter: Parameter { range: 502..503, name: Identifier { - id: "c", + id: Name("c"), range: 502..503, }, annotation: None, @@ -591,7 +591,7 @@ 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 +603,7 @@ Module( Parameter { range: 563..568, name: Identifier { - id: "args", + id: Name("args"), range: 564..568, }, annotation: None, @@ -615,7 +615,7 @@ Module( parameter: Parameter { range: 570..571, name: Identifier { - id: "a", + id: Name("a"), range: 570..571, }, annotation: None, @@ -627,7 +627,7 @@ Module( parameter: Parameter { range: 573..574, name: Identifier { - id: "b", + id: Name("b"), range: 573..574, }, annotation: None, @@ -648,7 +648,7 @@ Module( parameter: Parameter { range: 579..580, name: Identifier { - id: "c", + id: Name("c"), range: 579..580, }, annotation: None, @@ -683,7 +683,7 @@ 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 +698,7 @@ Module( parameter: Parameter { range: 642..643, name: Identifier { - id: "a", + id: Name("a"), range: 642..643, }, annotation: None, @@ -710,7 +710,7 @@ Module( parameter: Parameter { range: 645..646, name: Identifier { - id: "b", + id: Name("b"), range: 645..646, }, annotation: None, @@ -731,7 +731,7 @@ Module( parameter: Parameter { range: 651..652, name: Identifier { - id: "c", + id: Name("c"), range: 651..652, }, annotation: None, @@ -752,7 +752,7 @@ Module( Parameter { range: 657..665, name: Identifier { - id: "kwargs", + id: Name("kwargs"), range: 659..665, }, annotation: None, @@ -775,7 +775,7 @@ 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 +787,7 @@ Module( Parameter { range: 733..738, name: Identifier { - id: "args", + id: Name("args"), range: 734..738, }, annotation: None, @@ -799,7 +799,7 @@ Module( parameter: Parameter { range: 740..741, name: Identifier { - id: "a", + id: Name("a"), range: 740..741, }, annotation: None, @@ -811,7 +811,7 @@ Module( parameter: Parameter { range: 743..744, name: Identifier { - id: "b", + id: Name("b"), range: 743..744, }, annotation: None, @@ -832,7 +832,7 @@ Module( parameter: Parameter { range: 749..750, name: Identifier { - id: "c", + id: Name("c"), range: 749..750, }, annotation: None, @@ -853,7 +853,7 @@ Module( Parameter { range: 755..763, name: Identifier { - id: "kwargs", + id: Name("kwargs"), range: 757..763, }, annotation: None, @@ -876,7 +876,7 @@ 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 +888,7 @@ Module( parameter: Parameter { range: 802..803, name: Identifier { - id: "a", + id: Name("a"), range: 802..803, }, annotation: None, @@ -900,7 +900,7 @@ Module( parameter: Parameter { range: 805..806, name: Identifier { - id: "b", + id: Name("b"), range: 805..806, }, annotation: None, @@ -914,7 +914,7 @@ Module( parameter: Parameter { range: 811..812, name: Identifier { - id: "c", + id: Name("c"), range: 811..812, }, annotation: None, @@ -929,7 +929,7 @@ Module( parameter: Parameter { range: 817..818, name: Identifier { - id: "d", + id: Name("d"), range: 817..818, }, annotation: None, @@ -941,7 +941,7 @@ Module( parameter: Parameter { range: 820..821, name: Identifier { - id: "e", + id: Name("e"), range: 820..821, }, annotation: None, @@ -953,7 +953,7 @@ Module( parameter: Parameter { range: 823..824, name: Identifier { - id: "f", + id: Name("f"), range: 823..824, }, annotation: None, @@ -979,7 +979,7 @@ 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 +991,7 @@ Module( parameter: Parameter { range: 877..878, name: Identifier { - id: "a", + id: Name("a"), range: 877..878, }, annotation: None, @@ -1003,7 +1003,7 @@ Module( parameter: Parameter { range: 880..881, name: Identifier { - id: "b", + id: Name("b"), range: 880..881, }, annotation: None, @@ -1017,7 +1017,7 @@ Module( parameter: Parameter { range: 886..887, name: Identifier { - id: "c", + id: Name("c"), range: 886..887, }, annotation: None, @@ -1032,7 +1032,7 @@ Module( parameter: Parameter { range: 892..893, name: Identifier { - id: "d", + id: Name("d"), range: 892..893, }, annotation: None, @@ -1044,7 +1044,7 @@ Module( parameter: Parameter { range: 895..896, name: Identifier { - id: "e", + id: Name("e"), range: 895..896, }, annotation: None, @@ -1065,7 +1065,7 @@ Module( parameter: Parameter { range: 901..902, name: Identifier { - id: "f", + id: Name("f"), range: 901..902, }, annotation: None, @@ -1100,7 +1100,7 @@ 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 +1112,7 @@ Module( parameter: Parameter { range: 970..971, name: Identifier { - id: "a", + id: Name("a"), range: 970..971, }, annotation: None, @@ -1124,7 +1124,7 @@ Module( parameter: Parameter { range: 973..974, name: Identifier { - id: "b", + id: Name("b"), range: 973..974, }, annotation: None, @@ -1138,7 +1138,7 @@ Module( parameter: Parameter { range: 979..980, name: Identifier { - id: "c", + id: Name("c"), range: 979..980, }, annotation: None, @@ -1150,7 +1150,7 @@ Module( Parameter { range: 982..987, name: Identifier { - id: "args", + id: Name("args"), range: 983..987, }, annotation: None, @@ -1162,7 +1162,7 @@ Module( parameter: Parameter { range: 989..990, name: Identifier { - id: "d", + id: Name("d"), range: 989..990, }, annotation: None, @@ -1174,7 +1174,7 @@ Module( parameter: Parameter { range: 992..993, name: Identifier { - id: "e", + id: Name("e"), range: 992..993, }, annotation: None, @@ -1195,7 +1195,7 @@ Module( parameter: Parameter { range: 998..999, name: Identifier { - id: "f", + id: Name("f"), range: 998..999, }, annotation: None, @@ -1230,7 +1230,7 @@ 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 +1242,7 @@ Module( parameter: Parameter { range: 1071..1072, name: Identifier { - id: "a", + id: Name("a"), range: 1071..1072, }, annotation: None, @@ -1254,7 +1254,7 @@ Module( parameter: Parameter { range: 1074..1075, name: Identifier { - id: "b", + id: Name("b"), range: 1074..1075, }, annotation: None, @@ -1268,7 +1268,7 @@ Module( parameter: Parameter { range: 1080..1081, name: Identifier { - id: "c", + id: Name("c"), range: 1080..1081, }, annotation: None, @@ -1283,7 +1283,7 @@ Module( parameter: Parameter { range: 1086..1087, name: Identifier { - id: "d", + id: Name("d"), range: 1086..1087, }, annotation: None, @@ -1295,7 +1295,7 @@ Module( parameter: Parameter { range: 1089..1090, name: Identifier { - id: "e", + id: Name("e"), range: 1089..1090, }, annotation: None, @@ -1316,7 +1316,7 @@ Module( parameter: Parameter { range: 1095..1096, name: Identifier { - id: "f", + id: Name("f"), range: 1095..1096, }, annotation: None, @@ -1337,7 +1337,7 @@ Module( Parameter { range: 1101..1109, name: Identifier { - id: "kwargs", + id: Name("kwargs"), range: 1103..1109, }, annotation: None, @@ -1360,7 +1360,7 @@ 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 +1372,7 @@ Module( parameter: Parameter { range: 1191..1192, name: Identifier { - id: "a", + id: Name("a"), range: 1191..1192, }, annotation: None, @@ -1384,7 +1384,7 @@ Module( parameter: Parameter { range: 1194..1195, name: Identifier { - id: "b", + id: Name("b"), range: 1194..1195, }, annotation: None, @@ -1398,7 +1398,7 @@ Module( parameter: Parameter { range: 1200..1201, name: Identifier { - id: "c", + id: Name("c"), range: 1200..1201, }, annotation: None, @@ -1410,7 +1410,7 @@ Module( Parameter { range: 1203..1208, name: Identifier { - id: "args", + id: Name("args"), range: 1204..1208, }, annotation: None, @@ -1422,7 +1422,7 @@ Module( parameter: Parameter { range: 1210..1211, name: Identifier { - id: "d", + id: Name("d"), range: 1210..1211, }, annotation: None, @@ -1434,7 +1434,7 @@ Module( parameter: Parameter { range: 1213..1214, name: Identifier { - id: "e", + id: Name("e"), range: 1213..1214, }, annotation: None, @@ -1455,7 +1455,7 @@ Module( parameter: Parameter { range: 1219..1220, name: Identifier { - id: "f", + id: Name("f"), range: 1219..1220, }, annotation: None, @@ -1476,7 +1476,7 @@ Module( Parameter { range: 1225..1233, name: Identifier { - id: "kwargs", + id: Name("kwargs"), range: 1227..1233, }, annotation: None, @@ -1499,7 +1499,7 @@ 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 +1512,7 @@ Module( parameter: Parameter { range: 1286..1287, name: Identifier { - id: "a", + id: Name("a"), range: 1286..1287, }, annotation: None, @@ -1524,7 +1524,7 @@ Module( parameter: Parameter { range: 1289..1290, name: Identifier { - id: "b", + id: Name("b"), range: 1289..1290, }, annotation: None, @@ -1536,7 +1536,7 @@ Module( parameter: Parameter { range: 1292..1293, name: Identifier { - id: "c", + id: Name("c"), range: 1292..1293, }, annotation: None, @@ -1551,7 +1551,7 @@ Module( parameter: Parameter { range: 1298..1299, name: Identifier { - id: "d", + id: Name("d"), range: 1298..1299, }, annotation: None, @@ -1563,7 +1563,7 @@ Module( parameter: Parameter { range: 1301..1302, name: Identifier { - id: "e", + id: Name("e"), range: 1301..1302, }, annotation: None, @@ -1575,7 +1575,7 @@ Module( parameter: Parameter { range: 1304..1305, name: Identifier { - id: "f", + id: Name("f"), range: 1304..1305, }, annotation: None, @@ -1601,7 +1601,7 @@ 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 +1614,7 @@ Module( parameter: Parameter { range: 1371..1372, name: Identifier { - id: "a", + id: Name("a"), range: 1371..1372, }, annotation: None, @@ -1626,7 +1626,7 @@ Module( parameter: Parameter { range: 1374..1375, name: Identifier { - id: "b", + id: Name("b"), range: 1374..1375, }, annotation: None, @@ -1638,7 +1638,7 @@ Module( parameter: Parameter { range: 1377..1378, name: Identifier { - id: "c", + id: Name("c"), range: 1377..1378, }, annotation: None, @@ -1653,7 +1653,7 @@ Module( parameter: Parameter { range: 1383..1384, name: Identifier { - id: "d", + id: Name("d"), range: 1383..1384, }, annotation: None, @@ -1665,7 +1665,7 @@ Module( parameter: Parameter { range: 1386..1387, name: Identifier { - id: "e", + id: Name("e"), range: 1386..1387, }, annotation: None, @@ -1686,7 +1686,7 @@ Module( parameter: Parameter { range: 1392..1393, name: Identifier { - id: "f", + id: Name("f"), range: 1392..1393, }, annotation: None, @@ -1721,7 +1721,7 @@ 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 +1734,7 @@ Module( parameter: Parameter { range: 1479..1480, name: Identifier { - id: "a", + id: Name("a"), range: 1479..1480, }, annotation: None, @@ -1746,7 +1746,7 @@ Module( parameter: Parameter { range: 1482..1483, name: Identifier { - id: "b", + id: Name("b"), range: 1482..1483, }, annotation: None, @@ -1758,7 +1758,7 @@ Module( parameter: Parameter { range: 1485..1486, name: Identifier { - id: "c", + id: Name("c"), range: 1485..1486, }, annotation: None, @@ -1770,7 +1770,7 @@ Module( Parameter { range: 1488..1493, name: Identifier { - id: "args", + id: Name("args"), range: 1489..1493, }, annotation: None, @@ -1782,7 +1782,7 @@ Module( parameter: Parameter { range: 1495..1496, name: Identifier { - id: "d", + id: Name("d"), range: 1495..1496, }, annotation: None, @@ -1794,7 +1794,7 @@ Module( parameter: Parameter { range: 1498..1499, name: Identifier { - id: "e", + id: Name("e"), range: 1498..1499, }, annotation: None, @@ -1815,7 +1815,7 @@ Module( parameter: Parameter { range: 1504..1505, name: Identifier { - id: "f", + id: Name("f"), range: 1504..1505, }, annotation: None, @@ -1850,7 +1850,7 @@ 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 +1863,7 @@ Module( parameter: Parameter { range: 1603..1604, name: Identifier { - id: "a", + id: Name("a"), range: 1603..1604, }, annotation: None, @@ -1875,7 +1875,7 @@ Module( parameter: Parameter { range: 1606..1607, name: Identifier { - id: "b", + id: Name("b"), range: 1606..1607, }, annotation: None, @@ -1887,7 +1887,7 @@ Module( parameter: Parameter { range: 1609..1610, name: Identifier { - id: "c", + id: Name("c"), range: 1609..1610, }, annotation: None, @@ -1899,7 +1899,7 @@ Module( Parameter { range: 1612..1617, name: Identifier { - id: "args", + id: Name("args"), range: 1613..1617, }, annotation: None, @@ -1911,7 +1911,7 @@ Module( parameter: Parameter { range: 1619..1620, name: Identifier { - id: "d", + id: Name("d"), range: 1619..1620, }, annotation: None, @@ -1923,7 +1923,7 @@ Module( parameter: Parameter { range: 1622..1623, name: Identifier { - id: "e", + id: Name("e"), range: 1622..1623, }, annotation: None, @@ -1944,7 +1944,7 @@ Module( parameter: Parameter { range: 1628..1629, name: Identifier { - id: "f", + id: Name("f"), range: 1628..1629, }, annotation: None, @@ -1965,7 +1965,7 @@ Module( Parameter { range: 1634..1642, name: Identifier { - id: "kwargs", + id: Name("kwargs"), range: 1636..1642, }, annotation: None, @@ -1988,7 +1988,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "func", + id: Name("func"), range: 1707..1711, }, type_params: Some( @@ -1999,7 +1999,7 @@ Module( TypeParamTypeVar { range: 1712..1713, name: Identifier { - id: "T", + id: Name("T"), range: 1712..1713, }, bound: None, @@ -2018,14 +2018,14 @@ 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 +2042,7 @@ Module( Name( ExprName { range: 1724..1725, - id: "T", + id: Name("T"), ctx: Load, }, ), @@ -2062,7 +2062,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "func", + id: Name("func"), range: 1742..1746, }, type_params: Some( @@ -2073,14 +2073,14 @@ 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 +2100,14 @@ 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 +2124,7 @@ Module( Name( ExprName { range: 1764..1765, - id: "T", + id: Name("T"), ctx: Load, }, ), @@ -2144,7 +2144,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "func", + id: Name("func"), range: 1782..1786, }, type_params: Some( @@ -2155,7 +2155,7 @@ Module( TypeParamTypeVar { range: 1787..1802, name: Identifier { - id: "T", + id: Name("T"), range: 1787..1788, }, bound: Some( @@ -2166,14 +2166,14 @@ 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 +2198,14 @@ 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 +2222,7 @@ Module( Name( ExprName { range: 1813..1814, - id: "T", + id: Name("T"), ctx: Load, }, ), @@ -2242,7 +2242,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "func", + id: Name("func"), range: 1831..1835, }, type_params: Some( @@ -2253,7 +2253,7 @@ Module( TypeParamTypeVarTuple { range: 1836..1839, name: Identifier { - id: "Ts", + id: Name("Ts"), range: 1837..1839, }, default: None, @@ -2270,7 +2270,7 @@ Module( Parameter { range: 1841..1848, name: Identifier { - id: "a", + id: Name("a"), range: 1842..1843, }, annotation: Some( @@ -2280,7 +2280,7 @@ Module( value: Name( ExprName { range: 1846..1848, - id: "Ts", + id: Name("Ts"), ctx: Load, }, ), @@ -2300,7 +2300,7 @@ Module( value: Name( ExprName { range: 1853..1858, - id: "Tuple", + id: Name("Tuple"), ctx: Load, }, ), @@ -2314,7 +2314,7 @@ Module( value: Name( ExprName { range: 1860..1862, - id: "Ts", + id: Name("Ts"), ctx: Load, }, ), @@ -2345,7 +2345,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "func", + id: Name("func"), range: 1880..1884, }, type_params: Some( @@ -2356,7 +2356,7 @@ Module( TypeParamParamSpec { range: 1885..1888, name: Identifier { - id: "P", + id: Name("P"), range: 1887..1888, }, default: None, @@ -2373,7 +2373,7 @@ Module( Parameter { range: 1890..1903, name: Identifier { - id: "args", + id: Name("args"), range: 1891..1895, }, annotation: Some( @@ -2383,12 +2383,12 @@ 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 +2402,7 @@ Module( Parameter { range: 1905..1923, name: Identifier { - id: "kwargs", + id: Name("kwargs"), range: 1907..1913, }, annotation: Some( @@ -2412,12 +2412,12 @@ 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 +2443,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "func", + id: Name("func"), range: 1941..1945, }, type_params: Some( @@ -2454,7 +2454,7 @@ Module( TypeParamTypeVar { range: 1946..1947, name: Identifier { - id: "T", + id: Name("T"), range: 1946..1947, }, bound: None, @@ -2465,14 +2465,14 @@ 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 +2484,7 @@ Module( TypeParamTypeVarTuple { range: 1957..1960, name: Identifier { - id: "Ts", + id: Name("Ts"), range: 1958..1960, }, default: None, @@ -2494,7 +2494,7 @@ Module( TypeParamParamSpec { range: 1962..1965, name: Identifier { - id: "P", + id: Name("P"), range: 1964..1965, }, default: None, @@ -2527,7 +2527,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "ellipsis", + id: Name("ellipsis"), range: 1985..1993, }, type_params: None, @@ -2560,7 +2560,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "multiple_statements", + id: Name("multiple_statements"), range: 2007..2026, }, type_params: None, @@ -2576,7 +2576,7 @@ Module( Name( ExprName { range: 2032..2035, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -2591,7 +2591,7 @@ Module( func: Name( ExprName { range: 2041..2045, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -2628,7 +2628,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 2071..2074, }, type_params: None, @@ -2640,7 +2640,7 @@ Module( Parameter { range: 2075..2080, name: Identifier { - id: "args", + id: Name("args"), range: 2076..2080, }, annotation: None, @@ -2665,7 +2665,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 2098..2101, }, type_params: None, @@ -2679,7 +2679,7 @@ Module( Parameter { range: 2102..2110, name: Identifier { - id: "kwargs", + id: Name("kwargs"), range: 2104..2110, }, annotation: None, @@ -2702,7 +2702,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 2128..2131, }, type_params: None, @@ -2714,7 +2714,7 @@ Module( Parameter { range: 2132..2137, name: Identifier { - id: "args", + id: Name("args"), range: 2133..2137, }, annotation: None, @@ -2725,7 +2725,7 @@ Module( Parameter { range: 2139..2147, name: Identifier { - id: "kwargs", + id: Name("kwargs"), range: 2141..2147, }, annotation: None, @@ -2748,7 +2748,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 2165..2168, }, type_params: None, @@ -2760,7 +2760,7 @@ Module( parameter: Parameter { range: 2169..2170, name: Identifier { - id: "a", + id: Name("a"), range: 2169..2170, }, annotation: None, @@ -2789,7 +2789,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 2191..2194, }, type_params: None, @@ -2801,7 +2801,7 @@ Module( parameter: Parameter { range: 2195..2196, name: Identifier { - id: "a", + id: Name("a"), range: 2195..2196, }, annotation: None, @@ -2815,7 +2815,7 @@ Module( parameter: Parameter { range: 2201..2202, name: Identifier { - id: "b", + id: Name("b"), range: 2201..2202, }, annotation: None, @@ -2843,7 +2843,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 2220..2223, }, type_params: None, @@ -2855,7 +2855,7 @@ Module( parameter: Parameter { range: 2224..2225, name: Identifier { - id: "a", + id: Name("a"), range: 2224..2225, }, annotation: None, @@ -2893,7 +2893,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 2249..2252, }, type_params: None, @@ -2905,7 +2905,7 @@ Module( parameter: Parameter { range: 2253..2254, name: Identifier { - id: "a", + id: Name("a"), range: 2253..2254, }, annotation: None, @@ -2917,7 +2917,7 @@ Module( parameter: Parameter { range: 2256..2257, name: Identifier { - id: "b", + id: Name("b"), range: 2256..2257, }, annotation: None, @@ -2933,7 +2933,7 @@ Module( parameter: Parameter { range: 2265..2266, name: Identifier { - id: "c", + id: Name("c"), range: 2265..2266, }, annotation: None, @@ -2959,7 +2959,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 2284..2287, }, type_params: None, @@ -2972,7 +2972,7 @@ Module( parameter: Parameter { range: 2288..2290, name: Identifier { - id: "kw", + id: Name("kw"), range: 2288..2290, }, annotation: None, @@ -2996,7 +2996,7 @@ Module( parameter: Parameter { range: 2297..2298, name: Identifier { - id: "a", + id: Name("a"), range: 2297..2298, }, annotation: None, @@ -3022,7 +3022,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 2316..2319, }, type_params: None, @@ -3035,14 +3035,14 @@ 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 +3055,7 @@ Module( parameter: Parameter { range: 2328..2336, name: Identifier { - id: "y", + id: Name("y"), range: 2328..2329, }, annotation: Some( @@ -3086,7 +3086,7 @@ Module( parameter: Parameter { range: 2338..2346, name: Identifier { - id: "z", + id: Name("z"), range: 2338..2339, }, annotation: Some( @@ -3137,7 +3137,7 @@ Module( is_async: false, decorator_list: [], name: Identifier { - id: "foo", + id: Name("foo"), range: 2364..2367, }, type_params: None, @@ -3150,7 +3150,7 @@ Module( parameter: Parameter { range: 2368..2372, name: Identifier { - id: "self", + id: Name("self"), range: 2368..2372, }, annotation: None, @@ -3162,7 +3162,7 @@ Module( parameter: Parameter { range: 2374..2375, name: Identifier { - id: "a", + id: Name("a"), range: 2374..2375, }, annotation: None, @@ -3183,7 +3183,7 @@ Module( parameter: Parameter { range: 2379..2380, name: Identifier { - id: "b", + id: Name("b"), range: 2379..2380, }, annotation: None, @@ -3204,7 +3204,7 @@ 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 f0c41f6ce0472..3a30796835ed2 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,7 @@ Module( left: Name( ExprName { range: 56..57, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -184,7 +184,7 @@ Module( test: Name( ExprName { range: 90..91, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -202,7 +202,7 @@ Module( Name( ExprName { range: 107..108, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -234,14 +234,14 @@ 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 +290,7 @@ Module( Name( ExprName { range: 163..164, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -314,7 +314,7 @@ Module( Name( ExprName { range: 179..180, - id: "d", + id: Name("d"), ctx: Load, }, ), @@ -345,7 +345,7 @@ Module( func: Name( ExprName { range: 200..201, - id: "f", + id: Name("f"), ctx: Load, }, ), @@ -372,14 +372,14 @@ 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 +407,14 @@ 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 +453,7 @@ Module( parameter: Parameter { range: 271..272, name: Identifier { - id: "x", + id: Name("x"), range: 271..272, }, annotation: None, @@ -469,7 +469,7 @@ Module( body: Name( ExprName { range: 274..275, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -504,7 +504,7 @@ Module( parameter: Parameter { range: 293..294, name: Identifier { - id: "x", + id: Name("x"), range: 293..294, }, annotation: None, @@ -520,7 +520,7 @@ Module( body: Name( ExprName { range: 296..297, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -552,7 +552,7 @@ Module( value: Name( ExprName { range: 312..313, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -580,7 +580,7 @@ Module( value: Name( ExprName { range: 330..331, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -613,7 +613,7 @@ Module( Name( ExprName { range: 347..348, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -643,7 +643,7 @@ 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 1a201d6f122ce..b1eac233db12c 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,7 @@ Module( Alias { range: 7..8, name: Identifier { - id: "a", + id: Name("a"), range: 7..8, }, asname: None, @@ -31,7 +31,7 @@ Module( Alias { range: 16..21, name: Identifier { - id: "a.b.c", + id: Name("a.b.c"), range: 16..21, }, asname: None, @@ -46,12 +46,12 @@ 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 +66,7 @@ Module( Alias { range: 47..48, name: Identifier { - id: "a", + id: Name("a"), range: 47..48, }, asname: None, @@ -74,7 +74,7 @@ Module( Alias { range: 50..51, name: Identifier { - id: "b", + id: Name("b"), range: 50..51, }, asname: None, @@ -82,7 +82,7 @@ Module( Alias { range: 53..54, name: Identifier { - id: "c", + id: Name("c"), range: 53..54, }, asname: None, @@ -97,12 +97,12 @@ 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 +110,12 @@ 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 c28a10dae8260..23a67df7633d5 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,7 @@ Module( subject: Name( ExprName { range: 73..74, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -51,7 +51,7 @@ Module( Name( ExprName { range: 98..99, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -77,7 +77,7 @@ Module( subject: Name( ExprName { range: 132..133, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -90,7 +90,7 @@ Module( cls: Name( ExprName { range: 144..149, - id: "bytes", + id: Name("bytes"), ctx: Load, }, ), @@ -103,7 +103,7 @@ Module( pattern: None, name: Some( Identifier { - id: "z", + id: Name("z"), range: 150..151, }, ), @@ -123,7 +123,7 @@ Module( Name( ExprName { range: 162..163, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -149,7 +149,7 @@ Module( subject: Name( ExprName { range: 196..197, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -187,7 +187,7 @@ Module( Name( ExprName { range: 224..225, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -237,7 +237,7 @@ Module( Name( ExprName { range: 255..256, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -339,7 +339,7 @@ Module( Name( ExprName { range: 324..325, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -363,7 +363,7 @@ Module( subject: Name( ExprName { range: 361..362, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -452,7 +452,7 @@ Module( Name( ExprName { range: 398..399, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -478,7 +478,7 @@ Module( subject: Name( ExprName { range: 451..452, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -575,7 +575,7 @@ Module( subject: Name( ExprName { range: 552..553, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -650,7 +650,7 @@ Module( Name( ExprName { range: 589..590, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -884,7 +884,7 @@ Module( Name( ExprName { range: 682..683, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -918,7 +918,7 @@ Module( Name( ExprName { range: 709..710, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -944,7 +944,7 @@ Module( subject: Name( ExprName { range: 743..744, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -988,7 +988,7 @@ Module( Name( ExprName { range: 777..778, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -1014,7 +1014,7 @@ Module( subject: Name( ExprName { range: 811..812, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1050,7 +1050,7 @@ Module( Name( ExprName { range: 836..837, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -1152,7 +1152,7 @@ Module( Name( ExprName { range: 905..906, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -1176,7 +1176,7 @@ Module( subject: Name( ExprName { range: 942..943, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1200,7 +1200,7 @@ Module( Name( ExprName { range: 959..960, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1213,7 +1213,7 @@ Module( Name( ExprName { range: 970..971, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -1239,7 +1239,7 @@ Module( subject: Name( ExprName { range: 1004..1005, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1286,7 +1286,7 @@ Module( Name( ExprName { range: 1032..1033, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -1345,7 +1345,7 @@ Module( Name( ExprName { range: 1063..1064, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -1371,7 +1371,7 @@ Module( patterns: [], rest: Some( Identifier { - id: "z", + id: Name("z"), range: 1081..1082, }, ), @@ -1386,7 +1386,7 @@ Module( Name( ExprName { range: 1093..1094, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -1415,7 +1415,7 @@ Module( func: Name( ExprName { range: 1127..1130, - id: "Seq", + id: Name("Seq"), ctx: Load, }, ), @@ -1451,7 +1451,7 @@ Module( Name( ExprName { range: 1157..1158, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -1477,7 +1477,7 @@ Module( subject: Name( ExprName { range: 1191..1192, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1506,7 +1506,7 @@ Module( Name( ExprName { range: 1214..1215, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -1547,7 +1547,7 @@ Module( Name( ExprName { range: 1240..1241, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -1573,7 +1573,7 @@ Module( subject: Name( ExprName { range: 1274..1275, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1610,7 +1610,7 @@ Module( pattern: None, name: Some( Identifier { - id: "bar", + id: Name("bar"), range: 1294..1297, }, ), @@ -1629,7 +1629,7 @@ Module( Name( ExprName { range: 1308..1309, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -1637,7 +1637,7 @@ Module( value: Name( ExprName { range: 1312..1315, - id: "bar", + id: Name("bar"), ctx: Load, }, ), @@ -1722,7 +1722,7 @@ Module( range: 1371..1373, name: Some( Identifier { - id: "x", + id: Name("x"), range: 1372..1373, }, ), @@ -1753,7 +1753,7 @@ Module( Name( ExprName { range: 1387..1388, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -1779,7 +1779,7 @@ Module( subject: Name( ExprName { range: 1421..1422, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1815,7 +1815,7 @@ Module( Name( ExprName { range: 1446..1447, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -1874,7 +1874,7 @@ Module( target: Name( ExprName { range: 1472..1473, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -1884,7 +1884,7 @@ Module( value: Name( ExprName { range: 1477..1478, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1919,7 +1919,7 @@ Module( Name( ExprName { range: 1493..1494, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -1980,7 +1980,7 @@ Module( Name( ExprName { range: 1524..1525, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -2006,7 +2006,7 @@ Module( subject: Name( ExprName { range: 1558..1559, - id: "w", + id: Name("w"), ctx: Load, }, ), @@ -2023,7 +2023,7 @@ Module( pattern: None, name: Some( Identifier { - id: "x", + id: Name("x"), range: 1571..1572, }, ), @@ -2035,7 +2035,7 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name("y"), range: 1574..1575, }, ), @@ -2059,7 +2059,7 @@ Module( Name( ExprName { range: 1590..1591, - id: "z", + id: Name("z"), ctx: Store, }, ), @@ -2085,7 +2085,7 @@ Module( subject: Name( ExprName { range: 1624..1625, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -2135,7 +2135,7 @@ Module( Name( ExprName { range: 1659..1660, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -2165,7 +2165,7 @@ Module( Name( ExprName { range: 1694..1695, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -2187,7 +2187,7 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name("y"), range: 1709..1710, }, ), @@ -2205,7 +2205,7 @@ Module( Name( ExprName { range: 1721..1722, - id: "z", + id: Name("z"), ctx: Store, }, ), @@ -2231,7 +2231,7 @@ Module( subject: Name( ExprName { range: 1755..1756, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -2253,26 +2253,26 @@ 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 +2289,7 @@ Module( Name( ExprName { range: 1784..1785, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -2315,7 +2315,7 @@ Module( subject: Name( ExprName { range: 1818..1819, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -2337,7 +2337,7 @@ Module( Name( ExprName { range: 1844..1845, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -2363,7 +2363,7 @@ Module( subject: Name( ExprName { range: 1878..1879, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -2392,7 +2392,7 @@ Module( Name( ExprName { range: 1901..1902, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -2418,7 +2418,7 @@ Module( subject: Name( ExprName { range: 1935..1936, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -2440,7 +2440,7 @@ Module( Name( ExprName { range: 1962..1963, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -2466,7 +2466,7 @@ Module( subject: Name( ExprName { range: 1996..1997, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -2488,7 +2488,7 @@ Module( Name( ExprName { range: 2020..2021, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -2546,7 +2546,7 @@ Module( Name( ExprName { range: 2049..2050, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -2597,7 +2597,7 @@ Module( Name( ExprName { range: 2076..2077, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -2623,7 +2623,7 @@ Module( subject: Name( ExprName { range: 2110..2111, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -2636,7 +2636,7 @@ Module( pattern: None, name: Some( Identifier { - id: "z", + id: Name("z"), range: 2122..2123, }, ), @@ -2651,7 +2651,7 @@ Module( Name( ExprName { range: 2133..2134, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -2677,7 +2677,7 @@ Module( subject: Name( ExprName { range: 2167..2168, - id: "w", + id: Name("w"), ctx: Load, }, ), @@ -2694,7 +2694,7 @@ Module( pattern: None, name: Some( Identifier { - id: "x", + id: Name("x"), range: 2180..2181, }, ), @@ -2706,7 +2706,7 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name("y"), range: 2183..2184, }, ), @@ -2717,7 +2717,7 @@ Module( range: 2186..2191, name: Some( Identifier { - id: "rest", + id: Name("rest"), range: 2187..2191, }, ), @@ -2735,7 +2735,7 @@ Module( Name( ExprName { range: 2202..2203, - id: "z", + id: Name("z"), ctx: Store, }, ), @@ -2761,7 +2761,7 @@ Module( subject: Name( ExprName { range: 2236..2237, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -2792,7 +2792,7 @@ Module( ), name: Some( Identifier { - id: "z", + id: Name("z"), range: 2254..2255, }, ), @@ -2818,7 +2818,7 @@ Module( ), name: Some( Identifier { - id: "z", + id: Name("z"), range: 2265..2266, }, ), @@ -2844,7 +2844,7 @@ Module( ), name: Some( Identifier { - id: "z", + id: Name("z"), range: 2276..2277, }, ), @@ -2860,7 +2860,7 @@ Module( left: Name( ExprName { range: 2282..2283, - id: "z", + id: Name("z"), ctx: Load, }, ), @@ -2874,7 +2874,7 @@ Module( left: Name( ExprName { range: 2287..2288, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -2901,7 +2901,7 @@ Module( Name( ExprName { range: 2302..2303, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -2927,7 +2927,7 @@ Module( subject: Name( ExprName { range: 2336..2337, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -3002,7 +3002,7 @@ Module( Name( ExprName { range: 2373..2374, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -3236,7 +3236,7 @@ Module( Name( ExprName { range: 2467..2468, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -3270,7 +3270,7 @@ Module( Name( ExprName { range: 2494..2495, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -3351,7 +3351,7 @@ Module( range: 2551..2553, name: Some( Identifier { - id: "x", + id: Name("x"), range: 2552..2553, }, ), @@ -3369,7 +3369,7 @@ Module( Name( ExprName { range: 2563..2564, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -3437,7 +3437,7 @@ Module( range: 2617..2619, name: Some( Identifier { - id: "x", + id: Name("x"), range: 2618..2619, }, ), @@ -3468,7 +3468,7 @@ Module( Name( ExprName { range: 2633..2634, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -3498,7 +3498,7 @@ Module( Name( ExprName { range: 2667..2668, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -3520,7 +3520,7 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name("y"), range: 2680..2681, }, ), @@ -3538,7 +3538,7 @@ Module( Name( ExprName { range: 2692..2693, - id: "z", + id: Name("z"), ctx: Store, }, ), @@ -3568,14 +3568,14 @@ 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 +3597,7 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name("y"), range: 2741..2742, }, ), @@ -3609,7 +3609,7 @@ Module( pattern: None, name: Some( Identifier { - id: "z", + id: Name("z"), range: 2744..2745, }, ), @@ -3627,7 +3627,7 @@ Module( Name( ExprName { range: 2755..2756, - id: "v", + id: Name("v"), ctx: Store, }, ), @@ -3660,14 +3660,14 @@ 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 +3695,7 @@ Module( pattern: None, name: Some( Identifier { - id: "y", + id: Name("y"), range: 2807..2808, }, ), @@ -3704,7 +3704,7 @@ Module( ), name: Some( Identifier { - id: "v", + id: Name("v"), range: 2812..2813, }, ), @@ -3722,7 +3722,7 @@ Module( Name( ExprName { range: 2824..2825, - id: "z", + id: Name("z"), ctx: Store, }, ), @@ -3748,7 +3748,7 @@ Module( subject: Name( ExprName { range: 2837..2838, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -3773,7 +3773,7 @@ Module( expression: Name( ExprName { range: 2935..2936, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -3858,7 +3858,7 @@ Module( patterns: [], rest: Some( Identifier { - id: "rest", + id: Name("rest"), range: 2993..2997, }, ), @@ -3875,7 +3875,7 @@ Module( func: Name( ExprName { range: 3014..3019, - id: "print", + id: Name("print"), ctx: Load, }, ), @@ -3885,7 +3885,7 @@ Module( Name( ExprName { range: 3020..3024, - id: "rest", + id: Name("rest"), ctx: Load, }, ), @@ -3992,7 +3992,7 @@ Module( cls: Name( ExprName { range: 3079..3082, - id: "str", + id: Name("str"), ctx: Load, }, ), @@ -4015,7 +4015,7 @@ Module( ), name: Some( Identifier { - id: "label", + id: Name("label"), range: 3095..3100, }, ), @@ -4036,7 +4036,7 @@ Module( func: Name( ExprName { range: 3117..3122, - id: "print", + id: Name("print"), ctx: Load, }, ), @@ -4046,7 +4046,7 @@ Module( Name( ExprName { range: 3123..3128, - id: "label", + id: Name("label"), ctx: Load, }, ), @@ -4068,7 +4068,7 @@ Module( subject: Name( ExprName { range: 3136..3137, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -4117,7 +4117,7 @@ Module( Name( ExprName { range: 3165..3166, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -4143,7 +4143,7 @@ Module( subject: Name( ExprName { range: 3177..3178, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -4192,7 +4192,7 @@ Module( Name( ExprName { range: 3206..3207, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -4218,7 +4218,7 @@ Module( subject: Name( ExprName { range: 3218..3219, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -4254,7 +4254,7 @@ Module( Name( ExprName { range: 3244..3245, - id: "y", + id: Name("y"), ctx: Store, }, ), @@ -4284,7 +4284,7 @@ Module( Name( ExprName { range: 3256..3257, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -4302,7 +4302,7 @@ Module( pattern: None, name: Some( Identifier { - id: "z", + id: Name("z"), range: 3269..3270, }, ), @@ -4330,14 +4330,14 @@ 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 +4355,7 @@ Module( pattern: None, name: Some( Identifier { - id: "z", + id: Name("z"), range: 3306..3307, }, ), @@ -4383,14 +4383,14 @@ 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 +4408,7 @@ Module( pattern: None, name: Some( Identifier { - id: "z", + id: Name("z"), range: 3344..3345, }, ), @@ -4432,7 +4432,7 @@ Module( subject: Name( ExprName { range: 3391..3392, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -4512,7 +4512,7 @@ Module( subject: Name( ExprName { range: 3503..3504, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -4528,12 +4528,12 @@ 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 +4569,19 @@ 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 +4956,7 @@ Module( subject: Name( ExprName { range: 3846..3847, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -5108,12 +5108,12 @@ 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 +5147,7 @@ Module( subject: Name( ExprName { range: 3952..3953, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -5160,7 +5160,7 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name("a"), range: 3964..3965, }, ), @@ -5192,7 +5192,7 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name("a"), range: 3988..3989, }, ), @@ -5201,7 +5201,7 @@ Module( ), name: Some( Identifier { - id: "b", + id: Name("b"), range: 3993..3994, }, ), @@ -5263,7 +5263,7 @@ Module( ), name: Some( Identifier { - id: "two", + id: Name("two"), range: 4026..4029, }, ), @@ -5320,7 +5320,7 @@ Module( ), name: Some( Identifier { - id: "sum", + id: Name("sum"), range: 4062..4065, }, ), @@ -5355,12 +5355,12 @@ 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 +5371,7 @@ Module( ), name: Some( Identifier { - id: "ab", + id: Name("ab"), range: 4095..4097, }, ), @@ -5430,7 +5430,7 @@ Module( ), name: Some( Identifier { - id: "x", + id: Name("x"), range: 4149..4150, }, ), @@ -5459,7 +5459,7 @@ Module( subject: Name( ExprName { range: 4194..4195, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -5628,7 +5628,7 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name("a"), range: 4278..4279, }, ), @@ -5649,12 +5649,12 @@ 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 +5709,7 @@ Module( ), name: Some( Identifier { - id: "X", + id: Name("X"), range: 4320..4321, }, ), @@ -5721,7 +5721,7 @@ Module( pattern: None, name: Some( Identifier { - id: "b", + id: Name("b"), range: 4323..4324, }, ), @@ -5733,7 +5733,7 @@ Module( ), name: Some( Identifier { - id: "S", + id: Name("S"), range: 4329..4330, }, ), @@ -5944,7 +5944,7 @@ Module( subject: Name( ExprName { range: 4466..4467, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -5960,7 +5960,7 @@ Module( range: 4478..4480, name: Some( Identifier { - id: "a", + id: Name("a"), range: 4479..4480, }, ), @@ -6049,7 +6049,7 @@ Module( range: 4537..4542, name: Some( Identifier { - id: "rest", + id: Name("rest"), range: 4538..4542, }, ), @@ -6136,7 +6136,7 @@ Module( subject: Name( ExprName { range: 4617..4618, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -6149,7 +6149,7 @@ Module( cls: Name( ExprName { range: 4629..4634, - id: "Point", + id: Name("Point"), ctx: Load, }, ), @@ -6188,19 +6188,19 @@ 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 +6235,7 @@ Module( cls: Name( ExprName { range: 4693..4700, - id: "Point2D", + id: Name("Point2D"), ctx: Load, }, ), @@ -6246,7 +6246,7 @@ Module( PatternKeyword { range: 4701..4704, attr: Identifier { - id: "x", + id: Name("x"), range: 4701..4702, }, pattern: MatchValue( @@ -6289,7 +6289,7 @@ Module( cls: Name( ExprName { range: 4728..4735, - id: "Point2D", + id: Name("Point2D"), ctx: Load, }, ), @@ -6300,7 +6300,7 @@ Module( PatternKeyword { range: 4736..4739, attr: Identifier { - id: "x", + id: Name("x"), range: 4736..4737, }, pattern: MatchValue( @@ -6320,7 +6320,7 @@ Module( PatternKeyword { range: 4741..4744, attr: Identifier { - id: "y", + id: Name("y"), range: 4741..4742, }, pattern: MatchValue( @@ -6363,7 +6363,7 @@ Module( cls: Name( ExprName { range: 4769..4776, - id: "Point2D", + id: Name("Point2D"), ctx: Load, }, ), @@ -6423,7 +6423,7 @@ Module( cls: Name( ExprName { range: 4805..4812, - id: "Point2D", + id: Name("Point2D"), ctx: Load, }, ), @@ -6468,7 +6468,7 @@ Module( PatternKeyword { range: 4821..4824, attr: Identifier { - id: "y", + id: Name("y"), range: 4821..4822, }, pattern: MatchValue( @@ -6511,7 +6511,7 @@ Module( cls: Name( ExprName { range: 4848..4855, - id: "Point2D", + id: Name("Point2D"), ctx: Load, }, ), @@ -6522,7 +6522,7 @@ Module( PatternKeyword { range: 4856..4864, attr: Identifier { - id: "x", + id: Name("x"), range: 4856..4857, }, pattern: MatchSequence( @@ -6562,7 +6562,7 @@ Module( PatternKeyword { range: 4866..4869, attr: Identifier { - id: "y", + id: Name("y"), range: 4866..4867, }, pattern: MatchValue( @@ -6609,14 +6609,14 @@ 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 +6701,7 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name("a"), range: 4964..4965, }, ), @@ -6743,7 +6743,7 @@ Module( ], rest: Some( Identifier { - id: "rest", + id: Name("rest"), range: 4983..4987, }, ), @@ -6772,7 +6772,7 @@ Module( subject: Name( ExprName { range: 5025..5026, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -6785,7 +6785,7 @@ Module( pattern: None, name: Some( Identifier { - id: "a", + id: Name("a"), range: 5037..5038, }, ), @@ -6798,14 +6798,14 @@ 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 +6833,7 @@ Module( pattern: None, name: Some( Identifier { - id: "e", + id: Name("e"), range: 5063..5064, }, ), @@ -6899,7 +6899,7 @@ Module( left: Name( ExprName { range: 5108..5113, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -6907,7 +6907,7 @@ Module( right: Name( ExprName { range: 5115..5116, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -6917,7 +6917,7 @@ Module( right: Name( ExprName { range: 5119..5120, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -6926,7 +6926,7 @@ Module( Name( ExprName { range: 5122..5123, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -6950,7 +6950,7 @@ Module( left: Name( ExprName { range: 5149..5154, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -6961,7 +6961,7 @@ Module( left: Name( ExprName { range: 5157..5158, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -6969,7 +6969,7 @@ Module( right: Name( ExprName { range: 5161..5162, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -6980,7 +6980,7 @@ Module( Name( ExprName { range: 5165..5166, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -7000,7 +7000,7 @@ Module( func: Name( ExprName { range: 5192..5197, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -7016,7 +7016,7 @@ Module( left: Name( ExprName { range: 5200..5201, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -7024,7 +7024,7 @@ Module( right: Name( ExprName { range: 5204..5205, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -7036,7 +7036,7 @@ Module( Name( ExprName { range: 5207..5208, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -7059,7 +7059,7 @@ Module( left: Name( ExprName { range: 5236..5241, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -7070,7 +7070,7 @@ Module( left: Name( ExprName { range: 5243..5244, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -7078,7 +7078,7 @@ Module( right: Name( ExprName { range: 5247..5248, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -7090,7 +7090,7 @@ Module( right: Name( ExprName { range: 5251..5252, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -7110,7 +7110,7 @@ Module( left: Name( ExprName { range: 5279..5284, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -7121,7 +7121,7 @@ Module( left: Name( ExprName { range: 5287..5288, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -7129,7 +7129,7 @@ Module( right: Name( ExprName { range: 5291..5292, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -7141,7 +7141,7 @@ Module( right: Name( ExprName { range: 5296..5297, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -7164,7 +7164,7 @@ Module( func: Name( ExprName { range: 5324..5329, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -7178,7 +7178,7 @@ Module( operand: Name( ExprName { range: 5332..5333, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -7193,7 +7193,7 @@ Module( right: Name( ExprName { range: 5337..5338, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -7203,7 +7203,7 @@ Module( right: Name( ExprName { range: 5341..5342, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -7223,7 +7223,7 @@ Module( func: Name( ExprName { range: 5370..5375, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -7235,7 +7235,7 @@ Module( }, ), attr: Identifier { - id: "a", + id: Name("a"), range: 5379..5380, }, ctx: Load, @@ -7255,7 +7255,7 @@ Module( func: Name( ExprName { range: 5397..5402, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -7276,7 +7276,7 @@ Module( }, ), attr: Identifier { - id: "a", + id: Name("a"), range: 5408..5409, }, ctx: Load, @@ -7296,7 +7296,7 @@ Module( func: Name( ExprName { range: 5428..5433, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -7317,7 +7317,7 @@ Module( }, ), attr: Identifier { - id: "a", + id: Name("a"), range: 5440..5441, }, ctx: Load, @@ -7337,14 +7337,14 @@ 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 +7352,7 @@ Module( }, ), attr: Identifier { - id: "b", + id: Name("b"), range: 5470..5471, }, ctx: Load, @@ -7372,7 +7372,7 @@ Module( value: Name( ExprName { range: 5489..5494, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -7383,7 +7383,7 @@ Module( Name( ExprName { range: 5496..5497, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -7396,7 +7396,7 @@ Module( }, ), attr: Identifier { - id: "b", + id: Name("b"), range: 5500..5501, }, ctx: Load, @@ -7416,7 +7416,7 @@ Module( value: Name( ExprName { range: 5542..5547, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -7427,7 +7427,7 @@ Module( Name( ExprName { range: 5550..5551, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -7440,7 +7440,7 @@ Module( }, ), attr: Identifier { - id: "b", + id: Name("b"), range: 5555..5556, }, ctx: Load, @@ -7460,7 +7460,7 @@ Module( func: Name( ExprName { range: 5577..5582, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -7478,7 +7478,7 @@ Module( Name( ExprName { range: 5585..5586, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -7487,7 +7487,7 @@ Module( Name( ExprName { range: 5592..5593, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -7509,7 +7509,7 @@ Module( target: Name( ExprName { range: 5617..5622, - id: "match", + id: Name("match"), ctx: Store, }, ), @@ -7539,7 +7539,7 @@ Module( subject: Name( ExprName { range: 5640..5645, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -7602,7 +7602,7 @@ Module( Name( ExprName { range: 5689..5694, - id: "match", + id: Name("match"), ctx: Store, }, ), @@ -7620,7 +7620,7 @@ Module( parameter: Parameter { range: 5704..5709, name: Identifier { - id: "query", + id: Name("query"), range: 5704..5709, }, annotation: None, @@ -7639,7 +7639,7 @@ Module( left: Name( ExprName { range: 5711..5716, - id: "query", + id: Name("query"), ctx: Load, }, ), @@ -7650,7 +7650,7 @@ Module( Name( ExprName { range: 5720..5725, - id: "event", + id: Name("event"), ctx: Load, }, ), @@ -7670,7 +7670,7 @@ Module( func: Name( ExprName { range: 5726..5731, - id: "print", + id: Name("print"), ctx: Load, }, ), @@ -7683,7 +7683,7 @@ 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 ec27a9479aafe..72c23fa3eb2a3 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,7 @@ Module( Name( ExprName { range: 20..21, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -42,14 +42,14 @@ 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 +108,14 @@ 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 +143,7 @@ Module( parameter: Parameter { range: 74..75, name: Identifier { - id: "x", + id: Name("x"), range: 74..75, }, annotation: None, @@ -159,7 +159,7 @@ Module( body: Name( ExprName { range: 77..78, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -179,7 +179,7 @@ Module( value: Name( ExprName { range: 91..92, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -205,14 +205,14 @@ 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 +229,7 @@ Module( Name( ExprName { range: 144..145, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -238,7 +238,7 @@ Module( Name( ExprName { range: 151..152, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -252,7 +252,7 @@ Module( Name( ExprName { range: 159..160, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -265,14 +265,14 @@ 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 +291,7 @@ Module( Name( ExprName { range: 179..180, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -333,7 +333,7 @@ Module( Name( ExprName { range: 198..199, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -347,14 +347,14 @@ 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 +371,7 @@ Module( Name( ExprName { range: 219..220, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -390,7 +390,7 @@ Module( parameter: Parameter { range: 233..234, name: Identifier { - id: "x", + id: Name("x"), range: 233..234, }, annotation: None, @@ -406,7 +406,7 @@ Module( body: Name( ExprName { range: 236..237, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -422,7 +422,7 @@ Module( Name( ExprName { range: 244..245, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -434,7 +434,7 @@ Module( value: Name( ExprName { range: 257..258, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -450,7 +450,7 @@ Module( Name( ExprName { range: 265..266, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -468,14 +468,14 @@ 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 056479e9184d9..0d95c4a3b9e40 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,7 @@ Module( Name( ExprName { range: 14..15, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -39,7 +39,7 @@ Module( value: Name( ExprName { range: 24..25, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -62,7 +62,7 @@ Module( left: Name( ExprName { range: 34..35, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -70,7 +70,7 @@ Module( right: Name( ExprName { range: 38..39, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -96,7 +96,7 @@ Module( value: Name( ExprName { range: 48..49, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -109,7 +109,7 @@ Module( value: Name( ExprName { range: 52..53, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -134,7 +134,7 @@ Module( target: Name( ExprName { range: 62..63, - id: "x", + id: Name("x"), ctx: Store, }, ), @@ -175,14 +175,14 @@ 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 +267,7 @@ Module( func: Name( ExprName { range: 130..134, - id: "call", + id: Name("call"), ctx: Load, }, ), @@ -294,12 +294,12 @@ 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 +325,7 @@ Module( value: Name( ExprName { range: 170..171, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -351,7 +351,7 @@ Module( parameter: Parameter { range: 186..187, name: Identifier { - id: "x", + id: Name("x"), range: 186..187, }, annotation: None, @@ -367,7 +367,7 @@ 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 257c1d0bc4f8b..24b5e0e5e4287 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,7 @@ Module( test: Name( ExprName { range: 80..81, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -126,21 +126,21 @@ 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 +154,7 @@ Module( test: Name( ExprName { range: 138..139, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -165,7 +165,7 @@ Module( value: Name( ExprName { range: 141..142, - id: "B", + id: Name("B"), ctx: Load, }, ), @@ -178,7 +178,7 @@ Module( Name( ExprName { range: 148..149, - id: "A", + id: Name("A"), ctx: Del, }, ), @@ -197,7 +197,7 @@ Module( value: Name( ExprName { range: 156..157, - id: "C", + id: Name("C"), ctx: Load, }, ), @@ -214,7 +214,7 @@ Module( test: Name( ExprName { range: 161..162, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -229,7 +229,7 @@ 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 c7da1fecb2dfd..52ddc068aa6c0 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,14 @@ 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 +105,14 @@ 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 +159,14 @@ 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 +433,14 @@ 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 +465,7 @@ Module( Name( ExprName { range: 418..432, - id: "ExceptionGroup", + id: Name("ExceptionGroup"), ctx: Load, }, ), @@ -505,7 +505,7 @@ Module( func: Name( ExprName { range: 458..468, - id: "ValueError", + id: Name("ValueError"), ctx: Load, }, ), @@ -538,14 +538,14 @@ 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 +559,7 @@ Module( func: Name( ExprName { range: 499..504, - id: "print", + id: Name("print"), ctx: Load, }, ), @@ -590,7 +590,7 @@ Module( func: Name( ExprName { range: 515..519, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -600,7 +600,7 @@ Module( Name( ExprName { range: 520..521, - id: "e", + id: Name("e"), ctx: Load, }, ), @@ -643,14 +643,14 @@ 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 +664,7 @@ Module( func: Name( ExprName { range: 551..556, - id: "print", + id: Name("print"), ctx: Load, }, ), @@ -695,7 +695,7 @@ Module( func: Name( ExprName { range: 567..571, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -705,7 +705,7 @@ Module( Name( ExprName { range: 572..573, - id: "e", + id: Name("e"), ctx: Load, }, ), @@ -761,7 +761,7 @@ Module( func: Name( ExprName { range: 594..608, - id: "ExceptionGroup", + id: Name("ExceptionGroup"), ctx: Load, }, ), @@ -796,7 +796,7 @@ Module( func: Name( ExprName { range: 616..626, - id: "ValueError", + id: Name("ValueError"), ctx: Load, }, ), @@ -822,7 +822,7 @@ Module( func: Name( ExprName { range: 631..640, - id: "TypeError", + id: Name("TypeError"), ctx: Load, }, ), @@ -848,7 +848,7 @@ Module( func: Name( ExprName { range: 645..652, - id: "OSError", + id: Name("OSError"), ctx: Load, }, ), @@ -874,7 +874,7 @@ Module( func: Name( ExprName { range: 657..664, - id: "OSError", + id: Name("OSError"), ctx: Load, }, ), @@ -916,14 +916,14 @@ 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 +937,7 @@ Module( func: Name( ExprName { range: 698..703, - id: "print", + id: Name("print"), ctx: Load, }, ), @@ -968,7 +968,7 @@ Module( func: Name( ExprName { range: 714..718, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -978,7 +978,7 @@ Module( Name( ExprName { range: 719..720, - id: "e", + id: Name("e"), ctx: Load, }, ), @@ -1007,12 +1007,12 @@ 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 +1052,14 @@ 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 +1073,7 @@ Module( func: Name( ExprName { range: 778..783, - id: "print", + id: Name("print"), ctx: Load, }, ), @@ -1104,7 +1104,7 @@ Module( func: Name( ExprName { range: 794..798, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -1114,7 +1114,7 @@ Module( Name( ExprName { range: 799..800, - id: "e", + id: Name("e"), ctx: Load, }, ), @@ -1143,12 +1143,12 @@ 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 +1322,7 @@ Module( left: Name( ExprName { range: 947..948, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -1330,7 +1330,7 @@ Module( right: Name( ExprName { range: 951..952, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -1359,14 +1359,14 @@ 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 +1394,7 @@ Module( value: Name( ExprName { range: 1001..1002, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1428,7 +1428,7 @@ Module( parameter: Parameter { range: 1027..1028, name: Identifier { - id: "x", + id: Name("x"), range: 1027..1028, }, annotation: None, @@ -1444,7 +1444,7 @@ Module( body: Name( ExprName { range: 1030..1031, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -1477,14 +1477,14 @@ 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 ba6f64dc5c900..66cb26caef939 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,7 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -23,7 +23,7 @@ Module( value: Name( ExprName { range: 9..12, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -35,7 +35,7 @@ Module( name: Name( ExprName { range: 18..19, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -46,7 +46,7 @@ Module( left: Name( ExprName { range: 22..25, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -54,7 +54,7 @@ Module( right: Name( ExprName { range: 28..31, - id: "str", + id: Name("str"), ctx: Load, }, ), @@ -68,7 +68,7 @@ Module( name: Name( ExprName { range: 37..38, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -79,7 +79,7 @@ Module( left: Name( ExprName { range: 41..44, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -112,7 +112,7 @@ Module( name: Name( ExprName { range: 66..67, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -124,7 +124,7 @@ Module( TypeParamTypeVar { range: 68..69, name: Identifier { - id: "T", + id: Name("T"), range: 68..69, }, bound: None, @@ -140,7 +140,7 @@ Module( left: Name( ExprName { range: 73..74, - id: "T", + id: Name("T"), ctx: Load, }, ), @@ -151,7 +151,7 @@ Module( value: Name( ExprName { range: 77..81, - id: "list", + id: Name("list"), ctx: Load, }, ), @@ -161,14 +161,14 @@ 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 +188,7 @@ Module( name: Name( ExprName { range: 106..107, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -200,7 +200,7 @@ Module( TypeParamTypeVar { range: 108..109, name: Identifier { - id: "T", + id: Name("T"), range: 108..109, }, bound: None, @@ -213,7 +213,7 @@ Module( value: Name( ExprName { range: 113..116, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -225,7 +225,7 @@ Module( name: Name( ExprName { range: 122..123, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -237,7 +237,7 @@ Module( TypeParamTypeVar { range: 124..125, name: Identifier { - id: "T", + id: Name("T"), range: 124..125, }, bound: None, @@ -256,14 +256,14 @@ 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 +277,14 @@ 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 +301,7 @@ Module( name: Name( ExprName { range: 151..152, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -313,7 +313,7 @@ Module( TypeParamTypeVar { range: 153..154, name: Identifier { - id: "T", + id: Name("T"), range: 153..154, }, bound: None, @@ -324,7 +324,7 @@ Module( TypeParamTypeVarTuple { range: 156..159, name: Identifier { - id: "Ts", + id: Name("Ts"), range: 157..159, }, default: None, @@ -334,7 +334,7 @@ Module( TypeParamParamSpec { range: 161..164, name: Identifier { - id: "P", + id: Name("P"), range: 163..164, }, default: None, @@ -350,21 +350,21 @@ 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 +381,7 @@ Module( name: Name( ExprName { range: 184..185, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -393,14 +393,14 @@ 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 +412,7 @@ Module( TypeParamTypeVarTuple { range: 194..197, name: Identifier { - id: "Ts", + id: Name("Ts"), range: 195..197, }, default: None, @@ -422,7 +422,7 @@ Module( TypeParamParamSpec { range: 199..202, name: Identifier { - id: "P", + id: Name("P"), range: 201..202, }, default: None, @@ -438,21 +438,21 @@ 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 +469,7 @@ Module( name: Name( ExprName { range: 222..223, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -481,7 +481,7 @@ Module( TypeParamTypeVar { range: 224..237, name: Identifier { - id: "T", + id: Name("T"), range: 224..225, }, bound: Some( @@ -492,14 +492,14 @@ 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 +516,7 @@ Module( TypeParamTypeVarTuple { range: 239..242, name: Identifier { - id: "Ts", + id: Name("Ts"), range: 240..242, }, default: None, @@ -526,7 +526,7 @@ Module( TypeParamParamSpec { range: 244..247, name: Identifier { - id: "P", + id: Name("P"), range: 246..247, }, default: None, @@ -542,21 +542,21 @@ 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 +573,7 @@ Module( name: Name( ExprName { range: 267..268, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -585,7 +585,7 @@ Module( TypeParamTypeVar { range: 269..276, name: Identifier { - id: "T", + id: Name("T"), range: 269..270, }, bound: None, @@ -593,7 +593,7 @@ Module( Name( ExprName { range: 273..276, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -609,7 +609,7 @@ Module( left: Name( ExprName { range: 280..281, - id: "T", + id: Name("T"), ctx: Load, }, ), @@ -617,7 +617,7 @@ Module( right: Name( ExprName { range: 284..287, - id: "str", + id: Name("str"), ctx: Load, }, ), @@ -631,7 +631,7 @@ Module( name: Name( ExprName { range: 293..294, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -643,7 +643,7 @@ Module( TypeParamTypeVar { range: 295..313, name: Identifier { - id: "T", + id: Name("T"), range: 295..296, }, bound: Some( @@ -653,7 +653,7 @@ Module( left: Name( ExprName { range: 298..301, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -661,7 +661,7 @@ Module( right: Name( ExprName { range: 304..307, - id: "str", + id: Name("str"), ctx: Load, }, ), @@ -672,7 +672,7 @@ Module( Name( ExprName { range: 310..313, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -691,7 +691,7 @@ Module( left: Name( ExprName { range: 317..318, - id: "T", + id: Name("T"), ctx: Load, }, ), @@ -699,7 +699,7 @@ Module( right: Name( ExprName { range: 321..324, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -709,7 +709,7 @@ Module( right: Name( ExprName { range: 327..330, - id: "str", + id: Name("str"), ctx: Load, }, ), @@ -723,7 +723,7 @@ Module( name: Name( ExprName { range: 336..337, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -735,7 +735,7 @@ Module( TypeParamTypeVarTuple { range: 338..360, name: Identifier { - id: "Ts", + id: Name("Ts"), range: 339..341, }, default: Some( @@ -748,7 +748,7 @@ Module( value: Name( ExprName { range: 345..350, - id: "tuple", + id: Name("tuple"), ctx: Load, }, ), @@ -759,14 +759,14 @@ 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 +793,7 @@ Module( value: Name( ExprName { range: 364..369, - id: "tuple", + id: Name("tuple"), ctx: Load, }, ), @@ -804,7 +804,7 @@ Module( Name( ExprName { range: 370..373, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -814,7 +814,7 @@ Module( value: Name( ExprName { range: 376..378, - id: "Ts", + id: Name("Ts"), ctx: Load, }, ), @@ -824,7 +824,7 @@ Module( Name( ExprName { range: 380..383, - id: "str", + id: Name("str"), ctx: Load, }, ), @@ -844,7 +844,7 @@ Module( name: Name( ExprName { range: 390..391, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -856,7 +856,7 @@ Module( TypeParamParamSpec { range: 392..408, name: Identifier { - id: "P", + id: Name("P"), range: 394..395, }, default: Some( @@ -867,14 +867,14 @@ 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 +894,7 @@ Module( value: Name( ExprName { range: 412..420, - id: "Callable", + id: Name("Callable"), ctx: Load, }, ), @@ -905,14 +905,14 @@ 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 +932,7 @@ Module( name: Name( ExprName { range: 464..468, - id: "type", + id: Name("type"), ctx: Store, }, ), @@ -940,7 +940,7 @@ Module( value: Name( ExprName { range: 471..474, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -952,7 +952,7 @@ Module( name: Name( ExprName { range: 480..485, - id: "match", + id: Name("match"), ctx: Store, }, ), @@ -960,7 +960,7 @@ Module( value: Name( ExprName { range: 488..491, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -972,7 +972,7 @@ Module( name: Name( ExprName { range: 497..501, - id: "case", + id: Name("case"), ctx: Store, }, ), @@ -980,7 +980,7 @@ Module( value: Name( ExprName { range: 504..507, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -992,7 +992,7 @@ Module( name: Name( ExprName { range: 538..541, - id: "foo", + id: Name("foo"), ctx: Store, }, ), @@ -1000,7 +1000,7 @@ Module( value: Name( ExprName { range: 544..548, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -1012,7 +1012,7 @@ Module( name: Name( ExprName { range: 554..557, - id: "foo", + id: Name("foo"), ctx: Store, }, ), @@ -1020,7 +1020,7 @@ Module( value: Name( ExprName { range: 560..565, - id: "match", + id: Name("match"), ctx: Load, }, ), @@ -1032,7 +1032,7 @@ Module( name: Name( ExprName { range: 571..574, - id: "foo", + id: Name("foo"), ctx: Store, }, ), @@ -1040,7 +1040,7 @@ Module( value: Name( ExprName { range: 577..581, - id: "case", + id: Name("case"), ctx: Load, }, ), @@ -1052,7 +1052,7 @@ Module( name: Name( ExprName { range: 613..614, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -1060,7 +1060,7 @@ Module( value: Name( ExprName { range: 617..620, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -1072,7 +1072,7 @@ Module( name: Name( ExprName { range: 626..627, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -1080,7 +1080,7 @@ Module( value: Name( ExprName { range: 633..636, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -1092,7 +1092,7 @@ Module( name: Name( ExprName { range: 642..643, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -1100,7 +1100,7 @@ Module( value: Name( ExprName { range: 649..652, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -1112,7 +1112,7 @@ Module( name: Name( ExprName { range: 658..659, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -1120,7 +1120,7 @@ Module( value: Name( ExprName { range: 668..671, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -1132,7 +1132,7 @@ Module( name: Name( ExprName { range: 685..686, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -1144,7 +1144,7 @@ Module( TypeParamTypeVar { range: 687..688, name: Identifier { - id: "T", + id: Name("T"), range: 687..688, }, bound: None, @@ -1157,7 +1157,7 @@ Module( value: Name( ExprName { range: 692..693, - id: "T", + id: Name("T"), ctx: Load, }, ), @@ -1169,7 +1169,7 @@ Module( name: Name( ExprName { range: 699..700, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -1181,7 +1181,7 @@ Module( TypeParamTypeVar { range: 708..709, name: Identifier { - id: "T", + id: Name("T"), range: 708..709, }, bound: None, @@ -1194,7 +1194,7 @@ Module( value: Name( ExprName { range: 713..714, - id: "T", + id: Name("T"), ctx: Load, }, ), @@ -1206,7 +1206,7 @@ Module( name: Name( ExprName { range: 720..721, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -1218,7 +1218,7 @@ Module( TypeParamTypeVar { range: 722..723, name: Identifier { - id: "T", + id: Name("T"), range: 722..723, }, bound: None, @@ -1231,7 +1231,7 @@ Module( value: Name( ExprName { range: 733..734, - id: "T", + id: Name("T"), ctx: Load, }, ), @@ -1243,7 +1243,7 @@ Module( name: Name( ExprName { range: 761..762, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -1251,7 +1251,7 @@ Module( value: Name( ExprName { range: 765..768, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -1263,7 +1263,7 @@ Module( name: Name( ExprName { range: 775..776, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -1271,7 +1271,7 @@ Module( value: Name( ExprName { range: 779..782, - id: "str", + id: Name("str"), ctx: Load, }, ), @@ -1283,7 +1283,7 @@ Module( name: Name( ExprName { range: 789..790, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -1291,7 +1291,7 @@ Module( value: Name( ExprName { range: 793..797, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -1302,7 +1302,7 @@ Module( range: 798..819, decorator_list: [], name: Identifier { - id: "X", + id: Name("X"), range: 804..805, }, type_params: None, @@ -1314,7 +1314,7 @@ Module( name: Name( ExprName { range: 812..813, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -1322,7 +1322,7 @@ Module( value: Name( ExprName { range: 816..819, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -1337,7 +1337,7 @@ Module( name: Name( ExprName { range: 826..831, - id: "Point", + id: Name("Point"), ctx: Store, }, ), @@ -1348,7 +1348,7 @@ Module( value: Name( ExprName { range: 834..839, - id: "tuple", + id: Name("tuple"), ctx: Load, }, ), @@ -1359,14 +1359,14 @@ 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 +1386,7 @@ Module( name: Name( ExprName { range: 859..864, - id: "Point", + id: Name("Point"), ctx: Store, }, ), @@ -1398,7 +1398,7 @@ Module( TypeParamTypeVar { range: 865..866, name: Identifier { - id: "T", + id: Name("T"), range: 865..866, }, bound: None, @@ -1414,7 +1414,7 @@ Module( value: Name( ExprName { range: 870..875, - id: "tuple", + id: Name("tuple"), ctx: Load, }, ), @@ -1425,14 +1425,14 @@ 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 +1452,7 @@ Module( name: Name( ExprName { range: 887..894, - id: "IntFunc", + id: Name("IntFunc"), ctx: Store, }, ), @@ -1464,7 +1464,7 @@ Module( TypeParamParamSpec { range: 895..898, name: Identifier { - id: "P", + id: Name("P"), range: 897..898, }, default: None, @@ -1479,7 +1479,7 @@ Module( value: Name( ExprName { range: 902..910, - id: "Callable", + id: Name("Callable"), ctx: Load, }, ), @@ -1490,14 +1490,14 @@ 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 +1517,7 @@ Module( name: Name( ExprName { range: 937..949, - id: "LabeledTuple", + id: Name("LabeledTuple"), ctx: Store, }, ), @@ -1529,7 +1529,7 @@ Module( TypeParamTypeVarTuple { range: 950..953, name: Identifier { - id: "Ts", + id: Name("Ts"), range: 951..953, }, default: None, @@ -1544,7 +1544,7 @@ Module( value: Name( ExprName { range: 957..962, - id: "tuple", + id: Name("tuple"), ctx: Load, }, ), @@ -1555,7 +1555,7 @@ Module( Name( ExprName { range: 963..966, - id: "str", + id: Name("str"), ctx: Load, }, ), @@ -1565,7 +1565,7 @@ Module( value: Name( ExprName { range: 969..971, - id: "Ts", + id: Name("Ts"), ctx: Load, }, ), @@ -1588,7 +1588,7 @@ Module( name: Name( ExprName { range: 994..1010, - id: "HashableSequence", + id: Name("HashableSequence"), ctx: Store, }, ), @@ -1600,14 +1600,14 @@ 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 +1624,14 @@ 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 +1646,7 @@ Module( name: Name( ExprName { range: 1065..1081, - id: "IntOrStrSequence", + id: Name("IntOrStrSequence"), ctx: Store, }, ), @@ -1658,7 +1658,7 @@ Module( TypeParamTypeVar { range: 1082..1095, name: Identifier { - id: "T", + id: Name("T"), range: 1082..1083, }, bound: Some( @@ -1669,14 +1669,14 @@ 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 +1698,14 @@ 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 +1730,7 @@ Module( left: Name( ExprName { range: 1164..1168, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -1738,7 +1738,7 @@ Module( right: Name( ExprName { range: 1170..1171, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -1748,7 +1748,7 @@ Module( right: Name( ExprName { range: 1174..1175, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -1757,7 +1757,7 @@ Module( Name( ExprName { range: 1177..1178, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -1781,7 +1781,7 @@ Module( left: Name( ExprName { range: 1203..1207, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -1792,7 +1792,7 @@ Module( left: Name( ExprName { range: 1210..1211, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -1800,7 +1800,7 @@ Module( right: Name( ExprName { range: 1214..1215, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -1811,7 +1811,7 @@ Module( Name( ExprName { range: 1218..1219, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -1831,7 +1831,7 @@ Module( func: Name( ExprName { range: 1244..1248, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -1847,7 +1847,7 @@ Module( left: Name( ExprName { range: 1251..1252, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -1855,7 +1855,7 @@ Module( right: Name( ExprName { range: 1255..1256, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -1867,7 +1867,7 @@ Module( Name( ExprName { range: 1258..1259, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -1890,7 +1890,7 @@ Module( left: Name( ExprName { range: 1286..1290, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -1901,7 +1901,7 @@ Module( left: Name( ExprName { range: 1292..1293, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -1909,7 +1909,7 @@ Module( right: Name( ExprName { range: 1296..1297, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -1921,7 +1921,7 @@ Module( right: Name( ExprName { range: 1300..1301, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -1941,7 +1941,7 @@ Module( left: Name( ExprName { range: 1327..1331, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -1952,7 +1952,7 @@ Module( left: Name( ExprName { range: 1334..1335, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -1960,7 +1960,7 @@ Module( right: Name( ExprName { range: 1338..1339, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -1972,7 +1972,7 @@ Module( right: Name( ExprName { range: 1343..1344, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -1995,7 +1995,7 @@ Module( func: Name( ExprName { range: 1370..1374, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -2009,7 +2009,7 @@ Module( operand: Name( ExprName { range: 1377..1378, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -2024,7 +2024,7 @@ Module( right: Name( ExprName { range: 1382..1383, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -2034,7 +2034,7 @@ Module( right: Name( ExprName { range: 1386..1387, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -2054,7 +2054,7 @@ Module( func: Name( ExprName { range: 1414..1418, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -2066,7 +2066,7 @@ Module( }, ), attr: Identifier { - id: "a", + id: Name("a"), range: 1422..1423, }, ctx: Load, @@ -2086,7 +2086,7 @@ Module( func: Name( ExprName { range: 1439..1443, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -2107,7 +2107,7 @@ Module( }, ), attr: Identifier { - id: "a", + id: Name("a"), range: 1449..1450, }, ctx: Load, @@ -2127,7 +2127,7 @@ Module( func: Name( ExprName { range: 1468..1472, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -2148,7 +2148,7 @@ Module( }, ), attr: Identifier { - id: "a", + id: Name("a"), range: 1479..1480, }, ctx: Load, @@ -2168,14 +2168,14 @@ 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 +2183,7 @@ Module( }, ), attr: Identifier { - id: "b", + id: Name("b"), range: 1507..1508, }, ctx: Load, @@ -2203,7 +2203,7 @@ Module( value: Name( ExprName { range: 1525..1529, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -2214,7 +2214,7 @@ Module( Name( ExprName { range: 1531..1532, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -2227,7 +2227,7 @@ Module( }, ), attr: Identifier { - id: "b", + id: Name("b"), range: 1535..1536, }, ctx: Load, @@ -2247,7 +2247,7 @@ Module( value: Name( ExprName { range: 1575..1579, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -2258,7 +2258,7 @@ Module( Name( ExprName { range: 1582..1583, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -2271,7 +2271,7 @@ Module( }, ), attr: Identifier { - id: "b", + id: Name("b"), range: 1587..1588, }, ctx: Load, @@ -2291,7 +2291,7 @@ Module( func: Name( ExprName { range: 1608..1612, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -2309,7 +2309,7 @@ Module( Name( ExprName { range: 1615..1616, - id: "a", + id: Name("a"), ctx: Load, }, ), @@ -2318,7 +2318,7 @@ Module( Name( ExprName { range: 1622..1623, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -2340,7 +2340,7 @@ Module( target: Name( ExprName { range: 1646..1650, - id: "type", + id: Name("type"), ctx: Store, }, ), @@ -2371,7 +2371,7 @@ Module( Name( ExprName { range: 1662..1666, - id: "type", + id: Name("type"), ctx: Store, }, ), @@ -2389,7 +2389,7 @@ Module( parameter: Parameter { range: 1676..1681, name: Identifier { - id: "query", + id: Name("query"), range: 1676..1681, }, annotation: None, @@ -2408,7 +2408,7 @@ Module( left: Name( ExprName { range: 1683..1688, - id: "query", + id: Name("query"), ctx: Load, }, ), @@ -2419,7 +2419,7 @@ Module( Name( ExprName { range: 1692..1697, - id: "event", + id: Name("event"), ctx: Load, }, ), @@ -2439,7 +2439,7 @@ Module( func: Name( ExprName { range: 1698..1703, - id: "print", + id: Name("print"), ctx: Load, }, ), @@ -2452,7 +2452,7 @@ Module( func: Name( ExprName { range: 1704..1708, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -2488,7 +2488,7 @@ Module( func: Name( ExprName { range: 1714..1718, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -2498,7 +2498,7 @@ Module( Name( ExprName { range: 1719..1723, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -2516,7 +2516,7 @@ Module( Name( ExprName { range: 1725..1726, - id: "a", + id: Name("a"), ctx: Store, }, ), @@ -2527,7 +2527,7 @@ Module( left: Name( ExprName { range: 1732..1736, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -2538,7 +2538,7 @@ Module( Name( ExprName { range: 1740..1741, - id: "C", + id: Name("C"), ctx: Load, }, ), @@ -2554,7 +2554,7 @@ Module( Name( ExprName { range: 1744..1745, - id: "a", + id: Name("a"), ctx: Store, }, ), @@ -2565,7 +2565,7 @@ Module( func: Name( ExprName { range: 1751..1755, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -2575,7 +2575,7 @@ Module( Name( ExprName { range: 1756..1757, - id: "b", + id: Name("b"), ctx: Load, }, ), @@ -2595,7 +2595,7 @@ Module( func: Name( ExprName { range: 1761..1765, - id: "type", + id: Name("type"), ctx: Load, }, ), @@ -2607,14 +2607,14 @@ 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 +2632,7 @@ Module( Name( ExprName { range: 1779..1783, - id: "type", + id: Name("type"), ctx: Store, }, ), @@ -2654,14 +2654,14 @@ 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 +2683,14 @@ 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 +2721,7 @@ Module( parameter: Parameter { range: 1821..1822, name: Identifier { - id: "x", + id: Name("x"), range: 1821..1822, }, annotation: None, @@ -2737,7 +2737,7 @@ 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 c0c307dccd81e..5ffa7409f8635 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,7 @@ Module( test: Name( ExprName { range: 6..7, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -48,7 +48,7 @@ Module( left: Name( ExprName { range: 25..26, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -70,7 +70,7 @@ Module( Name( ExprName { range: 36..37, - id: "y", + id: Name("y"), ctx: Load, }, ), @@ -109,14 +109,14 @@ 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 +143,7 @@ Module( func: Name( ExprName { range: 90..95, - id: "print", + id: Name("print"), ctx: Load, }, ), @@ -186,7 +186,7 @@ Module( func: Name( ExprName { range: 123..128, - id: "print", + id: Name("print"), ctx: Load, }, ), @@ -240,14 +240,14 @@ 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 +282,14 @@ 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 +298,7 @@ Module( Name( ExprName { range: 191..192, - id: "c", + id: Name("c"), ctx: Load, }, ), @@ -336,7 +336,7 @@ Module( parameter: Parameter { range: 211..212, name: Identifier { - id: "x", + id: Name("x"), range: 211..212, }, annotation: None, @@ -352,7 +352,7 @@ Module( body: Name( ExprName { range: 214..215, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -382,7 +382,7 @@ Module( value: Name( ExprName { range: 233..234, - id: "x", + id: Name("x"), ctx: Load, }, ), @@ -419,7 +419,7 @@ 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 cbd06ce99322e..a47b5f485f90e 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,7 @@ Module( context_expr: Name( ExprName { range: 142..146, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -50,7 +50,7 @@ Module( context_expr: Name( ExprName { range: 157..161, - id: "item", + id: Name("item"), ctx: Load, }, ), @@ -58,7 +58,7 @@ Module( Name( ExprName { range: 165..166, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -89,7 +89,7 @@ Module( context_expr: Name( ExprName { range: 177..182, - id: "item1", + id: Name("item1"), ctx: Load, }, ), @@ -100,7 +100,7 @@ Module( context_expr: Name( ExprName { range: 184..189, - id: "item2", + id: Name("item2"), ctx: Load, }, ), @@ -131,7 +131,7 @@ Module( context_expr: Name( ExprName { range: 200..205, - id: "item1", + id: Name("item1"), ctx: Load, }, ), @@ -139,7 +139,7 @@ Module( Name( ExprName { range: 209..211, - id: "f1", + id: Name("f1"), ctx: Store, }, ), @@ -150,7 +150,7 @@ Module( context_expr: Name( ExprName { range: 213..218, - id: "item2", + id: Name("item2"), ctx: Load, }, ), @@ -158,7 +158,7 @@ Module( Name( ExprName { range: 222..224, - id: "f2", + id: Name("f2"), ctx: Store, }, ), @@ -198,14 +198,14 @@ 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 +247,14 @@ 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 +264,7 @@ Module( Name( ExprName { range: 283..284, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -298,7 +298,7 @@ Module( func: Name( ExprName { range: 318..322, - id: "open", + id: Name("open"), ctx: Load, }, ), @@ -313,7 +313,7 @@ Module( Name( ExprName { range: 328..329, - id: "f", + id: Name("f"), ctx: Store, }, ), @@ -347,7 +347,7 @@ Module( func: Name( ExprName { range: 340..344, - id: "open", + id: Name("open"), ctx: Load, }, ), @@ -365,12 +365,12 @@ 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 5b26b475fce6c..50f272c73da85 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,7 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -27,7 +27,7 @@ Module( TypeParamParamSpec { range: 7..10, name: Identifier { - id: "P", + id: Name("P"), range: 9..10, }, default: None, @@ -39,7 +39,7 @@ Module( value: Name( ExprName { range: 14..17, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -51,7 +51,7 @@ Module( name: Name( ExprName { range: 23..24, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -63,14 +63,14 @@ 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 +83,7 @@ Module( value: Name( ExprName { range: 38..41, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -95,7 +95,7 @@ Module( name: Name( ExprName { range: 47..48, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -107,7 +107,7 @@ Module( TypeParamTypeVar { range: 49..50, name: Identifier { - id: "T", + id: Name("T"), range: 49..50, }, bound: None, @@ -118,7 +118,7 @@ Module( TypeParamParamSpec { range: 52..55, name: Identifier { - id: "P", + id: Name("P"), range: 54..55, }, default: None, @@ -130,7 +130,7 @@ Module( value: Name( ExprName { range: 59..62, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -142,7 +142,7 @@ Module( name: Name( ExprName { range: 68..69, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -154,7 +154,7 @@ Module( TypeParamTypeVar { range: 70..71, name: Identifier { - id: "T", + id: Name("T"), range: 70..71, }, bound: None, @@ -165,14 +165,14 @@ 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 +185,7 @@ 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 4477747d42dd8..79f83f99f8187 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,7 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -27,7 +27,7 @@ Module( TypeParamTypeVar { range: 7..8, name: Identifier { - id: "T", + id: Name("T"), range: 7..8, }, bound: None, @@ -40,7 +40,7 @@ Module( value: Name( ExprName { range: 12..15, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -52,7 +52,7 @@ Module( name: Name( ExprName { range: 21..22, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -64,7 +64,7 @@ Module( TypeParamTypeVar { range: 23..30, name: Identifier { - id: "T", + id: Name("T"), range: 23..24, }, bound: None, @@ -72,7 +72,7 @@ Module( Name( ExprName { range: 27..30, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -85,7 +85,7 @@ Module( value: Name( ExprName { range: 34..37, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -97,7 +97,7 @@ Module( name: Name( ExprName { range: 43..44, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -109,14 +109,14 @@ 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 +125,7 @@ Module( Name( ExprName { range: 54..57, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -138,7 +138,7 @@ Module( value: Name( ExprName { range: 61..64, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -150,7 +150,7 @@ Module( name: Name( ExprName { range: 70..71, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -162,7 +162,7 @@ Module( TypeParamTypeVar { range: 72..91, name: Identifier { - id: "T", + id: Name("T"), range: 72..73, }, bound: Some( @@ -173,14 +173,14 @@ 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 +194,7 @@ Module( Name( ExprName { range: 88..91, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -207,7 +207,7 @@ Module( value: Name( ExprName { range: 95..98, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -219,7 +219,7 @@ Module( name: Name( ExprName { range: 104..105, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -231,14 +231,14 @@ 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 +247,7 @@ Module( Name( ExprName { range: 115..118, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -258,7 +258,7 @@ Module( TypeParamTypeVar { range: 120..139, name: Identifier { - id: "U", + id: Name("U"), range: 120..121, }, bound: Some( @@ -269,14 +269,14 @@ 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 +290,7 @@ Module( Name( ExprName { range: 136..139, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -303,7 +303,7 @@ 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 199f094a1ca16..0c3ef6ff94a4d 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,7 @@ Module( name: Name( ExprName { range: 5..6, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -27,7 +27,7 @@ Module( TypeParamTypeVarTuple { range: 7..10, name: Identifier { - id: "Ts", + id: Name("Ts"), range: 8..10, }, default: None, @@ -39,7 +39,7 @@ Module( value: Name( ExprName { range: 14..17, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -51,7 +51,7 @@ Module( name: Name( ExprName { range: 23..24, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -63,14 +63,14 @@ 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 +83,7 @@ Module( value: Name( ExprName { range: 38..41, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -95,7 +95,7 @@ Module( name: Name( ExprName { range: 47..48, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -107,7 +107,7 @@ Module( TypeParamTypeVarTuple { range: 49..59, name: Identifier { - id: "Ts", + id: Name("Ts"), range: 50..52, }, default: Some( @@ -117,7 +117,7 @@ Module( value: Name( ExprName { range: 56..59, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -133,7 +133,7 @@ Module( value: Name( ExprName { range: 63..66, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -145,7 +145,7 @@ Module( name: Name( ExprName { range: 72..73, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -157,7 +157,7 @@ Module( TypeParamTypeVar { range: 74..75, name: Identifier { - id: "T", + id: Name("T"), range: 74..75, }, bound: None, @@ -168,7 +168,7 @@ Module( TypeParamTypeVarTuple { range: 77..80, name: Identifier { - id: "Ts", + id: Name("Ts"), range: 78..80, }, default: None, @@ -180,7 +180,7 @@ Module( value: Name( ExprName { range: 84..87, - id: "int", + id: Name("int"), ctx: Load, }, ), @@ -192,7 +192,7 @@ Module( name: Name( ExprName { range: 93..94, - id: "X", + id: Name("X"), ctx: Store, }, ), @@ -204,7 +204,7 @@ Module( TypeParamTypeVar { range: 95..96, name: Identifier { - id: "T", + id: Name("T"), range: 95..96, }, bound: None, @@ -215,14 +215,14 @@ 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 +235,7 @@ 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 6a813c55c2ccd..e1742f69899ba 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 133ad5314c859..21d5fa3ed2e25 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 { @@ -1594,7 +1595,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`. @@ -1603,7 +1604,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 { @@ -3244,9 +3245,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() { @@ -3262,16 +3263,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!( @@ -3279,19 +3280,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")] ); } } From 0cd0c9a851d3e3f9b12e3b9e698e42cc224028e1 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Sat, 29 Jun 2024 11:54:42 +0200 Subject: [PATCH 2/4] Use `CompactString` for `Identifier` --- Cargo.lock | 26 ++++++- Cargo.toml | 1 + .../rules/private_member_access.rs | 7 +- .../src/rules/pyflakes/rules/strings.rs | 4 +- .../rules/pylint/rules/no_method_decorator.rs | 2 +- .../src/rules/refurb/rules/repeated_global.rs | 2 +- crates/ruff_python_ast/Cargo.toml | 4 +- crates/ruff_python_ast/src/name.rs | 68 +++++++++++++++---- crates/ruff_python_ast/src/nodes.rs | 4 ++ crates/ruff_python_parser/Cargo.toml | 1 + .../src/parser/statement.rs | 7 +- 11 files changed, 102 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 462a77f978376..bf476acf41881 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -232,6 +232,15 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" +[[package]] +name = "castaway" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a17ed5635fc8536268e5d4de1e22e81ac34419e5f052d4d51f4e01dcc263fcc" +dependencies = [ + "rustversion", +] + [[package]] name = "cc" version = "1.0.95" @@ -436,6 +445,20 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "compact_str" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f86b9c4c00838774a6d902ef931eff7470720c51d90c2e32cfe15dc304737b3f" +dependencies = [ + "castaway", + "cfg-if", + "itoa", + "ryu", + "serde", + "static_assertions", +] + [[package]] name = "console" version = "0.15.8" @@ -2258,6 +2281,7 @@ version = "0.0.0" dependencies = [ "aho-corasick", "bitflags 2.6.0", + "compact_str", "is-macro", "itertools 0.13.0", "once_cell", @@ -2269,7 +2293,6 @@ dependencies = [ "rustc-hash 2.0.0", "schemars", "serde", - "smol_str", ] [[package]] @@ -2355,6 +2378,7 @@ dependencies = [ "anyhow", "bitflags 2.6.0", "bstr", + "compact_str", "insta", "memchr", "ruff_python_ast", diff --git a/Cargo.toml b/Cargo.toml index 613a5fd92097f..42c8f16000378 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,6 +55,7 @@ colored = { version = "2.1.0" } console_error_panic_hook = { version = "0.1.7" } console_log = { version = "1.0.0" } countme = { version = "3.0.1" } +compact_str = "0.7.1" criterion = { version = "0.5.1", default-features = false } crossbeam = { version = "0.8.4" } dashmap = { version = "5.5.3" } 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 aa592c828523b..31cec1cd48be0 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,7 +93,12 @@ pub(crate) fn private_member_access(checker: &mut Checker, expr: &Expr) { return; } - if checker.settings.flake8_self.ignore_names.contains(&attr.id) { + if checker + .settings + .flake8_self + .ignore_names + .contains(attr.id()) + { return; } diff --git a/crates/ruff_linter/src/rules/pyflakes/rules/strings.rs b/crates/ruff_linter/src/rules/pyflakes/rules/strings.rs index 811bf7c26e52f..539e14ca85399 100644 --- a/crates/ruff_linter/src/rules/pyflakes/rules/strings.rs +++ b/crates/ruff_linter/src/rules/pyflakes/rules/strings.rs @@ -747,7 +747,7 @@ pub(crate) fn string_dot_format_extra_named_arguments( let missing: Vec<(usize, &Name)> = keywords .enumerate() .filter_map(|(index, keyword)| { - if summary.keywords.contains(&keyword.id) { + if summary.keywords.contains(keyword.id()) { None } else { Some((index, &keyword.id)) @@ -863,7 +863,7 @@ pub(crate) fn string_dot_format_missing_argument( .iter() .filter_map(|k| { let Keyword { arg, .. } = &k; - arg.as_ref().map(|identifier| &identifier.id) + arg.as_ref().map(|identifier| identifier.id()) }) .collect(); 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 e6421bd2a7d49..a1648c8438a79 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 @@ -153,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.id) else { + let Some(decorator_call_statement) = explicit_decorator_calls.get(name.id()) else { continue; }; diff --git a/crates/ruff_linter/src/rules/refurb/rules/repeated_global.rs b/crates/ruff_linter/src/rules/refurb/rules/repeated_global.rs index 2e10dc0b76ada..bf2925be935a2 100644 --- a/crates/ruff_linter/src/rules/refurb/rules/repeated_global.rs +++ b/crates/ruff_linter/src/rules/refurb/rules/repeated_global.rs @@ -86,7 +86,7 @@ pub(crate) fn repeated_global(checker: &mut Checker, mut suite: &[Stmt]) { Stmt::Nonlocal(stmt) => &stmt.names, _ => unreachable!(), }) - .map(|identifier| &identifier.id) + .map(|identifier| identifier.id()) .format(", ") ), range, diff --git a/crates/ruff_python_ast/Cargo.toml b/crates/ruff_python_ast/Cargo.toml index cde90b1fbfa7c..bd41c71b676ef 100644 --- a/crates/ruff_python_ast/Cargo.toml +++ b/crates/ruff_python_ast/Cargo.toml @@ -27,10 +27,10 @@ once_cell = { workspace = true } rustc-hash = { workspace = true } schemars = { workspace = true, optional = true } serde = { workspace = true, optional = true } -smol_str = { workspace = true } +compact_str = { workspace = true } [features] -serde = ["dep:serde", "ruff_text_size/serde", "dep:ruff_cache", "smol_str/serde", "dep:ruff_macros", "dep:schemars"] +serde = ["dep:serde", "ruff_text_size/serde", "dep:ruff_cache", "compact_str/serde", "dep:ruff_macros", "dep:schemars"] [lints] workspace = true diff --git a/crates/ruff_python_ast/src/name.rs b/crates/ruff_python_ast/src/name.rs index 709b7ad881514..f6e01adf0d8c0 100644 --- a/crates/ruff_python_ast/src/name.rs +++ b/crates/ruff_python_ast/src/name.rs @@ -1,30 +1,32 @@ -use crate::{nodes, Expr}; -use std::borrow::Borrow; +use std::borrow::{Borrow, Cow}; use std::fmt::{Debug, Display, Formatter, Write}; use std::hash::{Hash, Hasher}; use std::ops::Deref; -#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] +use crate::{nodes, Expr}; + +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[cfg_attr( feature = "serde", derive(serde::Serialize, serde::Deserialize, ruff_macros::CacheKey,) )] -pub struct Name(smol_str::SmolStr); +pub struct Name(compact_str::CompactString); impl Name { #[inline] pub fn empty() -> Self { - Self(smol_str::SmolStr::new_inline("")) + Self(compact_str::CompactString::default()) } #[inline] pub fn new(name: impl AsRef) -> Self { - Self(smol_str::SmolStr::new(name)) + Self(compact_str::CompactString::new(name)) } #[inline] pub fn new_static(name: &'static str) -> Self { - Self(smol_str::SmolStr::new_static(name)) + // TODO: Use ComactString::const_new once we upgrade to 0.8 https://github.com/ParkMyCar/compact_str/pull/336 + Self(compact_str::CompactString::from(name)) } pub fn as_str(&self) -> &str { @@ -61,12 +63,52 @@ impl Borrow for Name { } } -impl From for Name -where - T: Into, -{ - fn from(value: T) -> Self { - Self(value.into()) +impl<'a> From<&'a str> for Name { + #[inline] + fn from(s: &'a str) -> Self { + Name(s.into()) + } +} + +impl From for Name { + #[inline] + fn from(s: String) -> Self { + Name(s.into()) + } +} + +impl<'a> From<&'a String> for Name { + #[inline] + fn from(s: &'a String) -> Self { + Name(s.into()) + } +} + +impl<'a> From> for Name { + #[inline] + fn from(cow: Cow<'a, str>) -> Self { + Name(cow.into()) + } +} + +impl From> for Name { + #[inline] + fn from(b: Box) -> Self { + Name(b.into()) + } +} + +impl From for Name { + #[inline] + fn from(value: compact_str::CompactString) -> Self { + Self(value) + } +} + +impl From for compact_str::CompactString { + #[inline] + fn from(name: Name) -> Self { + name.0 } } diff --git a/crates/ruff_python_ast/src/nodes.rs b/crates/ruff_python_ast/src/nodes.rs index e8dbc969f1751..5e6308d0867e3 100644 --- a/crates/ruff_python_ast/src/nodes.rs +++ b/crates/ruff_python_ast/src/nodes.rs @@ -3777,6 +3777,10 @@ impl Identifier { } } + pub fn id(&self) -> &Name { + &self.id + } + pub fn is_valid(&self) -> bool { !self.id.is_empty() } diff --git a/crates/ruff_python_parser/Cargo.toml b/crates/ruff_python_parser/Cargo.toml index 834baac8532f8..a74a93143e28d 100644 --- a/crates/ruff_python_parser/Cargo.toml +++ b/crates/ruff_python_parser/Cargo.toml @@ -19,6 +19,7 @@ ruff_text_size = { workspace = true } bitflags = { workspace = true } bstr = { workspace = true } +compact_str = { workspace = true } memchr = { workspace = true } rustc-hash = { workspace = true } static_assertions = { workspace = true } diff --git a/crates/ruff_python_parser/src/parser/statement.rs b/crates/ruff_python_parser/src/parser/statement.rs index d09183b8eeba2..e10487e18c9c3 100644 --- a/crates/ruff_python_parser/src/parser/statement.rs +++ b/crates/ruff_python_parser/src/parser/statement.rs @@ -1,3 +1,4 @@ +use compact_str::CompactString; use std::fmt::Display; use rustc_hash::{FxBuildHasher, FxHashSet}; @@ -624,7 +625,7 @@ impl<'src> Parser<'src> { let range = self.node_range(start); return ast::Alias { name: ast::Identifier { - id: "*".into(), + id: Name::new_static("*"), range, }, asname: None, @@ -670,7 +671,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.to_string(); + let mut dotted_name: CompactString = self.parse_identifier().id.into(); let mut progress = ParserProgress::default(); while self.eat(TokenKind::Dot) { @@ -687,7 +688,7 @@ impl<'src> Parser<'src> { // import a.b.c // import a . b . c ast::Identifier { - id: Name::new(dotted_name), + id: Name::from(dotted_name), range: self.node_range(start), } } From 4ffd07e592359672260b75b3fc9af0c1c694e740 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Mon, 1 Jul 2024 09:32:02 +0200 Subject: [PATCH 3/4] Clippy and code review comments --- .../src/semantic_index/builder.rs | 8 ++++---- crates/ruff_linter/src/rules/pyflakes/rules/strings.rs | 2 +- .../ruff_linter/src/rules/refurb/rules/repeated_global.rs | 2 +- crates/ruff_python_ast/src/name.rs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) 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 32e152399e289..e491e3408d87f 100644 --- a/crates/red_knot_python_semantic/src/semantic_index/builder.rs +++ b/crates/red_knot_python_semantic/src/semantic_index/builder.rs @@ -242,7 +242,7 @@ impl Visitor<'_> for SemanticIndexBuilder<'_> { ); self.with_type_params( - &name, + name, &WithTypeParams::FunctionDef { node: function_def, id: AstId::new(scope, function_id), @@ -256,7 +256,7 @@ impl Visitor<'_> for SemanticIndexBuilder<'_> { builder.push_scope( NodeWithScopeId::Function(AstId::new(scope, function_id)), - &name, + name, Some(symbol), Some(definition), ); @@ -279,7 +279,7 @@ impl Visitor<'_> for SemanticIndexBuilder<'_> { self.add_or_update_symbol_with_definition(name.clone(), definition), ); self.with_type_params( - &name, + name, &WithTypeParams::ClassDef { node: class, id: AstId::new(scope, class_id), @@ -292,7 +292,7 @@ impl Visitor<'_> for SemanticIndexBuilder<'_> { builder.push_scope( NodeWithScopeId::Class(AstId::new(scope, class_id)), - &name, + name, Some(id), Some(definition), ); diff --git a/crates/ruff_linter/src/rules/pyflakes/rules/strings.rs b/crates/ruff_linter/src/rules/pyflakes/rules/strings.rs index 539e14ca85399..755d0c4c31e12 100644 --- a/crates/ruff_linter/src/rules/pyflakes/rules/strings.rs +++ b/crates/ruff_linter/src/rules/pyflakes/rules/strings.rs @@ -863,7 +863,7 @@ pub(crate) fn string_dot_format_missing_argument( .iter() .filter_map(|k| { let Keyword { arg, .. } = &k; - arg.as_ref().map(|identifier| identifier.id()) + arg.as_ref().map(ruff_python_ast::Identifier::id) }) .collect(); diff --git a/crates/ruff_linter/src/rules/refurb/rules/repeated_global.rs b/crates/ruff_linter/src/rules/refurb/rules/repeated_global.rs index bf2925be935a2..2e1deb0065d65 100644 --- a/crates/ruff_linter/src/rules/refurb/rules/repeated_global.rs +++ b/crates/ruff_linter/src/rules/refurb/rules/repeated_global.rs @@ -86,7 +86,7 @@ pub(crate) fn repeated_global(checker: &mut Checker, mut suite: &[Stmt]) { Stmt::Nonlocal(stmt) => &stmt.names, _ => unreachable!(), }) - .map(|identifier| identifier.id()) + .map(ruff_python_ast::Identifier::id) .format(", ") ), range, diff --git a/crates/ruff_python_ast/src/name.rs b/crates/ruff_python_ast/src/name.rs index f6e01adf0d8c0..6c008da1a21a3 100644 --- a/crates/ruff_python_ast/src/name.rs +++ b/crates/ruff_python_ast/src/name.rs @@ -8,7 +8,7 @@ use crate::{nodes, Expr}; #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[cfg_attr( feature = "serde", - derive(serde::Serialize, serde::Deserialize, ruff_macros::CacheKey,) + derive(serde::Serialize, serde::Deserialize, ruff_macros::CacheKey) )] pub struct Name(compact_str::CompactString); @@ -25,7 +25,7 @@ impl Name { #[inline] pub fn new_static(name: &'static str) -> Self { - // TODO: Use ComactString::const_new once we upgrade to 0.8 https://github.com/ParkMyCar/compact_str/pull/336 + // TODO(Micha): Use CompactString::const_new once we upgrade to 0.8 https://github.com/ParkMyCar/compact_str/pull/336 Self(compact_str::CompactString::from(name)) } From 43ea86c23bb925225cf5bb039a7680eb25630770 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Mon, 1 Jul 2024 09:48:32 +0200 Subject: [PATCH 4/4] Use `ruff_python_ast::Name` in `red_knot` crate --- crates/red_knot/src/lib.rs | 40 -------------------- crates/red_knot/src/semantic.rs | 3 +- crates/red_knot/src/semantic/definitions.rs | 2 +- crates/red_knot/src/semantic/symbol_table.rs | 2 +- crates/red_knot/src/semantic/types.rs | 3 +- crates/red_knot/src/semantic/types/infer.rs | 8 ++-- 6 files changed, 9 insertions(+), 49 deletions(-) diff --git a/crates/red_knot/src/lib.rs b/crates/red_knot/src/lib.rs index 126c21789d5cb..b04d8ed8a56d6 100644 --- a/crates/red_knot/src/lib.rs +++ b/crates/red_knot/src/lib.rs @@ -1,6 +1,4 @@ -use std::fmt::Formatter; use std::hash::BuildHasherDefault; -use std::ops::Deref; use std::path::{Path, PathBuf}; use rustc_hash::{FxHashSet, FxHasher}; @@ -68,41 +66,3 @@ impl Workspace { self.open_files.contains(&file_id) } } - -#[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)) - } - - 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 Formatter<'_>) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} diff --git a/crates/red_knot/src/semantic.rs b/crates/red_knot/src/semantic.rs index 0af2f9beefe10..73d57c8e33adf 100644 --- a/crates/red_knot/src/semantic.rs +++ b/crates/red_knot/src/semantic.rs @@ -11,7 +11,6 @@ use crate::files::FileId; use crate::module::Module; use crate::module::ModuleName; use crate::parse::parse; -use crate::Name; pub(crate) use definitions::Definition; use definitions::{ImportDefinition, ImportFromDefinition}; pub(crate) use flow_graph::ConstrainedDefinition; @@ -437,7 +436,7 @@ impl SourceOrderVisitor<'_> for SemanticIndexer { }; let def = Definition::ImportFrom(ImportFromDefinition { module: module.clone(), - name: Name::new(&alias.name.id), + name: alias.name.id.clone(), level: *level, }); self.add_or_update_symbol_with_def(symbol_name, def); diff --git a/crates/red_knot/src/semantic/definitions.rs b/crates/red_knot/src/semantic/definitions.rs index b1bd7a3ca2f1e..149fcb4bf2845 100644 --- a/crates/red_knot/src/semantic/definitions.rs +++ b/crates/red_knot/src/semantic/definitions.rs @@ -1,7 +1,7 @@ use crate::ast_ids::TypedNodeKey; use crate::semantic::ModuleName; -use crate::Name; use ruff_python_ast as ast; +use ruff_python_ast::name::Name; // TODO storing TypedNodeKey for definitions means we have to search to find them again in the AST; // this is at best O(log n). If looking up definitions is a bottleneck we should look for diff --git a/crates/red_knot/src/semantic/symbol_table.rs b/crates/red_knot/src/semantic/symbol_table.rs index bb57f19bea29f..a272a6ae4e075 100644 --- a/crates/red_knot/src/semantic/symbol_table.rs +++ b/crates/red_knot/src/semantic/symbol_table.rs @@ -9,11 +9,11 @@ use hashbrown::hash_map::{Keys, RawEntryMut}; use rustc_hash::{FxHashMap, FxHasher}; use ruff_index::{newtype_index, IndexVec}; +use ruff_python_ast::name::Name; use crate::ast_ids::NodeKey; use crate::module::ModuleName; use crate::semantic::{Definition, ExpressionId}; -use crate::Name; type Map = hashbrown::HashMap; diff --git a/crates/red_knot/src/semantic/types.rs b/crates/red_knot/src/semantic/types.rs index f6c4288f09776..a9bf11241b897 100644 --- a/crates/red_knot/src/semantic/types.rs +++ b/crates/red_knot/src/semantic/types.rs @@ -6,7 +6,7 @@ use crate::module::{Module, ModuleName}; use crate::semantic::{ resolve_global_symbol, semantic_index, GlobalSymbolId, ScopeId, ScopeKind, SymbolId, }; -use crate::{FxDashMap, FxIndexSet, Name}; +use crate::{FxDashMap, FxIndexSet}; use ruff_index::{newtype_index, IndexVec}; use ruff_python_ast as ast; use rustc_hash::FxHashMap; @@ -14,6 +14,7 @@ use rustc_hash::FxHashMap; pub(crate) mod infer; pub(crate) use infer::{infer_definition_type, infer_symbol_public_type}; +use ruff_python_ast::name::Name; /// unique ID for a type #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] diff --git a/crates/red_knot/src/semantic/types/infer.rs b/crates/red_knot/src/semantic/types/infer.rs index 3e671912bc862..1aa8ac8808762 100644 --- a/crates/red_knot/src/semantic/types/infer.rs +++ b/crates/red_knot/src/semantic/types/infer.rs @@ -13,7 +13,7 @@ use crate::semantic::{ resolve_global_symbol, semantic_index, ConstrainedDefinition, Definition, GlobalSymbolId, ImportDefinition, ImportFromDefinition, }; -use crate::{FileId, Name}; +use crate::FileId; // FIXME: Figure out proper dead-lock free synchronisation now that this takes `&db` instead of `&mut db`. /// Resolve the public-facing type for a symbol (the type seen by other scopes: other modules, or @@ -315,7 +315,7 @@ fn infer_expr_type(db: &dyn SemanticDb, file_id: FileId, expr: &ast::Expr) -> Qu } ast::Expr::Attribute(ast::ExprAttribute { value, attr, .. }) => { let value_type = infer_expr_type(db, file_id, value)?; - let attr_name = &Name::new(&attr.id); + let attr_name = &attr.id; value_type .get_member(db, attr_name) .map(|ty| ty.unwrap_or(Type::Unknown)) @@ -343,6 +343,7 @@ fn infer_expr_type(db: &dyn SemanticDb, file_id: FileId, expr: &ast::Expr) -> Qu #[cfg(test)] mod tests { + use ruff_python_ast::name::Name; use std::path::PathBuf; use crate::db::tests::TestDb; @@ -351,7 +352,6 @@ mod tests { resolve_module, set_module_search_paths, ModuleName, ModuleResolutionInputs, }; use crate::semantic::{infer_symbol_public_type, resolve_global_symbol, Type}; - use crate::Name; // TODO with virtual filesystem we shouldn't have to write files to disk for these // tests @@ -476,7 +476,7 @@ mod tests { }; let member_ty = class_id - .get_own_class_member(&case.db, &Name::new("f")) + .get_own_class_member(&case.db, &Name::new_static("f")) .expect("C.f to resolve"); let Some(Type::Function(func_id)) = member_ty else {