Files
ww/test/lang/inferred_scalar_global_test.ww
Hojun-Cho 74cc35d488 test: migrate Fam4 static-init/DATA-emit value tests to @test (#30)
Continues the test-arch tower past Fam8-13. 11 module-level static-init
/ DATA-emit value drivers move from test/wcc/*_run.c into @test row-
tables under test/lang/; every classification empirically re-probed at
HEAD (refuting two stale worklist tags).

- value rows -> test/lang/*_test.ww (11 files)
- reject rows -> runww //ww:error carriers (3, dual-stage non-vacuous;
  947 const-divzero confirmed a both-stage compile-reject, not run-exit)
- 840_zeroinit, 944_array_zeroinit, 989_arrlit_tail_zero kept as byte-id
  .c pins (zero-over-dirtied-frame / DATAW-length is byte-id-blind to a
  runtime @test; #263), mutation-gated
- repoint two stale comment refs to deleted test names (719,
  989_structlocal_frame)

Migrated static-init @test ride the cs==ww T2 byte-id gate, preserving
DATA-emit byte-id. 2D global-struct array-field read (#137/#150)
confirmed cs==ww + correct at HEAD. Coverage parity verified row-by-row;
two-round reviewed. Floor ratchet follows.
2026-06-25 01:32:32 +09:00

34 lines
1.4 KiB
Plaintext

// inferred_scalar_global_test — module-level inferred/const-expr scalar global
// emit + read. Migrated from test/wcc/947_inferred_scalar_global_run.c
// (#66 b-i, #134 neg, #133 const-expr). An inferred / unary / const-expr int
// global once emitted no DATAW on wwstage (MOVSXD on stale AX) and link-failed
// on cstage; the let pass-2 arm now const-folds the rhs and stamps an N_INTLIT
// so cgen's literal DATA emitter fires in BOTH stages. cstage build+run was T1;
// cs==ww .s byte-id rides T2 (test-lang-byteid). The div-by-zero const-expr
// reject is the runww carrier test/wcc/data/const_divzero_reject.
//
// The typed controls (typed_ctrl/neg_typed_ctrl/const_typed) lock the
// construction proof: the inferred decl's emitted .s equals the typed decl's
// after defaulting.
package inferred_scalar_global_test;
let SI = 42;
let STC: i64 = 42;
let SNI = -42;
let SNT: int = -42;
let SCI = 7 * 6;
let SCT: i64 = 7 * 6;
def KD: int = 6;
let SDR = KD * 7;
let SUB = -(2 * 3);
@test fn inferred() void = { assert(SI: i64 == 42); };
@test fn typed_ctrl() void = { assert(STC == 42); };
@test fn neg_inferred() void = { assert(SNI: i64 == -42); };
@test fn neg_typed_ctrl() void = { assert(SNT == -42); };
@test fn const_inferred() void = { assert(SCI: i64 == 42); };
@test fn const_typed() void = { assert(SCT == 42); };
@test fn const_defref() void = { assert(SDR: i64 == 42); };
@test fn const_unary_binop() void = { assert(SUB: i64 == -6); };