diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-06 00:24:11 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-06 00:24:11 +0100 |
commit | 990e74ba7c77485f914434ac6f09a40d1364634d (patch) | |
tree | 9e979e9ec084d717db9d4326df3a970db8d28947 /crates/ra_syntax/src/validation | |
parent | 9d39b7bc42e6186b0fd6e1cec746d58c950f780e (diff) | |
parent | 2caa690ef6feba3f78354e715deea37983b149ac (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_syntax/src/validation')
-rw-r--r-- | crates/ra_syntax/src/validation/field_expr.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/validation/field_expr.rs b/crates/ra_syntax/src/validation/field_expr.rs new file mode 100644 index 000000000..2b405062e --- /dev/null +++ b/crates/ra_syntax/src/validation/field_expr.rs | |||
@@ -0,0 +1,12 @@ | |||
1 | use crate::{ast::{self, FieldKind}, | ||
2 | SyntaxError, | ||
3 | SyntaxErrorKind::*, | ||
4 | }; | ||
5 | |||
6 | pub(crate) fn validate_field_expr_node(node: &ast::FieldExpr, errors: &mut Vec<SyntaxError>) { | ||
7 | if let Some(FieldKind::Index(idx)) = node.field_access() { | ||
8 | if idx.text().chars().any(|c| c < '0' || c > '9') { | ||
9 | errors.push(SyntaxError::new(InvalidTupleIndexFormat, idx.range())); | ||
10 | } | ||
11 | } | ||
12 | } | ||