Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir_def/src/macro_expansion_tests/mbe.rs')
-rw-r--r--crates/hir_def/src/macro_expansion_tests/mbe.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/crates/hir_def/src/macro_expansion_tests/mbe.rs b/crates/hir_def/src/macro_expansion_tests/mbe.rs
index 958f2a1c33..0d3d86c8ad 100644
--- a/crates/hir_def/src/macro_expansion_tests/mbe.rs
+++ b/crates/hir_def/src/macro_expansion_tests/mbe.rs
@@ -778,3 +778,45 @@ x!();
"#]],
)
}
+
+#[test]
+fn test_ty() {
+ check(
+ r#"
+macro_rules! foo {
+ ($t:ty) => ( fn bar() -> $t {} )
+}
+foo! { Baz<u8> }
+"#,
+ expect![[r#"
+macro_rules! foo {
+ ($t:ty) => ( fn bar() -> $t {} )
+}
+fn bar() -> Baz<u8> {}
+"#]],
+ )
+}
+
+#[test]
+fn test_ty_with_complex_type() {
+ check(
+ r#"
+macro_rules! foo {
+ ($t:ty) => ( fn bar() -> $ t {} )
+}
+
+foo! { &'a Baz<u8> }
+
+foo! { extern "Rust" fn() -> Ret }
+"#,
+ expect![[r#"
+macro_rules! foo {
+ ($t:ty) => ( fn bar() -> $ t {} )
+}
+
+fn bar() -> & 'a Baz<u8> {}
+
+fn bar() -> extern"Rust"fn() -> Ret {}
+"#]],
+ );
+}