LYR-SEM0152
a member is written wider than its type
A field, method or constant of a struct, class or enum, or a member of an inherent extend block (or the block itself), is written with a visibility wider than the type it belongs to.
Explanation
A member is reached only through its type, so it is exported only once the type is: pub x in an internal struct acts as internal. The program compiles; the warning says that the written word promises more than it gives.
Drop the word, or make the type as visible as the member.
Wrong
struct Wide {
pub x: int,
}
fn main(): void {
let w = Wide { x = 1 };
let _ = w.x;
}
Right
struct Wide {
x: int,
}
fn main(): void {
let w = Wide { x = 1 };
let _ = w.x;
}