diff options
Diffstat (limited to 'crates/syntax')
-rw-r--r-- | crates/syntax/src/ast/node_ext.rs | 2 | ||||
-rw-r--r-- | crates/syntax/src/validation.rs | 4 | ||||
-rw-r--r-- | crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast | 28 | ||||
-rw-r--r-- | crates/syntax/test_data/parser/inline/ok/0039_type_arg.rs | 2 |
4 files changed, 23 insertions, 13 deletions
diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs index 2aa472fb4..27381ba80 100644 --- a/crates/syntax/src/ast/node_ext.rs +++ b/crates/syntax/src/ast/node_ext.rs | |||
@@ -133,7 +133,7 @@ impl ast::Attr { | |||
133 | first_token.and_then(|token| token.next_token()).as_ref().map(SyntaxToken::kind); | 133 | first_token.and_then(|token| token.next_token()).as_ref().map(SyntaxToken::kind); |
134 | 134 | ||
135 | match (first_token_kind, second_token_kind) { | 135 | match (first_token_kind, second_token_kind) { |
136 | (Some(SyntaxKind::POUND), Some(T![!])) => AttrKind::Inner, | 136 | (Some(T![#]), Some(T![!])) => AttrKind::Inner, |
137 | _ => AttrKind::Outer, | 137 | _ => AttrKind::Outer, |
138 | } | 138 | } |
139 | } | 139 | } |
diff --git a/crates/syntax/src/validation.rs b/crates/syntax/src/validation.rs index b3a02f4ae..bfa2dc4ba 100644 --- a/crates/syntax/src/validation.rs +++ b/crates/syntax/src/validation.rs | |||
@@ -344,9 +344,9 @@ fn validate_trait_object_ty(ty: ast::DynTraitType) -> Option<SyntaxError> { | |||
344 | 344 | ||
345 | if tbl.bounds().count() > 1 { | 345 | if tbl.bounds().count() > 1 { |
346 | let dyn_token = ty.dyn_token()?; | 346 | let dyn_token = ty.dyn_token()?; |
347 | let potential_parentheses = | 347 | let potential_parenthesis = |
348 | algo::skip_trivia_token(dyn_token.prev_token()?, Direction::Prev)?; | 348 | algo::skip_trivia_token(dyn_token.prev_token()?, Direction::Prev)?; |
349 | let kind = potential_parentheses.kind(); | 349 | let kind = potential_parenthesis.kind(); |
350 | if !matches!(kind, T!['('] | T![<] | T![=]) { | 350 | if !matches!(kind, T!['('] | T![<] | T![=]) { |
351 | return Some(SyntaxError::new("ambiguous `+` in a type", ty.syntax().text_range())); | 351 | return Some(SyntaxError::new("ambiguous `+` in a type", ty.syntax().text_range())); |
352 | } | 352 | } |
diff --git a/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast b/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast index 51e881a8e..68c0f1c66 100644 --- a/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast +++ b/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@0..46 | 1 | SOURCE_FILE@0..59 |
2 | TYPE_ALIAS@0..45 | 2 | [email protected]8 |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -7,12 +7,12 @@ [email protected] | |||
7 | [email protected] " " | 7 | [email protected] " " |
8 | [email protected] "=" | 8 | [email protected] "=" |
9 | [email protected] " " | 9 | [email protected] " " |
10 | PATH_TYPE@9..44 | 10 | PATH_TYPE@9..57 |
11 | PATH@9..44 | 11 | PATH@9..57 |
12 | PATH_SEGMENT@9..44 | 12 | PATH_SEGMENT@9..57 |
13 | [email protected] | 13 | [email protected] |
14 | [email protected] "B" | 14 | [email protected] "B" |
15 | GENERIC_ARG_LIST@10..44 | 15 | GENERIC_ARG_LIST@10..57 |
16 | [email protected] "<" | 16 | [email protected] "<" |
17 | [email protected] | 17 | [email protected] |
18 | [email protected] | 18 | [email protected] |
@@ -51,6 +51,16 @@ [email protected] | |||
51 | [email protected] | 51 | [email protected] |
52 | [email protected] | 52 | [email protected] |
53 | [email protected] "u64" | 53 | [email protected] "u64" |
54 | [email protected] ">" | 54 | [email protected] "," |
55 | [email protected] ";" | 55 | [email protected] " " |
56 | [email protected] "\n" | 56 | [email protected] |
57 | [email protected] | ||
58 | [email protected] "true" | ||
59 | [email protected] "," | ||
60 | [email protected] " " | ||
61 | [email protected] | ||
62 | [email protected] | ||
63 | [email protected] "false" | ||
64 | [email protected] ">" | ||
65 | [email protected] ";" | ||
66 | [email protected] "\n" | ||
diff --git a/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rs b/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rs index 0d07d7651..6a8721a73 100644 --- a/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rs +++ b/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rs | |||
@@ -1 +1 @@ | |||
type A = B<'static, i32, 1, { 2 }, Item=u64>; | type A = B<'static, i32, 1, { 2 }, Item=u64, true, false>; | ||