From 134f0ceef0fdd8360d9fd1ed61b9c8b5d07502f8 Mon Sep 17 00:00:00 2001 From: Hojun-Cho Date: Sun, 9 Aug 2026 12:07:13 +0900 Subject: [PATCH] test: delete unconsumed legacy inputs --- .gitignore | 2 +- test/wcc/data/attest_pass.ww | 229 -------------------------- test/wcc/data/builtin_redecl_ok.ww | 15 -- test/wcc/data/dup_def.ww | 6 - test/wcc/data/dup_fn.ww | 6 - test/wcc/data/dup_let.ww | 6 - test/wcc/data/dup_type.ww | 6 - test/wcc/data/dup_xpkg_ok.ww | 13 -- test/wcc/data/filter_fixture.ww | 13 -- test/wcc/data/modfn_coexist_ok.ww | 19 --- test/wcc/data/modfn_coexist_vbu_ok.ww | 21 --- test/wcc/data/selfimport.ww | 3 - 12 files changed, 1 insertion(+), 338 deletions(-) delete mode 100644 test/wcc/data/attest_pass.ww delete mode 100644 test/wcc/data/builtin_redecl_ok.ww delete mode 100644 test/wcc/data/dup_def.ww delete mode 100644 test/wcc/data/dup_fn.ww delete mode 100644 test/wcc/data/dup_let.ww delete mode 100644 test/wcc/data/dup_type.ww delete mode 100644 test/wcc/data/dup_xpkg_ok.ww delete mode 100644 test/wcc/data/filter_fixture.ww delete mode 100644 test/wcc/data/modfn_coexist_ok.ww delete mode 100644 test/wcc/data/modfn_coexist_vbu_ok.ww delete mode 100644 test/wcc/data/selfimport.ww diff --git a/.gitignore b/.gitignore index 25af67b3..5d6e2664 100644 --- a/.gitignore +++ b/.gitignore @@ -46,7 +46,7 @@ examples/**/*.s examples/**/*.combined.ww # `test/wcc/data/` holds .ww fixtures fed to the C-side wcc tests -# (e.g. attest_pass.ww). `ww build` against any of those drops the +# (e.g. attest_nondrop.ww). `ww build` against any of those drops the # usual triplet next to the source — only the .ww is tracked. test/wcc/data/*.o test/wcc/data/*.s diff --git a/test/wcc/data/attest_pass.ww b/test/wcc/data/attest_pass.ww deleted file mode 100644 index 67b41c8f..00000000 --- a/test/wcc/data/attest_pass.ww +++ /dev/null @@ -1,229 +0,0 @@ -// @test fixture: every test passes (exits without aborting). - -package data; - -import rt; // #3/B': check_empty_alloc_annotated calls alloc → rt_malloc. - -type point = struct { x: i32, y: i32 }; - -// #27b: enum bases for the ` as ` value-reinterpret pins -// below (multiple enum bases × int widths). -type eflag = enum i32 { A = 1, B = 2, C = 4 }; -type ebyte = enum u8 { LO = 1, HI = 200 }; -type eplain = enum { Z = 0, ONE = 1, TWO = 2 }; - -// #87: a PLAIN (non-alias) module-level tagged-union global SEGV'd BOTH -// stages — no static DATA emitted (read as a frame-local at BP) + the -// match scrutinee read saved BP as the tag. Fix: emit the 32B box that -// byte-MIRRORS a runtime LOCAL (tag@0 | payload@8 | zero-pad) + resolve -// the match scrutinee via LEAQ name(SB). These globals back the rob §3 -// global-vs-local byte-identity PIN below; the tuple global locks the -// already-correct #86 path against any emitter regression. -let g87_int: (i32 | str) = 42; -let g87_str: (i32 | str) = "x"; -let g86_tup: (u32, u32) = (1u32, 2u32); - -@test fn check_add() void = { - let a: i32 = 2; - let b: i32 = 3; - let c: i32 = a + b; - if (c != 5) { - let _: i32 = 1 / 0; // abort via div-by-zero would also work - }; -}; - -@test fn check_match() void = { - let r: (i32 | str) = 7; - let v: i32 = match (r) { - case let n: i32 => yield n; - case let s: str => yield 0; - }; - if (v != 7) { - let _: i32 = 1 / 0; - }; -}; - -// #227: compound assign (`-=`/`+=`) on a local field must -// load-combine-store, not drop the op. Pre-fix wwstage stored the bare -// rhs (p.x->4, p.y->5, view.len->1), so each mismatch aborts via 1/0. -@test fn check_local_field_compound() void = { - let p: point = point { x = 10i32, y = 3i32 }; - p.x -= 4i32; - p.y += 5i32; - if (p.x != 6) { - let _: i32 = 1 / 0; - }; - if (p.y != 8) { - let _: i32 = 1 / 0; - }; - let view: str = "hello"; - view.len -= 1; - let n: i32 = view.len: i32; - if (n != 4) { - let _: i32 = 1 / 0; - }; -}; - -// #264: a match-bound binder used inside a `yield` arm of a match-AS- -// EXPRESSION. Pre-fix the wwstage checker stamped the operand in-scope -// during the N_MCASE arm walk, then RE-TYPED it out of the (popped) arm -// scope while deriving the match's yield type (exprtype N_MATCH → -// matchyieldtype). Out of scope the operand couldn't re-resolve, the -// re-derive returned nil, and the N_UN/N_BIN/N_INDEX restamp arms -// overwrote the good in-scope stamp with nil → asserttyped:un/bin/index -// aborted (cstage accepted it). Root fix: matchyieldtype now READS the -// cached operand tinfo at the post-walk call instead of re-deriving -// (mirrors cstage match_yield_type reading body->lhs->type, check.c:121), -// so no operand shape can be clobbered. These rows pin the whole operand -// class by construction: deref (*p), bin (*p+1), slice-index (p[i]), and -// deref-then-field ((*p).x). (The *[N]T ptr-to-array index variant is -// blocked separately by #278's exhaustiveness false-reject, so it uses a -// []i32 slice binder here.) -@test fn check_match_ptr_deref() void = { - let n: i32 = 42i32; - let xi: (*i32 | void) = &n; - let v: i32 = match (xi) { - case let p: *i32 => yield *p; - case void => yield -1i32; - }; - if (v != 42) { - let _: i32 = 1 / 0; - }; - - // N_BIN operand: `yield *p + 1`. - let m: i32 = 9i32; - let xb: (*i32 | void) = &m; - let vb: i32 = match (xb) { - case let p: *i32 => yield *p + 1i32; - case void => yield -1i32; - }; - if (vb != 10) { - let _: i32 = 1 / 0; - }; - - // N_INDEX operand: `yield p[1]` over a []i32 binder. - let arr: [3]i32 = [4i32, 5i32, 6i32]; - let sl: []i32 = arr; - let xs: ([]i32 | void) = sl; - let vs: i32 = match (xs) { - case let p: []i32 => yield p[1]; - case void => yield -1i32; - }; - if (vs != 5) { - let _: i32 = 1 / 0; - }; - - let pt: point = point { x = 7i32, y = 9i32 }; - let xp: (*point | void) = &pt; - let w: i32 = match (xp) { - case let p: *point => yield (*p).x; - case void => yield -1i32; - }; - if (w != 7) { - let _: i32 = 1 / 0; - }; -}; - -// #3/B': the let-annotation context path keeps `alloc([], n)` inferring -// its element type for ANY T (u8 default + non-u8 #45 retype). The bare / -// return / arg empty allocs that lost the silent u8 default are covered by -// the negative test (test/wcc/729). Here we pin that annotated allocs of -// both an 8-bit and a wide element still compile and index correctly. -// alloc([], n) is Hare's len=0 / cap=n empty slice, so we write into the -// cap-backed memory and read it back (ref/hare expects len 0, not n). -@test fn check_empty_alloc_annotated() void = { - let b: []u8 = alloc([], 8u64)!; - b[0] = 7u8; - b[3] = 9u8; - if (b[0] != 7 || b[3] != 9) { - let _: i32 = 1 / 0; - }; - let w: []i32 = alloc([], 4u64)!; - w[2] = 5i32; - if (w[2] != 5) { - let _: i32 = 1 / 0; - }; -}; - -// #87 PIN (rob §3, tagged kind): a module-GLOBAL tagged scrutinee must -// match to the SAME arm/value as a LOCAL of the same type — both stages. -// Pre-fix the global match SEGV'd (saved-BP-as-tag) on cs AND ww. -@test fn check_tagged_global_int() void = { - let l: (i32 | str) = 42; // the known-correct runtime box - let gv: i32 = match (g87_int) { - case let n: i32 => yield n; - case let s: str => yield 0; - }; - let lv: i32 = match (l) { - case let n: i32 => yield n; - case let s: str => yield 0; - }; - if (gv != 42) { let _: i32 = 1 / 0; }; - if (gv != lv) { let _: i32 = 1 / 0; }; // global == local -}; - -// #87 PIN: the str variant (tag 1) exercises the DATAR ptr patch + the -// 24B {ptr,len,cap} payload at +8. -@test fn check_tagged_global_str() void = { - let n: i32 = match (g87_str) { - case let v: i32 => yield v; - case let s: str => yield s.len: i32; - }; - if (n != 1) { let _: i32 = 1 / 0; }; // "x".len, via tag-1 arm -}; - -// #86 LOCK PIN (tuple kind): the already-correct tuple-global emitter -// must keep byte-mirroring a local — guards the working path against any -// regression from the #87 tagged arm sharing emitletdataw. -@test fn check_tuple_global_lock() void = { - let l: (u32, u32) = (1u32, 2u32); - if (g86_tup.0 != 1) { let _: i32 = 1 / 0; }; - if (g86_tup.1 != 2) { let _: i32 = 1 / 0; }; - if (g86_tup.0 != l.0) { let _: i32 = 1 / 0; }; - if (g86_tup.1 != l.1) { let _: i32 = 1 / 0; }; -}; - -// #27b: ` as ` must lower as a value reinterpret (the -// integer storage already occupies the register), NOT a tagged-union -// assertion. Pre-fix wwstage gated the passthrough on NODE SHAPE -// (isenumexpr), so a constant-folded enum MEMBER (`eflag.B`, an int- -// literal node carrying the enum type_) missed the arm and fell into the -// tag-assert + exit(1) path — every fnmatch `(fl as i32)` flag test -// aborted (8/8 → 0/8 on the wwstage build). Fix gates on the stamped -// operand/result TYPE (mirror cstage cmd/w6c/cgen.c N_TYPEASSERT). These -// rows pin the construct by construction: member-as (the folded shape), -// ident-as (the param shape), the fnmatch flag-test combination, int→enum -// (result-type gate), and multiple enum bases × int widths. -@test fn check_enum_as_member() void = { - if ((eflag.B as i32) != 2) { let _: i32 = 1 / 0; }; - if ((eflag.C as i32) != 4) { let _: i32 = 1 / 0; }; -}; - -@test fn check_enum_as_flagtest() void = { - let fl: eflag = eflag.A; // 1 & 2 == 0 - if (((fl as i32) & (eflag.B as i32)) != 0) { let _: i32 = 1 / 0; }; - let fl2: eflag = eflag.C; // 4 & 4 != 0 - if (((fl2 as i32) & (eflag.C as i32)) == 0) { let _: i32 = 1 / 0; }; -}; - -@test fn check_enum_as_widths() void = { - if ((ebyte.HI as u8) != 200) { let _: i32 = 1 / 0; }; - if ((ebyte.HI as i32) != 200) { let _: i32 = 1 / 0; }; - if ((eplain.TWO as int) != 2) { let _: i32 = 1 / 0; }; - if ((eflag.B as i64) != 2i64) { let _: i32 = 1 / 0; }; -}; - -@test fn check_int_as_enum() void = { - let v: i32 = 2i32; - let e: eflag = v as eflag; // result-type enum gate - if ((e as i32) != 2) { let _: i32 = 1 / 0; }; -}; - -// CONTROL (#27b): a legit tagged-union `as` must KEEP the tag-assert + -// payload-unwrap lowering — byte-id UNMOVED by the enum-passthrough fix. -// This is the path enum-as must not hijack and must not be hijacked by. -@test fn check_tagged_as_control() void = { - let b: (i32 | str) = 7; - let v: i32 = b as i32; - if (v != 7) { let _: i32 = 1 / 0; }; -}; diff --git a/test/wcc/data/builtin_redecl_ok.ww b/test/wcc/data/builtin_redecl_ok.ww deleted file mode 100644 index c6b8a152..00000000 --- a/test/wcc/data/builtin_redecl_ok.ww +++ /dev/null @@ -1,15 +0,0 @@ -// #23 builtin carve-out — a user redecl of a pre-seeded builtin name is -// NOT a duplicate (cstage keeps no builtins in scope: lookup_builtin wins -// first at check.c:69, so the user version installs dead). wwstage seeds -// builtins into c.top, so installtop must DROP this redecl rather than -// erroring. Both stages accept; the builtin `nomem` (= !void) wins, so -// g()'s i32 arm returns 7. Pins the 771/774/926 shape. -package main; -type nomem = !void; -fn g() (i32 | nomem) = { return 7; }; -export fn main() i32 = { - match (g()) { - case let v: i32 => return v; - case nomem => return 99; - }; -}; diff --git a/test/wcc/data/dup_def.ww b/test/wcc/data/dup_def.ww deleted file mode 100644 index ddf9d55d..00000000 --- a/test/wcc/data/dup_def.ww +++ /dev/null @@ -1,6 +0,0 @@ -// #23 — two top-level defs of the same name in one (flat) module. -// cstage's install pass rejects "duplicate def D"; wwstage now mirrors. -package main; -def D: i32 = 1; -def D: i32 = 2; -export fn main() i32 = { return 0; }; diff --git a/test/wcc/data/dup_fn.ww b/test/wcc/data/dup_fn.ww deleted file mode 100644 index 87422861..00000000 --- a/test/wcc/data/dup_fn.ww +++ /dev/null @@ -1,6 +0,0 @@ -// #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. -package main; -fn foo() i32 = { return 1; }; -fn foo() i32 = { return 2; }; -export fn main() i32 = { return foo(); }; diff --git a/test/wcc/data/dup_let.ww b/test/wcc/data/dup_let.ww deleted file mode 100644 index 298107bb..00000000 --- a/test/wcc/data/dup_let.ww +++ /dev/null @@ -1,6 +0,0 @@ -// #23 — two top-level lets of the same name in one (flat) module. -// cstage's install pass rejects "duplicate let g"; wwstage now mirrors. -package main; -let g: i32 = 1; -let g: i32 = 2; -export fn main() i32 = { return 0; }; diff --git a/test/wcc/data/dup_type.ww b/test/wcc/data/dup_type.ww deleted file mode 100644 index dfe29df0..00000000 --- a/test/wcc/data/dup_type.ww +++ /dev/null @@ -1,6 +0,0 @@ -// #23 — two top-level types of the same name in one (flat) module. -// cstage's install pass rejects "duplicate type t"; wwstage now mirrors. -package main; -type t = i32; -type t = u32; -export fn main() i32 = { return 0; }; diff --git a/test/wcc/data/dup_xpkg_ok.ww b/test/wcc/data/dup_xpkg_ok.ww deleted file mode 100644 index e267031f..00000000 --- a/test/wcc/data/dup_xpkg_ok.ww +++ /dev/null @@ -1,13 +0,0 @@ -// #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(); }; diff --git a/test/wcc/data/filter_fixture.ww b/test/wcc/data/filter_fixture.ww deleted file mode 100644 index 13f21c4c..00000000 --- a/test/wcc/data/filter_fixture.ww +++ /dev/null @@ -1,13 +0,0 @@ -// @test fixture for the fnmatch name-filter (task #17 commit-3). Three -// trivially-passing @test fns with distinct names so a glob selects a -// known subset; 989_test_filter drives `ww test [pattern]` and -// asserts which " ... ok" lines appear. Bodies are empty (clean -// return = pass); the test observes SELECTION, not assertion outcomes. - -package filterfix; - -@test fn alpha() void = { }; - -@test fn beta() void = { }; - -@test fn gamma() void = { }; diff --git a/test/wcc/data/modfn_coexist_ok.ww b/test/wcc/data/modfn_coexist_ok.ww deleted file mode 100644 index 2707552e..00000000 --- a/test/wcc/data/modfn_coexist_ok.ww +++ /dev/null @@ -1,19 +0,0 @@ -// #30 legal control — a top-level fn whose leaf matches an imported -// MODULE name. The module bareword (SK_USE) and the value-namespace fn -// coexist: cstage promotes the SK_USE in place with use_alias -// (cmd/wcc/check.c:2928), wwstage keeps both as separate coexisting syms -// (lib/ww/sym.ww scopedefineinmodule #30 cross-namespace skip). A bundled -// `ascii` module + a primary-package `@test fn ascii` hit this in the wild -// (989_lib_byteid via the lib/test->fnmatch->ascii -T floor). Must compile -// clean + be cs/ww byte-identical. Mirrors a driver-emitted *.combined.ww. -// -// Both refs must resolve, so any mis-resolution fails to COMPILE: `aa()` -// must bind the fn (a module is not callable), and `aa.helper()` must bind -// through the module (the fn has no field `helper`). Accept proves both. -package aa; -export fn helper() i32 = { return 5; }; - -package main; -import aa; -fn aa() i32 = { return 1; }; -export fn main() i32 = { return aa() + aa.helper(); }; diff --git a/test/wcc/data/modfn_coexist_vbu_ok.ww b/test/wcc/data/modfn_coexist_vbu_ok.ww deleted file mode 100644 index 0515cb2c..00000000 --- a/test/wcc/data/modfn_coexist_vbu_ok.ww +++ /dev/null @@ -1,21 +0,0 @@ -// #30 legal control — VALUE-BEFORE-USE order. The twin of -// modfn_coexist_ok.ww with the decl order flipped: the value-namespace -// `fn aa` is declared BEFORE `import aa`. cstage is order-independent -// (it installs every SK_USE in a dedicated first pass, cmd/wcc/check.c -// :2811+), so its value-arm promote always fires. wwstage installs in -// source order, so this direction is closed by the symmetric promote in -// installdecl's N_USE arm (set use_alias on the pre-installed value sym, -// mirroring cmd/wcc/check.c:2823-2834). Both orders must compile clean + -// be cs/ww byte-identical AND byte-identical to the use-before-value -// order — the order-dependence is exactly what regresses silently. -// -// Both refs must resolve, so any mis-resolution fails to COMPILE: `aa()` -// must bind the fn (a module is not callable), and `aa.helper()` must bind -// through the module (the fn has no field `helper`). Accept proves both. -package aa; -export fn helper() i32 = { return 5; }; - -package main; -fn aa() i32 = { return 1; }; -import aa; -export fn main() i32 = { return aa() + aa.helper(); }; diff --git a/test/wcc/data/selfimport.ww b/test/wcc/data/selfimport.ww deleted file mode 100644 index f341fa9d..00000000 --- a/test/wcc/data/selfimport.ww +++ /dev/null @@ -1,3 +0,0 @@ -package foo; -import foo; -export fn main() int = { return 0; };