aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
authorcsmoe <[email protected]>2019-06-11 14:24:14 +0100
committercsmoe <[email protected]>2019-06-12 15:32:39 +0100
commit2ca9f718978b20e8cffb669dc61b63ad7d5e82cd (patch)
tree0523b0929ac4703d1648cb0eac1fc4ea14a8b2d6 /crates/ra_syntax
parent3f5f9f0560fa662e770b607f05ec4881e4d011c5 (diff)
fix: support existential type
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/grammar.ron1
-rw-r--r--crates/ra_syntax/tests/data/parser/err/0011_extern_struct.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/err/0010_wrong_order_fns.txt4
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0131_existential_type.rs1
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0131_existential_type.txt31
5 files changed, 36 insertions, 3 deletions
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron
index 1c2714307..eab55058b 100644
--- a/crates/ra_syntax/src/grammar.ron
+++ b/crates/ra_syntax/src/grammar.ron
@@ -100,6 +100,7 @@ Grammar(
100 contextual_keywords: [ 100 contextual_keywords: [
101 "auto", 101 "auto",
102 "default", 102 "default",
103 "existential",
103 "union", 104 "union",
104 ], 105 ],
105 literals: [ 106 literals: [
diff --git a/crates/ra_syntax/tests/data/parser/err/0011_extern_struct.txt b/crates/ra_syntax/tests/data/parser/err/0011_extern_struct.txt
index 033dac2aa..381147dc0 100644
--- a/crates/ra_syntax/tests/data/parser/err/0011_extern_struct.txt
+++ b/crates/ra_syntax/tests/data/parser/err/0011_extern_struct.txt
@@ -10,4 +10,4 @@ SOURCE_FILE@[0; 19)
10 IDENT@[14; 17) "Foo" 10 IDENT@[14; 17) "Foo"
11 SEMI@[17; 18) ";" 11 SEMI@[17; 18) ";"
12 WHITESPACE@[18; 19) "\n" 12 WHITESPACE@[18; 19) "\n"
13error 6: expected fn, trait or impl 13error 6: expected existential, fn, trait or impl
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0010_wrong_order_fns.txt b/crates/ra_syntax/tests/data/parser/inline/err/0010_wrong_order_fns.txt
index 9eb4c9b36..b1ef210d3 100644
--- a/crates/ra_syntax/tests/data/parser/inline/err/0010_wrong_order_fns.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/err/0010_wrong_order_fns.txt
@@ -35,5 +35,5 @@ SOURCE_FILE@[0; 50)
35 L_CURLY@[47; 48) "{" 35 L_CURLY@[47; 48) "{"
36 R_CURLY@[48; 49) "}" 36 R_CURLY@[48; 49) "}"
37 WHITESPACE@[49; 50) "\n" 37 WHITESPACE@[49; 50) "\n"
38error 5: expected fn, trait or impl 38error 5: expected existential, fn, trait or impl
39error 31: expected fn, trait or impl 39error 31: expected existential, fn, trait or impl
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0131_existential_type.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0131_existential_type.rs
new file mode 100644
index 000000000..23baf7145
--- /dev/null
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0131_existential_type.rs
@@ -0,0 +1 @@
existential type Foo: Fn() -> usize;
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0131_existential_type.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0131_existential_type.txt
new file mode 100644
index 000000000..6bfac985a
--- /dev/null
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0131_existential_type.txt
@@ -0,0 +1,31 @@
1SOURCE_FILE@[0; 37)
2 TYPE_ALIAS_DEF@[0; 36)
3 EXISTENTIAL_KW@[0; 11) "existential"
4 WHITESPACE@[11; 12) " "
5 TYPE_KW@[12; 16) "type"
6 WHITESPACE@[16; 17) " "
7 NAME@[17; 20)
8 IDENT@[17; 20) "Foo"
9 COLON@[20; 21) ":"
10 WHITESPACE@[21; 22) " "
11 TYPE_BOUND_LIST@[22; 35)
12 TYPE_BOUND@[22; 35)
13 PATH_TYPE@[22; 35)
14 PATH@[22; 35)
15 PATH_SEGMENT@[22; 35)
16 NAME_REF@[22; 24)
17 IDENT@[22; 24) "Fn"
18 PARAM_LIST@[24; 26)
19 L_PAREN@[24; 25) "("
20 R_PAREN@[25; 26) ")"
21 WHITESPACE@[26; 27) " "
22 RET_TYPE@[27; 35)
23 THIN_ARROW@[27; 29) "->"
24 WHITESPACE@[29; 30) " "
25 PATH_TYPE@[30; 35)
26 PATH@[30; 35)
27 PATH_SEGMENT@[30; 35)
28 NAME_REF@[30; 35)
29 IDENT@[30; 35) "usize"
30 SEMI@[35; 36) ";"
31 WHITESPACE@[36; 37) "\n"