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
Private functions with the same name in two modules of one package collide ('symbol is not visible from this module') #1139
// lib/pk/a.w
fn helper(x: i32) -> i32: x + x
pub fn a_probe() -> i32: helper(1)
// lib/pk/b.w
fn helper(x: i32) -> i32: x * 3
pub fn b_probe() -> i32: helper(1)
// src/main.w
use pk.a
use pk.b
fn main: assert(b_probe() + a_probe() == 5)
$ with run src/main.w
error: symbol 'helper' is not visible from this module
--> lib/pk/a.w:2:26
2 | pub fn a_probe() -> i32: helper(1)
Same with the seed (v0.15.2.1), main's release binary and the fnabi-phase0 tree; also when b imports a instead of main importing both. Expected: a private symbol is private to its module (spec §18, D29); two modules may each have their own. The resolver appears to key private functions by bare name across the package.
Found by the Phase 2 migrator fixture behav_migrate_header_inline_owner: a header no unit owns keeps a static inline copy per includer (the C model), which is exactly this shape. The 13 TommyDS units each carry a private tommy_ilog2_u32 and DO compile as the std.tommyds bundle, so the bundle/std path resolves differently from a user package.
Another instance that looks like the same resolution problem, this time between a user file and std.
std/string.w declares pub fn is_digit and calls it from is_alnum (line 199). Declaring a function with the same name in user code breaks that call inside std, even when the user file never uses std.string:
$ with run shadow.w
error: symbol 'is_digit' is not visible from this module
--> <embedded-std>/std/string.w:199:20
199 | is_alpha(c) or is_digit(c)
| ^^^^^^^^
error: run failed
Renaming the user function to is_digit_mine makes the same file print true. The same error appears from src/main.w in a project.
Two differences from the original report that may matter for the fix:
The callee's own declaration is pub here, so it isn't only private-vs-private: is_alnum's call to its own module's is_digit appears to resolve to the user's private declaration instead.
On the last paragraph above: same-named privates among std bundle units resolve fine, but a user declaration can still capture a call inside std.
The diagnostic also points into <embedded-std> and never mentions the user's declaration, so from the user's side there's no hint that their own function name is the cause.
Activity
joshhickson commentedon Sep 17, 2026
Another instance that looks like the same resolution problem, this time between a user file and
std.std/string.wdeclarespub fn is_digitand calls it fromis_alnum(line 199). Declaring a function with the same name in user code breaks that call inside std, even when the user file never usesstd.string:Renaming the user function to
is_digit_minemakes the same file printtrue. The same error appears fromsrc/main.win a project.Two differences from the original report that may matter for the fix:
pubhere, so it isn't only private-vs-private:is_alnum's call to its own module'sis_digitappears to resolve to the user's private declaration instead.The diagnostic also points into
<embedded-std>and never mentions the user's declaration, so from the user's side there's no hint that their own function name is the cause.Tested on
v0.15.2.1, Windows x86_64.ehartford commentedon Oct 25, 2026
Triage 2026-10-25,
with v0.15.3.0(main a261b65): does not reproduce.