diff --git a/crates/ra_mbe/src/tests.rs b/crates/ra_mbe/src/tests.rs index a7fcea0acee..254318e239d 100644 --- a/crates/ra_mbe/src/tests.rs +++ b/crates/ra_mbe/src/tests.rs @@ -1614,6 +1614,23 @@ macro_rules! my_macro { ); } +#[test] +fn test_issue_3861() { + let macro_fixture = parse_macro( + r#" + macro_rules! rgb_color { + ($p:expr, $t: ty) => { + pub fn new() { + let _ = 0 as $t << $p; + } + }; + } + "#, + ); + + macro_fixture.expand_items(r#"rgb_color!(8 + 8, u32);"#); +} + #[test] fn test_repeat_bad_var() { // FIXME: the second rule of the macro should be removed and an error about diff --git a/crates/ra_parser/src/grammar/types.rs b/crates/ra_parser/src/grammar/types.rs index 2c00bce8030..386969d2d7e 100644 --- a/crates/ra_parser/src/grammar/types.rs +++ b/crates/ra_parser/src/grammar/types.rs @@ -7,7 +7,7 @@ DYN_KW, L_ANGLE, ]); -const TYPE_RECOVERY_SET: TokenSet = token_set![R_PAREN, COMMA]; +const TYPE_RECOVERY_SET: TokenSet = token_set![R_PAREN, COMMA, L_DOLLAR]; pub(crate) fn type_(p: &mut Parser) { type_with_bounds_cond(p, true);