ItemTree: make variant fields inherit the enum's visibility

This commit is contained in:
Jonas Schievink 2021-06-03 14:26:26 +02:00
parent c7eb19ebf9
commit 28e3e683b2
2 changed files with 43 additions and 4 deletions

View file

@ -359,3 +359,41 @@ trait Tr<'a, T: 'a>: Super {}
"#]],
)
}
#[test]
fn inherit_visibility() {
check(
r#"
pub(crate) enum En {
Var1(u8),
Var2 {
fld: u8,
},
}
pub(crate) trait Tr {
fn f();
fn method(&self) {}
}
"#,
expect![[r#"
pub(crate) enum En {
Var1(
pub(crate) 0: u8,
),
Var2 {
pub(crate) fld: u8,
},
}
pub(crate) trait Tr<Self> {
pub(crate) fn f() -> ();
// flags = 0x3
pub(crate) fn method(
_: &Self,
) -> ();
}
"#]],
)
}