Files
ww/test/wcc/data/modfn_coexist_vbu/main.ww
Hojun-Cho 2c62be44a7 test/wcc: 989_declns_sep decl-namespace gate — dup reject / builtin redecl / dir-pkg modfn coexist (M4 E2-C2c, #22)
Final E2-C2 commit. New decl-namespace gate, both stages: dup fn/type/def/let build-FAIL with a right-reason "duplicate <kind> <name>" diag (shared substring; ww has no line:col); builtin_redecl ACCEPT exit 7 (shadowing a pre-seeded builtin is redeclarable); modfn coexist reshaped to a real directory package (696 precedent) via ww build --sep on two layouts (modfn_coexist + _vbu use-before-value) so both run to 6, cs==ww per-pkg .s/.wwi/.unit.ww, cross-order byte-id on .s/.wwi (.unit.ww excluded: verbatim source flips by construction, order-independence is codegen). __root.s carries both CALL aa.helper and CALL main.aa distinctly. Test-only; all 5 pins hold; 443 to 444.
2026-06-18 00:52:33 +09:00

13 lines
643 B
Plaintext

// #30 VALUE-BEFORE-USE — the twin of ../modfn_coexist/main.ww with the
// decl order flipped: `fn aa` is declared BEFORE `import aa`. cstage is
// order-independent (installs every SK_USE in a first pass); wwstage
// installs in source order, so this direction exercises a DISTINCT path
// (installdecl's N_USE arm must set use_alias on the pre-installed value
// sym). The gate asserts this builds + runs to 6 AND emits asm
// byte-identical to the use-before-value order — silent order-dependence
// is exactly what regresses.
package main;
fn aa() i32 = { return 1; };
import aa;
export fn main() i32 = { return aa() + aa.helper(); };