Final fold-2 chunk. The 12 Fam13 single-file value drivers move from test/wcc/*_run.c into in-language @test row-tables under test/lang/: - value rows -> test/lang/*_test.ww (12 files) - reject rows -> runww //ww:error carriers (13, dual-stage non-vacuous) - nullable abort rows -> runww //ww:run-exit 1 carriers (3) - 953_globalslice_arg -> _runonly (cs!=ww checker divergence, #28) - 788 value_not_type_neg + 953_arrlit_slice reject_assign kept as slim rc-only .c pins (divergent-diag dual-reject, mutation-gated); 788 #29 Coverage parity verified row-by-row vs each retired driver; advisor- ratified carve taxonomy; two-round reviewed. Floor ratchet follows.
28 lines
1.0 KiB
Plaintext
28 lines
1.0 KiB
Plaintext
// nullable_assert_test — #17 (F4): `e as T` on a nullable `(*T|void)` operand
|
|
// must discriminate POINTER-vs-NULL, not compare the pointer against a variant
|
|
// tag index. Migrated from test/wcc/949_nullable_assert_run.c (success-path
|
|
// value rows; cs==ww byte-id rides T2). The must-abort-on-mismatch polarity
|
|
// rows stay as a carrier (an abort cannot be a @test row).
|
|
//
|
|
// For a nullable operand the slot word IS the pointer (no tag word, zero-cost
|
|
// fold — NOT a 2-variant tagged union, which would exercise the wrong
|
|
// lowering). Pre-fix wwstage cgtypeassert CMPQ'd against the pointer and
|
|
// unwrapped past the 8B slot. asrt_ptr_ok exercises the success arm (valid ptr
|
|
// unwrap + deref); asrt_void_target_ok exercises the void-target arm.
|
|
|
|
package nullable_assert_test;
|
|
|
|
@test fn asrt_ptr_ok() void = {
|
|
let x: int = 42;
|
|
let p: (*int|void) = &x;
|
|
assert(p is *int);
|
|
let q: *int = p as *int;
|
|
assert((*q): i32 == 42);
|
|
};
|
|
|
|
@test fn asrt_void_target_ok() void = {
|
|
let p: (*int|void) = void;
|
|
assert(p is void);
|
|
let z = p as void;
|
|
};
|