Describe the bug
The new compiler lets a module read a private field of a struct declared in another module. The old compiler rejects it, as expected.
Reproduction Steps
lib/lib.v:
module lib
pub struct Box {
mut :
secret int
}
pub fn new_box () Box {
return Box{
secret: 42
}
}
main.v:
import lib
fn main () {
b := lib.new_box ()
println (b.secret)
}
v -new-compiler run main.v
Expected Behavior
The error the old compiler gives:
main.v:5:12: error: field `lib.Box.secret` is not public
Current Behavior
It compiles and prints 42.
V version
V 0.5.2 4af2cb4 (-new-compiler). The old compiler I compare with is what -old-compiler runs, the V 0.5.2 release (7647ce1).
Environment details (OS name and version, etc.)
macOS 26.6, arm64, Apple clang 21
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
Describe the bug
The new compiler lets a module read a private field of a struct declared in another module. The old compiler rejects it, as expected.
Reproduction Steps
lib/lib.v:main.v:v -new-compiler run main.vExpected Behavior
The error the old compiler gives:
Current Behavior
It compiles and prints
42.V version
V 0.5.2 4af2cb4 (
-new-compiler). The old compiler I compare with is what-old-compilerruns, the V 0.5.2 release (7647ce1).Environment details (OS name and version, etc.)
macOS 26.6, arm64, Apple clang 21
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.