You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Module privacy is enforced only when the entry file is named without a directory (check p1.w vs check src/p1.w) #1520
Found while writing #1372's fixture. Stage2 of main f1e3bd2 (macOS; native Windows behaves the same). Whether §18.3 module privacy is enforced depends on how the entry file is spelled on the command line.
// src/cu.w
use c_import("<stdio.h>")
type Secret = i32
pub fn greet() -> str: "hi"
// src/p1.w
use cu
fn main:
let s: Secret = 3
print(f"{s} {greet()}")
invocation
result
cd src && with check p1.w
error: symbol 'Secret' is private to module 'cu.w'
with check src/p1.w (from the parent)
ok
with check /abs/path/src/p1.w
ok
The same holds with and without a with.toml in the parent. The same flip decides c_import scoping: use cu + let n: c_uint = 3 in a module with no c_import is "'c_uint' requires an explicit import" only in the first spelling, so a module sees another module's private C declarations whenever the entry path has a directory component. (It also hid #1372 from every invocation except the first.)
Expected: privacy is a property of the modules, not of the spelling of the entry path: Secret is private to cu.w in all three invocations. The likely route is a module-path mismatch between the root's recorded path and the imported module's (a dir/ prefix on one side), so the "same module" or "visible from current" test passes; not yet located at the line.
Activity
Sema: a module that uses c_import resolves the program's C types as i…
Sema: a module that uses c_import resolves the program's C types as i…
tests: the imports the spec requires (§18.2) — the build-cache test i…
tests: the imports the spec requires (§18.2) — the build-cache test i…
tools: publish_private_symbols — declare pub the top-level symbols a …
Declare pub the compiler's cross-module symbols that the src/ privacy…
Sema: an impl on another module's private type names the cause at the…
rt: publish str_data and make_str for rt_core.w; the tool maps <embed…
MirCore: publish the validator entry points and drop-state type the i…
examples: nebula and service conform to §18.3 and §2.2 (PENDING ERIC'…
Sema: imports are not transitive; locals shadow interface globals; sh…
Sema: module privacy no longer depends on the entry path's directory (#…
tools: publish_private_symbols — declare pub the top-level symbols a …
Declare pub the compiler's cross-module symbols that the src/ privacy…
Sema: an impl on another module's private type names the cause at the…
rt: publish str_data and make_str for rt_core.w; the tool maps <embed…
MirCore: publish the validator entry points and drop-state type the i…
examples: nebula and service conform to §18.3 and §2.2 (PENDING ERIC'…
SemaTypes/InternPool: publish TypeId, which main 410fe68 now names ac…
Import directly what each compiler module names: imports are not tran…
tools: import_unresolved_symbols — import (and publish) the one owner…
Import directly what each compiler module names: the remaining #1708/#…