diff options
author | Jonas Schievink <[email protected]> | 2021-06-03 13:26:26 +0100 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-06-03 13:26:26 +0100 |
commit | 28e3e683b204050e532f49f84f2ec887f19cc91c (patch) | |
tree | 50df840065d230bce60b5d0b4065888a311aba57 /crates/hir_def/src/item_tree/tests.rs | |
parent | c7eb19ebf9d42cada8cb532c6b3cb0e11a531b93 (diff) |
ItemTree: make variant fields inherit the enum's visibility
Diffstat (limited to 'crates/hir_def/src/item_tree/tests.rs')
-rw-r--r-- | crates/hir_def/src/item_tree/tests.rs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/crates/hir_def/src/item_tree/tests.rs b/crates/hir_def/src/item_tree/tests.rs index b362add5c..57686dc6e 100644 --- a/crates/hir_def/src/item_tree/tests.rs +++ b/crates/hir_def/src/item_tree/tests.rs | |||
@@ -359,3 +359,41 @@ trait Tr<'a, T: 'a>: Super {} | |||
359 | "#]], | 359 | "#]], |
360 | ) | 360 | ) |
361 | } | 361 | } |
362 | |||
363 | #[test] | ||
364 | fn inherit_visibility() { | ||
365 | check( | ||
366 | r#" | ||
367 | pub(crate) enum En { | ||
368 | Var1(u8), | ||
369 | Var2 { | ||
370 | fld: u8, | ||
371 | }, | ||
372 | } | ||
373 | |||
374 | pub(crate) trait Tr { | ||
375 | fn f(); | ||
376 | fn method(&self) {} | ||
377 | } | ||
378 | "#, | ||
379 | expect![[r#" | ||
380 | pub(crate) enum En { | ||
381 | Var1( | ||
382 | pub(crate) 0: u8, | ||
383 | ), | ||
384 | Var2 { | ||
385 | pub(crate) fld: u8, | ||
386 | }, | ||
387 | } | ||
388 | |||
389 | pub(crate) trait Tr<Self> { | ||
390 | pub(crate) fn f() -> (); | ||
391 | |||
392 | // flags = 0x3 | ||
393 | pub(crate) fn method( | ||
394 | _: &Self, | ||
395 | ) -> (); | ||
396 | } | ||
397 | "#]], | ||
398 | ) | ||
399 | } | ||