From 9149fd2c0ca3d23719082852a2cddd8ba5804ce6 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 13 Aug 2018 18:23:14 +0300 Subject: Fix some parser bugs --- .../data/parser/err/0004_use_path_bad_segment.txt | 16 +++++------ .../tests/data/parser/err/0014_where_no_bounds.rs | 1 + .../tests/data/parser/err/0014_where_no_bounds.txt | 31 ++++++++++++++++++++++ 3 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 crates/libsyntax2/tests/data/parser/err/0014_where_no_bounds.rs create mode 100644 crates/libsyntax2/tests/data/parser/err/0014_where_no_bounds.txt (limited to 'crates/libsyntax2/tests/data/parser/err') diff --git a/crates/libsyntax2/tests/data/parser/err/0004_use_path_bad_segment.txt b/crates/libsyntax2/tests/data/parser/err/0004_use_path_bad_segment.txt index c6ae68103..64aa07801 100644 --- a/crates/libsyntax2/tests/data/parser/err/0004_use_path_bad_segment.txt +++ b/crates/libsyntax2/tests/data/parser/err/0004_use_path_bad_segment.txt @@ -1,20 +1,16 @@ FILE@[0; 12) - USE_ITEM@[0; 9) + USE_ITEM@[0; 12) USE_KW@[0; 3) WHITESPACE@[3; 4) - USE_TREE@[4; 9) - PATH@[4; 9) + USE_TREE@[4; 11) + PATH@[4; 11) PATH@[4; 7) PATH_SEGMENT@[4; 7) NAME_REF@[4; 7) IDENT@[4; 7) "foo" COLONCOLON@[7; 9) err: `expected identifier` - err: `expected SEMI` - err: `expected an item` - PATH_SEGMENT@[9; 9) - ERROR@[9; 11) - INT_NUMBER@[9; 11) "92" - err: `expected an item` - ERROR@[11; 12) + PATH_SEGMENT@[9; 11) + ERROR@[9; 11) + INT_NUMBER@[9; 11) "92" SEMI@[11; 12) diff --git a/crates/libsyntax2/tests/data/parser/err/0014_where_no_bounds.rs b/crates/libsyntax2/tests/data/parser/err/0014_where_no_bounds.rs new file mode 100644 index 000000000..75c1d2f98 --- /dev/null +++ b/crates/libsyntax2/tests/data/parser/err/0014_where_no_bounds.rs @@ -0,0 +1 @@ +fn foo() where T {} diff --git a/crates/libsyntax2/tests/data/parser/err/0014_where_no_bounds.txt b/crates/libsyntax2/tests/data/parser/err/0014_where_no_bounds.txt new file mode 100644 index 000000000..61444a88d --- /dev/null +++ b/crates/libsyntax2/tests/data/parser/err/0014_where_no_bounds.txt @@ -0,0 +1,31 @@ +FILE@[0; 23) + FUNCTION@[0; 22) + FN_KW@[0; 2) + WHITESPACE@[2; 3) + NAME@[3; 6) + IDENT@[3; 6) "foo" + TYPE_PARAM_LIST@[6; 9) + L_ANGLE@[6; 7) + TYPE_PARAM@[7; 8) + NAME@[7; 8) + IDENT@[7; 8) "T" + R_ANGLE@[8; 9) + PARAM_LIST@[9; 11) + L_PAREN@[9; 10) + R_PAREN@[10; 11) + WHITESPACE@[11; 12) + WHERE_CLAUSE@[12; 19) + WHERE_KW@[12; 17) + WHITESPACE@[17; 18) + WHERE_PRED@[18; 19) + PATH_TYPE@[18; 19) + PATH@[18; 19) + PATH_SEGMENT@[18; 19) + NAME_REF@[18; 19) + IDENT@[18; 19) "T" + err: `expected colon` + WHITESPACE@[19; 20) + BLOCK_EXPR@[20; 22) + L_CURLY@[20; 21) + R_CURLY@[21; 22) + WHITESPACE@[22; 23) -- cgit v1.2.3