aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-04-06 00:24:11 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-04-06 00:24:11 +0100
commit990e74ba7c77485f914434ac6f09a40d1364634d (patch)
tree9e979e9ec084d717db9d4326df3a970db8d28947 /crates/ra_parser
parent9d39b7bc42e6186b0fd6e1cec746d58c950f780e (diff)
parent2caa690ef6feba3f78354e715deea37983b149ac (diff)
Merge #1117
1117: [WIP] Tuple struct index inference r=matklad a=robojumper The first commit adds a helper struct `ast::FieldKind` to facilitate inference. The second commit adds a slightly modified test from #1109 while mentioning that there is a problem with how we're handling tuple indexing / floats. cc #1109 Co-authored-by: robojumper <[email protected]>
Diffstat (limited to 'crates/ra_parser')
-rw-r--r--crates/ra_parser/src/grammar/expressions.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs
index bf5d6544d..9b38b0a31 100644
--- a/crates/ra_parser/src/grammar/expressions.rs
+++ b/crates/ra_parser/src/grammar/expressions.rs
@@ -379,6 +379,14 @@ fn method_call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker {
379// fn foo() { 379// fn foo() {
380// x.foo; 380// x.foo;
381// x.0.bar; 381// x.0.bar;
382// x.0();
383// }
384
385// test_err bad_tuple_index_expr
386// fn foo() {
387// x.0.;
388// x.1i32;
389// x.0x01;
382// } 390// }
383fn field_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { 391fn field_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker {
384 assert!(p.at(DOT)); 392 assert!(p.at(DOT));
@@ -387,7 +395,10 @@ fn field_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker {
387 if p.at(IDENT) { 395 if p.at(IDENT) {
388 name_ref(p) 396 name_ref(p)
389 } else if p.at(INT_NUMBER) { 397 } else if p.at(INT_NUMBER) {
390 p.bump() 398 p.bump();
399 } else if p.at(FLOAT_NUMBER) {
400 // FIXME: How to recover and instead parse INT + DOT?
401 p.bump();
391 } else { 402 } else {
392 p.error("expected field name or number") 403 p.error("expected field name or number")
393 } 404 }