aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/item_tree/tests.rs
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2021-05-23 00:00:17 +0100
committerJonas Schievink <[email protected]>2021-05-23 00:15:26 +0100
commit380293d6c2ead91a0988183ca634d9eb4f4fa9d7 (patch)
tree59e3b0eb34413e411c12e64b3145c18c8531d5df /crates/hir_def/src/item_tree/tests.rs
parentc22ccd07fecb964b11cba283d5ab184967c2669b (diff)
Pretty-print generic parameters
Diffstat (limited to 'crates/hir_def/src/item_tree/tests.rs')
-rw-r--r--crates/hir_def/src/item_tree/tests.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/crates/hir_def/src/item_tree/tests.rs b/crates/hir_def/src/item_tree/tests.rs
index 91c44362e..e0847dc75 100644
--- a/crates/hir_def/src/item_tree/tests.rs
+++ b/crates/hir_def/src/item_tree/tests.rs
@@ -288,3 +288,36 @@ struct S {
288 "#]], 288 "#]],
289 ) 289 )
290} 290}
291
292#[test]
293fn generics() {
294 check(
295 r#"
296struct S<'a, 'b: 'a, T: Copy + 'a + 'b, const K: u8 = 0> {}
297
298impl<'a, 'b: 'a, T: Copy + 'a + 'b, const K: u8 = 0> S<'a, 'b, T, K> {
299 fn f<G: 'a>(arg: impl Copy) -> impl Copy {}
300}
301
302enum Enum<'a, T, const U: u8> {}
303union Union<'a, T, const U: u8> {}
304 "#,
305 expect![[r#"
306 pub(self) struct S<'a, 'b, T, const K: u8> {
307 }
308
309 impl<'a, 'b, T, const K: u8> S<'a, 'b, T, K> {
310 // flags = 0x2
311 pub(self) fn f<G>(
312 _: impl Copy,
313 ) -> impl Copy;
314 }
315
316 pub(self) enum Enum<'a, T, const U: u8> {
317 }
318
319 pub(self) union Union<'a, T, const U: u8> {
320 }
321 "#]],
322 )
323}