wcc: drop @test fns from non-T builds, both stages (harec check.c:3941)
Splice @test N_FNDECLs out of the unit after the body-check passes, mirroring harec's checked-but-not-emitted: a broken @test body still errors loudly in non-T; @test-free units are emission-unchanged. 910/997 table rows pin keep/test x non-T/-T, head+consecutive unlink, undef-body reject, and plain-calls-dropped loud link-fail. w6c+wwdump combined.ww regen. (#6-team)
This commit is contained in:
18
test/wcc/data/attest_calldropped.ww
Normal file
18
test/wcc/data/attest_calldropped.ww
Normal file
@@ -0,0 +1,18 @@
|
||||
// #6 fixture: a plain fn (the entry) CALLS a @test fn. In non-T the
|
||||
// @test def is spliced out but the CALL survives — harec-faithful: the
|
||||
// reference is left DANGLING and fails LOUDLY at link, never a silent
|
||||
// mis-link (ref/harec/src/check.c:3941 drops the decl; the call site's
|
||||
// symbol is never satisfied). Built non-T then linked: the link MUST
|
||||
// fail with an undefined reference to the dropped @test symbol (910
|
||||
// linkfail probe). No -T variant — a user main is -T-rejected (910).
|
||||
|
||||
package data;
|
||||
|
||||
@test fn calldropped_test() void = {
|
||||
let a: i32 = 1;
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
calldropped_test();
|
||||
return 0;
|
||||
};
|
||||
28
test/wcc/data/attest_nondrop.ww
Normal file
28
test/wcc/data/attest_nondrop.ww
Normal file
@@ -0,0 +1,28 @@
|
||||
// #6 fixture: non-(-T) @test drop, harec-fidelity (ref/harec/src/
|
||||
// check.c:3941 — FN_TEST && !is_test is checked but not emitted). A
|
||||
// normal fn must survive a non-test build; uncalled @test fns must NOT
|
||||
// reach codegen. Under -T the synth entry calls the @test fns, so their
|
||||
// TEXT defs reappear. No imports — compiles straight to asm in both
|
||||
// modes for a TEXT-label grep (910/997 nondrop rows).
|
||||
//
|
||||
// Layout exercises the splice loop's unlink edges: a @test fn FIRST
|
||||
// (prev==nil head-unlink), a surviving plain fn, then TWO consecutive
|
||||
// @test fns (unlink-after-unlink). All three @test defs vanish non-T.
|
||||
|
||||
package data;
|
||||
|
||||
@test fn nondrop_test_a() void = {
|
||||
let a: i32 = 1;
|
||||
};
|
||||
|
||||
fn nondrop_keep() i32 = {
|
||||
return 1;
|
||||
};
|
||||
|
||||
@test fn nondrop_test_b() void = {
|
||||
let a: i32 = 1;
|
||||
};
|
||||
|
||||
@test fn nondrop_test_c() void = {
|
||||
let a: i32 = 1;
|
||||
};
|
||||
17
test/wcc/data/attest_undefbody.ww
Normal file
17
test/wcc/data/attest_undefbody.ww
Normal file
@@ -0,0 +1,17 @@
|
||||
// #6 fixture: a @test body is type-checked in a non-test build even
|
||||
// though the fn is then spliced out. harec checks the body
|
||||
// (ref/harec/src/check.c:3913) BEFORE the append_decl skip (:3941), so
|
||||
// the splice is check-THEN-drop, never drop-then-skip-check. Pins that
|
||||
// placement decision: an undefined symbol in the @test body must be
|
||||
// caught LOUDLY in non-T (a pre-pass splice would silence it). Compiled
|
||||
// WITHOUT -T (910/997 plain-reject row).
|
||||
|
||||
package data;
|
||||
|
||||
fn keep() i32 = {
|
||||
return 1;
|
||||
};
|
||||
|
||||
@test fn undefbody_test() void = {
|
||||
undefined_symbol_xyz();
|
||||
};
|
||||
Reference in New Issue
Block a user