From 8d62576a9b47922ce58ac757e6e4944d45b223a6 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sun, 10 Jan 2021 20:52:46 +0800 Subject: Fixed expr meta var after path colons in mbe --- crates/mbe/src/tests.rs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'crates/mbe') diff --git a/crates/mbe/src/tests.rs b/crates/mbe/src/tests.rs index d854985c5..17ddd0a9c 100644 --- a/crates/mbe/src/tests.rs +++ b/crates/mbe/src/tests.rs @@ -1,7 +1,11 @@ use std::fmt::Write; use ::parser::FragmentKind; -use syntax::{ast, AstNode, NodeOrToken, SyntaxKind::IDENT, SyntaxNode, WalkEvent, T}; +use syntax::{ + ast, AstNode, NodeOrToken, + SyntaxKind::{ERROR, IDENT}, + SyntaxNode, WalkEvent, T, +}; use test_utils::assert_eq_text; use super::*; @@ -1194,6 +1198,23 @@ macro_rules! foo { ); } +#[test] +fn test_expr_after_path_colons() { + assert!(parse_macro( + r#" +macro_rules! m { + ($k:expr) => { + f(K::$k); + } +} +"#, + ) + .expand_statements(r#"m!(C("0"))"#) + .descendants() + .find(|token| token.kind() == ERROR) + .is_some()); +} + // The following tests are based on real world situations #[test] fn test_vec() { -- cgit v1.2.3