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:
13
test/wcc/data/dup_xpkg_ok.ww
Normal file
13
test/wcc/data/dup_xpkg_ok.ww
Normal file
@@ -0,0 +1,13 @@
|
||||
// #23 legal control — same leaf `foo` in DISTINCT packages of one flat
|
||||
// bundle is legal (the dup key is (name, mod), not bare name). Mirrors a
|
||||
// driver-emitted *.combined.ww. Must compile clean + byte-identical.
|
||||
package aa;
|
||||
export fn foo() i32 = { return 1; };
|
||||
|
||||
package bb;
|
||||
export fn foo() i32 = { return 2; };
|
||||
|
||||
package main;
|
||||
import aa;
|
||||
import bb;
|
||||
export fn main() i32 = { return aa.foo() + bb.foo(); };
|
||||
Reference in New Issue
Block a user