wcc/ww: reject duplicate top-level decls, aligned to cstage
installdecl routes all four kinds (fn/type/def/let) through installtop, which turns scopedefineinmodule's nil return into cstage's exact "duplicate <kind> <name>" reject, keyed (name,mod) so cross-package same-leaf decls coexist. Builtin redecls are dropped, not dup-errored: cstage never scopes builtins (lookup_builtin first, check.c:69), so a user redecl is dead there — wwstage mirrors via scopesamekeysym + no-source-decl test. -T synth __wwtests installs direct, mirroring check.c:3079. Closes the silent dup-fn hole (user fn run vs lib/test run built a broken test binary with no diagnostic). Per-kind reject rows + cross-package/builtin accept byte-id rows + -T collision parity row in 910/997. (#23-team, category-A addendum closed)
This commit is contained in:
5
test/wcc/data/dup_fn.ww
Normal file
5
test/wcc/data/dup_fn.ww
Normal file
@@ -0,0 +1,5 @@
|
||||
// #23 — two top-level fns of the same name in the same (flat) module.
|
||||
// cstage's install pass rejects "duplicate fn foo"; wwstage now mirrors.
|
||||
fn foo() i32 = { return 1; };
|
||||
fn foo() i32 = { return 2; };
|
||||
export fn main() i32 = { return foo(); };
|
||||
Reference in New Issue
Block a user