diff options
author | Jonas Schievink <[email protected]> | 2021-04-10 22:12:02 +0100 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-04-11 00:25:50 +0100 |
commit | e2c1da36f59cd99d4da4c1d5f8f323626d3dbe61 (patch) | |
tree | e06290db93699c71d1e4c752de6563ff787bd5fa /crates/ide/src | |
parent | bd675c8a8bdd3fda239bee3d3f31acd8679655b9 (diff) |
Support macros in pattern position
Diffstat (limited to 'crates/ide/src')
-rw-r--r-- | crates/ide/src/goto_definition.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs index ca8ccb2da..d057d5402 100644 --- a/crates/ide/src/goto_definition.rs +++ b/crates/ide/src/goto_definition.rs | |||
@@ -1188,4 +1188,30 @@ pub fn gimme() -> theitem::TheItem { | |||
1188 | "#, | 1188 | "#, |
1189 | ); | 1189 | ); |
1190 | } | 1190 | } |
1191 | |||
1192 | #[test] | ||
1193 | fn goto_ident_from_pat_macro() { | ||
1194 | check( | ||
1195 | r#" | ||
1196 | macro_rules! pat { | ||
1197 | ($name:ident) => { Enum::Variant1($name) } | ||
1198 | } | ||
1199 | |||
1200 | enum Enum { | ||
1201 | Variant1(u8), | ||
1202 | Variant2, | ||
1203 | } | ||
1204 | |||
1205 | fn f(e: Enum) { | ||
1206 | match e { | ||
1207 | pat!(bind) => { | ||
1208 | //^^^^ | ||
1209 | bind$0 | ||
1210 | } | ||
1211 | Enum::Variant2 => {} | ||
1212 | } | ||
1213 | } | ||
1214 | "#, | ||
1215 | ); | ||
1216 | } | ||
1191 | } | 1217 | } |