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)
14 lines
410 B
Plaintext
14 lines
410 B
Plaintext
// #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(); };
|