From cb863390f23bc2eac6561d55def9bd3ba54605fc Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Fri, 15 Jan 2021 18:57:32 +0100 Subject: Handle self/super/crate in PathSegment as NameRef --- .../syntax/test_data/parser/err/0018_incomplete_fn.rast | 6 ++++-- crates/syntax/test_data/parser/err/0035_use_recover.rast | 3 ++- .../parser/err/0040_illegal_crate_kw_location.rast | 15 ++++++++++----- .../parser/err/0041_illegal_super_keyword_location.rast | 15 ++++++++++----- .../parser/err/0042_illegal_self_keyword_location.rast | 6 ++++-- .../test_data/parser/inline/err/0015_empty_segment.rast | 3 ++- .../test_data/parser/inline/ok/0002_use_tree_list.rast | 3 ++- .../syntax/test_data/parser/inline/ok/0052_path_type.rast | 6 ++++-- .../test_data/parser/inline/ok/0062_mod_contents.rast | 3 ++- .../test_data/parser/inline/ok/0067_crate_path.rast | 3 ++- .../parser/inline/ok/0069_use_tree_list_after_path.rast | 6 ++++-- .../test_data/parser/inline/ok/0117_macro_call_type.rast | 3 ++- .../parser/inline/ok/0125_crate_keyword_path.rast | 3 ++- .../parser/inline/ok/0153_pub_parens_typepath.rast | 6 ++++-- .../test_data/parser/ok/0013_use_path_self_super.rast | 9 ++++++--- .../test_data/parser/ok/0020_type_param_bounds.rast | 3 ++- .../test_data/parser/ok/0034_crate_path_in_call.rast | 3 ++- 17 files changed, 64 insertions(+), 32 deletions(-) (limited to 'crates/syntax/test_data') diff --git a/crates/syntax/test_data/parser/err/0018_incomplete_fn.rast b/crates/syntax/test_data/parser/err/0018_incomplete_fn.rast index 72939fc98..060f47dc4 100644 --- a/crates/syntax/test_data/parser/err/0018_incomplete_fn.rast +++ b/crates/syntax/test_data/parser/err/0018_incomplete_fn.rast @@ -49,7 +49,8 @@ SOURCE_FILE@0..183 PATH_EXPR@67..71 PATH@67..71 PATH_SEGMENT@67..71 - SELF_KW@67..71 "self" + NAME_REF@67..71 + SELF_KW@67..71 "self" DOT@71..72 "." NAME_REF@72..78 IDENT@72..78 "scopes" @@ -66,7 +67,8 @@ SOURCE_FILE@0..183 PATH_EXPR@94..98 PATH@94..98 PATH_SEGMENT@94..98 - SELF_KW@94..98 "self" + NAME_REF@94..98 + SELF_KW@94..98 "self" DOT@98..99 "." NAME_REF@99..105 IDENT@99..105 "scopes" diff --git a/crates/syntax/test_data/parser/err/0035_use_recover.rast b/crates/syntax/test_data/parser/err/0035_use_recover.rast index 2f03709eb..a95151bc5 100644 --- a/crates/syntax/test_data/parser/err/0035_use_recover.rast +++ b/crates/syntax/test_data/parser/err/0035_use_recover.rast @@ -24,7 +24,8 @@ SOURCE_FILE@0..48 PATH@22..32 PATH@22..27 PATH_SEGMENT@22..27 - CRATE_KW@22..27 "crate" + NAME_REF@22..27 + CRATE_KW@22..27 "crate" COLON2@27..29 "::" PATH_SEGMENT@29..32 NAME_REF@29..32 diff --git a/crates/syntax/test_data/parser/err/0040_illegal_crate_kw_location.rast b/crates/syntax/test_data/parser/err/0040_illegal_crate_kw_location.rast index 284c8715b..7449b5ddf 100644 --- a/crates/syntax/test_data/parser/err/0040_illegal_crate_kw_location.rast +++ b/crates/syntax/test_data/parser/err/0040_illegal_crate_kw_location.rast @@ -6,7 +6,8 @@ SOURCE_FILE@0..98 PATH@4..11 PATH_SEGMENT@4..11 COLON2@4..6 "::" - CRATE_KW@6..11 "crate" + NAME_REF@6..11 + CRATE_KW@6..11 "crate" SEMICOLON@11..12 ";" WHITESPACE@12..13 "\n" USE@13..54 @@ -18,7 +19,8 @@ SOURCE_FILE@0..98 USE_TREE@18..23 PATH@18..23 PATH_SEGMENT@18..23 - CRATE_KW@18..23 "crate" + NAME_REF@18..23 + CRATE_KW@18..23 "crate" COMMA@23..24 "," WHITESPACE@24..25 " " USE_TREE@25..52 @@ -35,7 +37,8 @@ SOURCE_FILE@0..98 PATH@31..41 PATH@31..36 PATH_SEGMENT@31..36 - CRATE_KW@31..36 "crate" + NAME_REF@31..36 + CRATE_KW@31..36 "crate" COLON2@36..38 "::" PATH_SEGMENT@38..41 NAME_REF@38..41 @@ -63,7 +66,8 @@ SOURCE_FILE@0..98 IDENT@59..64 "hello" COLON2@64..66 "::" PATH_SEGMENT@66..71 - CRATE_KW@66..71 "crate" + NAME_REF@66..71 + CRATE_KW@66..71 "crate" SEMICOLON@71..72 ";" WHITESPACE@72..73 "\n" USE@73..97 @@ -78,7 +82,8 @@ SOURCE_FILE@0..98 IDENT@77..82 "hello" COLON2@82..84 "::" PATH_SEGMENT@84..89 - CRATE_KW@84..89 "crate" + NAME_REF@84..89 + CRATE_KW@84..89 "crate" COLON2@89..91 "::" PATH_SEGMENT@91..96 NAME_REF@91..96 diff --git a/crates/syntax/test_data/parser/err/0041_illegal_super_keyword_location.rast b/crates/syntax/test_data/parser/err/0041_illegal_super_keyword_location.rast index 2049a9d72..271f8d780 100644 --- a/crates/syntax/test_data/parser/err/0041_illegal_super_keyword_location.rast +++ b/crates/syntax/test_data/parser/err/0041_illegal_super_keyword_location.rast @@ -6,7 +6,8 @@ SOURCE_FILE@0..67 PATH@4..11 PATH_SEGMENT@4..11 COLON2@4..6 "::" - SUPER_KW@6..11 "super" + NAME_REF@6..11 + SUPER_KW@6..11 "super" SEMICOLON@11..12 ";" WHITESPACE@12..13 "\n" USE@13..26 @@ -20,7 +21,8 @@ SOURCE_FILE@0..67 IDENT@17..18 "a" COLON2@18..20 "::" PATH_SEGMENT@20..25 - SUPER_KW@20..25 "super" + NAME_REF@20..25 + SUPER_KW@20..25 "super" SEMICOLON@25..26 ";" WHITESPACE@26..27 "\n" USE@27..47 @@ -31,14 +33,16 @@ SOURCE_FILE@0..67 PATH@31..39 PATH@31..36 PATH_SEGMENT@31..36 - SUPER_KW@31..36 "super" + NAME_REF@31..36 + SUPER_KW@31..36 "super" COLON2@36..38 "::" PATH_SEGMENT@38..39 NAME_REF@38..39 IDENT@38..39 "a" COLON2@39..41 "::" PATH_SEGMENT@41..46 - SUPER_KW@41..46 "super" + NAME_REF@41..46 + SUPER_KW@41..46 "super" SEMICOLON@46..47 ";" WHITESPACE@47..48 "\n" USE@48..66 @@ -56,7 +60,8 @@ SOURCE_FILE@0..67 PATH@56..64 PATH@56..61 PATH_SEGMENT@56..61 - SUPER_KW@56..61 "super" + NAME_REF@56..61 + SUPER_KW@56..61 "super" COLON2@61..63 "::" PATH_SEGMENT@63..64 NAME_REF@63..64 diff --git a/crates/syntax/test_data/parser/err/0042_illegal_self_keyword_location.rast b/crates/syntax/test_data/parser/err/0042_illegal_self_keyword_location.rast index deadf56b4..01f601091 100644 --- a/crates/syntax/test_data/parser/err/0042_illegal_self_keyword_location.rast +++ b/crates/syntax/test_data/parser/err/0042_illegal_self_keyword_location.rast @@ -6,7 +6,8 @@ SOURCE_FILE@0..25 PATH@4..10 PATH_SEGMENT@4..10 COLON2@4..6 "::" - SELF_KW@6..10 "self" + NAME_REF@6..10 + SELF_KW@6..10 "self" SEMICOLON@10..11 ";" WHITESPACE@11..12 "\n" USE@12..24 @@ -20,7 +21,8 @@ SOURCE_FILE@0..25 IDENT@16..17 "a" COLON2@17..19 "::" PATH_SEGMENT@19..23 - SELF_KW@19..23 "self" + NAME_REF@19..23 + SELF_KW@19..23 "self" SEMICOLON@23..24 ";" WHITESPACE@24..25 "\n" error 6..10: The `self` keyword is only allowed as the first segment of a path diff --git a/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rast b/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rast index e872526d9..d3c5dde58 100644 --- a/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rast +++ b/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rast @@ -6,7 +6,8 @@ SOURCE_FILE@0..13 PATH@4..11 PATH@4..9 PATH_SEGMENT@4..9 - CRATE_KW@4..9 "crate" + NAME_REF@4..9 + CRATE_KW@4..9 "crate" COLON2@9..11 "::" SEMICOLON@11..12 ";" WHITESPACE@12..13 "\n" diff --git a/crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rast b/crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rast index f40500e38..970826739 100644 --- a/crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rast +++ b/crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rast @@ -11,7 +11,8 @@ SOURCE_FILE@0..248 PATH@5..16 PATH@5..10 PATH_SEGMENT@5..10 - CRATE_KW@5..10 "crate" + NAME_REF@5..10 + CRATE_KW@5..10 "crate" COLON2@10..12 "::" PATH_SEGMENT@12..16 NAME_REF@12..16 diff --git a/crates/syntax/test_data/parser/inline/ok/0052_path_type.rast b/crates/syntax/test_data/parser/inline/ok/0052_path_type.rast index 9bc36bea7..46a103d5b 100644 --- a/crates/syntax/test_data/parser/inline/ok/0052_path_type.rast +++ b/crates/syntax/test_data/parser/inline/ok/0052_path_type.rast @@ -42,7 +42,8 @@ SOURCE_FILE@0..71 PATH@39..48 PATH@39..43 PATH_SEGMENT@39..43 - SELF_KW@39..43 "self" + NAME_REF@39..43 + SELF_KW@39..43 "self" COLON2@43..45 "::" PATH_SEGMENT@45..48 NAME_REF@45..48 @@ -61,7 +62,8 @@ SOURCE_FILE@0..71 PATH@59..69 PATH@59..64 PATH_SEGMENT@59..64 - SUPER_KW@59..64 "super" + NAME_REF@59..64 + SUPER_KW@59..64 "super" COLON2@64..66 "::" PATH_SEGMENT@66..69 NAME_REF@66..69 diff --git a/crates/syntax/test_data/parser/inline/ok/0062_mod_contents.rast b/crates/syntax/test_data/parser/inline/ok/0062_mod_contents.rast index e4fb32de1..583dcac7e 100644 --- a/crates/syntax/test_data/parser/inline/ok/0062_mod_contents.rast +++ b/crates/syntax/test_data/parser/inline/ok/0062_mod_contents.rast @@ -43,7 +43,8 @@ SOURCE_FILE@0..70 PATH@45..55 PATH@45..50 PATH_SEGMENT@45..50 - SUPER_KW@45..50 "super" + NAME_REF@45..50 + SUPER_KW@45..50 "super" COLON2@50..52 "::" PATH_SEGMENT@52..55 NAME_REF@52..55 diff --git a/crates/syntax/test_data/parser/inline/ok/0067_crate_path.rast b/crates/syntax/test_data/parser/inline/ok/0067_crate_path.rast index 702f2e0b0..87c0c48dc 100644 --- a/crates/syntax/test_data/parser/inline/ok/0067_crate_path.rast +++ b/crates/syntax/test_data/parser/inline/ok/0067_crate_path.rast @@ -6,7 +6,8 @@ SOURCE_FILE@0..16 PATH@4..14 PATH@4..9 PATH_SEGMENT@4..9 - CRATE_KW@4..9 "crate" + NAME_REF@4..9 + CRATE_KW@4..9 "crate" COLON2@9..11 "::" PATH_SEGMENT@11..14 NAME_REF@11..14 diff --git a/crates/syntax/test_data/parser/inline/ok/0069_use_tree_list_after_path.rast b/crates/syntax/test_data/parser/inline/ok/0069_use_tree_list_after_path.rast index c4c5bc51e..192a9cca6 100644 --- a/crates/syntax/test_data/parser/inline/ok/0069_use_tree_list_after_path.rast +++ b/crates/syntax/test_data/parser/inline/ok/0069_use_tree_list_after_path.rast @@ -5,7 +5,8 @@ SOURCE_FILE@0..37 USE_TREE@4..17 PATH@4..9 PATH_SEGMENT@4..9 - CRATE_KW@4..9 "crate" + NAME_REF@4..9 + CRATE_KW@4..9 "crate" COLON2@9..11 "::" USE_TREE_LIST@11..17 L_CURLY@11..12 "{" @@ -23,7 +24,8 @@ SOURCE_FILE@0..37 USE_TREE@23..35 PATH@23..27 PATH_SEGMENT@23..27 - SELF_KW@23..27 "self" + NAME_REF@23..27 + SELF_KW@23..27 "self" COLON2@27..29 "::" USE_TREE_LIST@29..35 L_CURLY@29..30 "{" diff --git a/crates/syntax/test_data/parser/inline/ok/0117_macro_call_type.rast b/crates/syntax/test_data/parser/inline/ok/0117_macro_call_type.rast index f3d4ad72c..3016a6574 100644 --- a/crates/syntax/test_data/parser/inline/ok/0117_macro_call_type.rast +++ b/crates/syntax/test_data/parser/inline/ok/0117_macro_call_type.rast @@ -30,7 +30,8 @@ SOURCE_FILE@0..41 PATH@26..36 PATH@26..31 PATH_SEGMENT@26..31 - CRATE_KW@26..31 "crate" + NAME_REF@26..31 + CRATE_KW@26..31 "crate" COLON2@31..33 "::" PATH_SEGMENT@33..36 NAME_REF@33..36 diff --git a/crates/syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rast b/crates/syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rast index aa4d7a784..0fed2d311 100644 --- a/crates/syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rast +++ b/crates/syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rast @@ -17,7 +17,8 @@ SOURCE_FILE@0..27 PATH@11..21 PATH@11..16 PATH_SEGMENT@11..16 - CRATE_KW@11..16 "crate" + NAME_REF@11..16 + CRATE_KW@11..16 "crate" COLON2@16..18 "::" PATH_SEGMENT@18..21 NAME_REF@18..21 diff --git a/crates/syntax/test_data/parser/inline/ok/0153_pub_parens_typepath.rast b/crates/syntax/test_data/parser/inline/ok/0153_pub_parens_typepath.rast index c204f0e2d..a5ee07499 100644 --- a/crates/syntax/test_data/parser/inline/ok/0153_pub_parens_typepath.rast +++ b/crates/syntax/test_data/parser/inline/ok/0153_pub_parens_typepath.rast @@ -16,7 +16,8 @@ SOURCE_FILE@0..53 PATH@14..22 PATH@14..19 PATH_SEGMENT@14..19 - SUPER_KW@14..19 "super" + NAME_REF@14..19 + SUPER_KW@14..19 "super" COLON2@19..21 "::" PATH_SEGMENT@21..22 NAME_REF@21..22 @@ -42,7 +43,8 @@ SOURCE_FILE@0..53 PATH@40..48 PATH@40..45 PATH_SEGMENT@40..45 - CRATE_KW@40..45 "crate" + NAME_REF@40..45 + CRATE_KW@40..45 "crate" COLON2@45..47 "::" PATH_SEGMENT@47..48 NAME_REF@47..48 diff --git a/crates/syntax/test_data/parser/ok/0013_use_path_self_super.rast b/crates/syntax/test_data/parser/ok/0013_use_path_self_super.rast index 66ab13660..dba74e222 100644 --- a/crates/syntax/test_data/parser/ok/0013_use_path_self_super.rast +++ b/crates/syntax/test_data/parser/ok/0013_use_path_self_super.rast @@ -6,7 +6,8 @@ SOURCE_FILE@0..38 PATH@4..13 PATH@4..8 PATH_SEGMENT@4..8 - SELF_KW@4..8 "self" + NAME_REF@4..8 + SELF_KW@4..8 "self" COLON2@8..10 "::" PATH_SEGMENT@10..13 NAME_REF@10..13 @@ -21,10 +22,12 @@ SOURCE_FILE@0..38 PATH@19..31 PATH@19..24 PATH_SEGMENT@19..24 - SUPER_KW@19..24 "super" + NAME_REF@19..24 + SUPER_KW@19..24 "super" COLON2@24..26 "::" PATH_SEGMENT@26..31 - SUPER_KW@26..31 "super" + NAME_REF@26..31 + SUPER_KW@26..31 "super" COLON2@31..33 "::" PATH_SEGMENT@33..36 NAME_REF@33..36 diff --git a/crates/syntax/test_data/parser/ok/0020_type_param_bounds.rast b/crates/syntax/test_data/parser/ok/0020_type_param_bounds.rast index 0612a71de..21c564a20 100644 --- a/crates/syntax/test_data/parser/ok/0020_type_param_bounds.rast +++ b/crates/syntax/test_data/parser/ok/0020_type_param_bounds.rast @@ -187,7 +187,8 @@ SOURCE_FILE@0..250 PATH@164..173 PATH@164..168 PATH_SEGMENT@164..168 - SELF_KW@164..168 "self" + NAME_REF@164..168 + SELF_KW@164..168 "self" COLON2@168..170 "::" PATH_SEGMENT@170..173 NAME_REF@170..173 diff --git a/crates/syntax/test_data/parser/ok/0034_crate_path_in_call.rast b/crates/syntax/test_data/parser/ok/0034_crate_path_in_call.rast index 5ad8c570d..a0a5ca7f5 100644 --- a/crates/syntax/test_data/parser/ok/0034_crate_path_in_call.rast +++ b/crates/syntax/test_data/parser/ok/0034_crate_path_in_call.rast @@ -25,7 +25,8 @@ SOURCE_FILE@0..62 PATH@27..44 PATH@27..32 PATH_SEGMENT@27..32 - CRATE_KW@27..32 "crate" + NAME_REF@27..32 + CRATE_KW@27..32 "crate" COLON2@32..34 "::" PATH_SEGMENT@34..44 NAME_REF@34..44 -- cgit v1.2.3