diff options
author | Edwin Cheng <[email protected]> | 2020-04-08 11:34:20 +0100 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2020-04-08 11:34:20 +0100 |
commit | 53d05448c1d44b3ac2a46d54b40c3f2653fa0312 (patch) | |
tree | f5e6ed703101292693bacb6496c09ebfb2a7c655 | |
parent | d89c189ad1efe87e54855e6488184d7a3825a534 (diff) |
Add L_DOLLAR for TYPE_RECOVERY_SET
-rw-r--r-- | crates/ra_mbe/src/tests.rs | 17 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/types.rs | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/crates/ra_mbe/src/tests.rs b/crates/ra_mbe/src/tests.rs index a7fcea0ac..254318e23 100644 --- a/crates/ra_mbe/src/tests.rs +++ b/crates/ra_mbe/src/tests.rs | |||
@@ -1615,6 +1615,23 @@ fn test_issue_2520() { | |||
1615 | } | 1615 | } |
1616 | 1616 | ||
1617 | #[test] | 1617 | #[test] |
1618 | fn test_issue_3861() { | ||
1619 | let macro_fixture = parse_macro( | ||
1620 | r#" | ||
1621 | macro_rules! rgb_color { | ||
1622 | ($p:expr, $t: ty) => { | ||
1623 | pub fn new() { | ||
1624 | let _ = 0 as $t << $p; | ||
1625 | } | ||
1626 | }; | ||
1627 | } | ||
1628 | "#, | ||
1629 | ); | ||
1630 | |||
1631 | macro_fixture.expand_items(r#"rgb_color!(8 + 8, u32);"#); | ||
1632 | } | ||
1633 | |||
1634 | #[test] | ||
1618 | fn test_repeat_bad_var() { | 1635 | fn test_repeat_bad_var() { |
1619 | // FIXME: the second rule of the macro should be removed and an error about | 1636 | // FIXME: the second rule of the macro should be removed and an error about |
1620 | // `$( $c )+` raised | 1637 | // `$( $c )+` raised |
diff --git a/crates/ra_parser/src/grammar/types.rs b/crates/ra_parser/src/grammar/types.rs index 2c00bce80..386969d2d 100644 --- a/crates/ra_parser/src/grammar/types.rs +++ b/crates/ra_parser/src/grammar/types.rs | |||
@@ -7,7 +7,7 @@ pub(super) const TYPE_FIRST: TokenSet = paths::PATH_FIRST.union(token_set![ | |||
7 | DYN_KW, L_ANGLE, | 7 | DYN_KW, L_ANGLE, |
8 | ]); | 8 | ]); |
9 | 9 | ||
10 | const TYPE_RECOVERY_SET: TokenSet = token_set![R_PAREN, COMMA]; | 10 | const TYPE_RECOVERY_SET: TokenSet = token_set![R_PAREN, COMMA, L_DOLLAR]; |
11 | 11 | ||
12 | pub(crate) fn type_(p: &mut Parser) { | 12 | pub(crate) fn type_(p: &mut Parser) { |
13 | type_with_bounds_cond(p, true); | 13 | type_with_bounds_cond(p, true); |