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
stage1 (source-compiled std.re) leaks its pub globals into every user program's global scope: const PACKAGE is "shadowing is not allowed for 'PACKAGE'" #1703
On a stage1 built in a worktree (:dev, std.re compiled from source under out/gen rather than the .wo bundle), lib/std/re/defs.w's pub let PACKAGE = "pcre2" (and PACKAGE_NAME, PACKAGE_BUGREPORT, …) is visible in every user program's global scope:
stage1: error: shadowing is not allowed for 'PACKAGE'; the release binary (main c7ac882) prints 2. Any const named PACK/Pkg/package passes; only names that collide with std.re's globals fail, so test/behavior/behav_comptime_aggregate_freeze.w passes in the battery (release binary) and fails on stage1.
Two defects: a module's pub let globals must not be in scope for a program that never imports it, and stage1 and the release binary must agree (#729 class: test-runner-only / stage-only differences). Found while running the behavior corpus on a stage1 for #1702.
Root cause is general, not stage1-only. Two things, verified on main d7a3d84's release binary with a three-module project:
Imports are transitive.main with only use helper resolves helper2's deep() and PACKAGE because module_is_visible_from_current walks the import graph. §18.2's precedence lists explicit imports, the prelude and the std fallback — nothing transitive. Fixed in the draft PR (direct edges only; the compiler tree checks unchanged), pinned by behav_imports_are_not_transitive.w.
The stage1 PACKAGE case is a flat-scope global collision. A source-compiled engine corpus binds its pub let globals as bundle-interface globals (one program-wide table, D39/D52), so a module-level const PACKAGE is "one symbol declared twice" (the .wo path never binds them, hence release passes). A lexicallet PACKAGE now shadows it (§18.2 tier 1) and the diagnostic names the collision. Whether a module-level declaration shadows another module's flat global (§18.2 tier 2 vs D52's flat table) is a ruling; brief sent to Eric.
Activity
ehartford commentedon Sep 26, 2026
Root cause is general, not stage1-only. Two things, verified on main d7a3d84's release binary with a three-module project:
mainwith onlyuse helperresolveshelper2'sdeep()andPACKAGEbecausemodule_is_visible_from_currentwalks the import graph. §18.2's precedence lists explicit imports, the prelude and the std fallback — nothing transitive. Fixed in the draft PR (direct edges only; the compiler tree checks unchanged), pinned bybehav_imports_are_not_transitive.w.PACKAGEcase is a flat-scope global collision. A source-compiled engine corpus binds itspub letglobals as bundle-interface globals (one program-wide table, D39/D52), so a module-levelconst PACKAGEis "one symbol declared twice" (the.wopath never binds them, hence release passes). A lexicallet PACKAGEnow shadows it (§18.2 tier 1) and the diagnostic names the collision. Whether a module-level declaration shadows another module's flat global (§18.2 tier 2 vs D52's flat table) is a ruling; brief sent to Eric.Sema: imports are not transitive, a local shadows an interface global…
Sema: imports are not transitive; locals shadow interface globals; sh…
Sema: every import is also a namespace (§18.2, D70)
Frontend/Sema: a module's top-level values are its own — a colliding …
Sema: two imports that provide one name are an error only where the n…
Sema: every import is also a namespace (§18.2, D70)
Frontend/Sema: a module's top-level values are its own — a colliding …
Sema: two imports that provide one name are an error only where the n…
Sema: every import is also a namespace (§18.2, D70)
Frontend/Sema: a module's top-level values are its own — a colliding …
Sema: two imports that provide one name are an error only where the n…
Sema: every import is also a namespace (§18.2, D70)
Frontend/Sema: a module's top-level values are its own — a colliding …
Sema: two imports that provide one name are an error only where the n…
Sema: every import is also a namespace (§18.2, D70)
Frontend/Sema: a module's top-level values are its own — a colliding …
Sema: two imports that provide one name are an error only where the n…
Sema: every import is also a namespace (§18.2, D70)
Spec-ruled fixes: Some(place) borrows for Option[&T], module globals …
D70: a namespaced type stays reachable where another declaration shad…
D70: a namespaced type stays reachable where another declaration shad…
D70: a namespaced type stays reachable where another declaration shad…
D70 namespaced types reachable when shadowed (#1757); generator stage…
c_import/migrate/emit-c: no `-> Unit` on void C fns (#1838); header f…
D156: the migrator's literal typing speaks fixed widths; the model co…
D156: the migrator's literal typing speaks fixed widths; the model co…
D155/D156: the C aliases are the target's builtins; a corpus is compi…
D156: the migrator's literal typing speaks fixed widths; the model co…