test/wcc: retire 990_selfhost; its live assertions move to their owners
Every probe's assertion is owned by a current gate: the compile and link probes by make all and the bootstrap fixed point; build/run and cs/ww byte identity by the fixture corpus, test-data-byteid, and 989_lib_byteid; wwstage driver and toolchain parity by 993/995; checker-diagnostic parity by the corpus' both-stage //ww:error rows. The wwdump -t/-a dump-parity probes gated the frontend port's convergence, which the compiler-output identity gates now own end to end; carrier ran green at retirement. What was still uniquely alive migrates: smoke.ww becomes corpus fixture selfhost_smoke (upgraded from a cstage-only build to both frontends, byte-identical, exit 42 on both toolchains; corpus pins move to 1,225/763/2,450 with the new identity hash in the same commit), and sym_link.ww's scope/sym behavior rows become in-language lib/ww/syntax/symtest.ww under LIBRARY_TESTS. uses.ww (parser-stub-era -a fixture) and the already-orphaned tagged_ptr_ret.ww/trypromote.ww retire with the probe corpus. Bootstrap native gates drop to six; frontend numeric-sync comments now cite the rule-6 mirror instead of the retired diff probe.
This commit is contained in:
@@ -14,13 +14,12 @@ import strconv;
|
||||
|
||||
// ---- Nkind ------------------------------------------------------------
|
||||
//
|
||||
// Mirror of cmd/wcc/ww.h Nkind. Values must stay numerically equal so
|
||||
// the AST diff probe in 990_selfhost works.
|
||||
// Mirror of cmd/wcc/ww.h Nkind. Values must stay numerically equal
|
||||
// to the C side (rule-6 data-shape mirror).
|
||||
|
||||
// Mirror of the C `Nkind` enum in cmd/wcc/ww.h. Numeric values are
|
||||
// explicit and must stay in sync — the 990_selfhost test diffs
|
||||
// astprint against the C side byte-for-byte. Tail-appended entries
|
||||
// (TYPETEST onward) preserve every prior N_* value.
|
||||
// explicit and must stay in sync with the C side. Tail-appended
|
||||
// entries (TYPETEST onward) preserve every prior N_* value.
|
||||
export type nkind = enum i32 {
|
||||
N_NONE = 0,
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// lib/ww/syntax/lex.ww — port of cmd/wcc/lex.c.
|
||||
//
|
||||
// The DFA, the helpers, and the order of decisions all mirror the C
|
||||
// version exactly. The 990_selfhost test diffs the resulting token
|
||||
// stream against the C-side wwdump byte-for-byte; any divergence is
|
||||
// a port bug.
|
||||
// version exactly; any divergence surfaces as a cs/ww byte split in
|
||||
// the compiler-output identity gates and is a port bug.
|
||||
//
|
||||
// Calling-convention note: w6c can't yet pass or return structs >16
|
||||
// bytes by value, so `tok` and `pos` are passed by pointer (out
|
||||
|
||||
47
lib/ww/syntax/symtest.ww
Normal file
47
lib/ww/syntax/symtest.ww
Normal file
@@ -0,0 +1,47 @@
|
||||
// symtest — behavior pin for [[newscope]]/[[scopedefine]]/[[scopelookup]]
|
||||
// (hashtable scope semantics: define, same-scope duplicate reject,
|
||||
// kind-preserving lookup, not-found nil). Run with
|
||||
// `ww test -I lib/ww lib/ww/syntax/symtest.ww`.
|
||||
//
|
||||
// Migrated from selfhost/test/sym_link.ww (the 990_selfhost link
|
||||
// probe): the toolchain-link half of that probe is owned by the
|
||||
// fixture corpus' ww-stage cells, so only the scope behavior rows
|
||||
// survive, as in-language rows. `package main` + bare `import syntax`
|
||||
// mirrors toktest/asttest.
|
||||
|
||||
package main;
|
||||
|
||||
import syntax;
|
||||
|
||||
@test fn scope_define_lookup() void = {
|
||||
let s: *scope = newscope(nil);
|
||||
assert(!(s == nil));
|
||||
|
||||
let r1: *sym = scopedefine(s, "foo", skind.SK_VAR, nil, nil);
|
||||
assert(!(r1 == nil));
|
||||
let r2: *sym = scopedefine(s, "bar", skind.SK_TYPE, nil, nil);
|
||||
assert(!(r2 == nil));
|
||||
|
||||
let l1: *sym = scopelookup(s, "foo");
|
||||
assert(!(l1 == nil));
|
||||
assert(!(l1.skind != skind.SK_VAR));
|
||||
let l2: *sym = scopelookup(s, "bar");
|
||||
assert(!(l2 == nil));
|
||||
assert(!(l2.skind != skind.SK_TYPE));
|
||||
};
|
||||
|
||||
@test fn scope_duplicate_reject() void = {
|
||||
let s: *scope = newscope(nil);
|
||||
assert(!(s == nil));
|
||||
let r1: *sym = scopedefine(s, "foo", skind.SK_VAR, nil, nil);
|
||||
assert(!(r1 == nil));
|
||||
let r3: *sym = scopedefine(s, "foo", skind.SK_VAR, nil, nil);
|
||||
assert(!(r3 != nil));
|
||||
};
|
||||
|
||||
@test fn scope_notfound_nil() void = {
|
||||
let s: *scope = newscope(nil);
|
||||
assert(!(s == nil));
|
||||
let l3: *sym = scopelookup(s, "baz");
|
||||
assert(!(l3 != nil));
|
||||
};
|
||||
@@ -1,10 +1,9 @@
|
||||
// lib/ww/syntax/tok.ww — port of cmd/wcc/tok.c plus the Tkind /
|
||||
// Tok / Pos shapes from cmd/wcc/ww.h.
|
||||
//
|
||||
// Token kind values must stay numerically equal to the C side: the
|
||||
// 990_selfhost test diffs ww-side wwdump output against C-side
|
||||
// wwdump output, byte-for-byte. Reordering this list shifts the
|
||||
// integers and breaks the diff.
|
||||
// Token kind values must stay numerically equal to the C side
|
||||
// (rule-6 data-shape mirror of cmd/wcc/ww.h). Reordering this list
|
||||
// shifts the integers and splits the two frontends.
|
||||
//
|
||||
// Bottom of file: tokprint, which emits one token per line in a
|
||||
// format identical to cmd/wcc/tok.c:tokprint().
|
||||
@@ -17,8 +16,7 @@ import strings;
|
||||
|
||||
// ---- tkind ------------------------------------------------------------
|
||||
// Mirror of the C `Tkind` enum in cmd/wcc/ww.h. Numeric values are
|
||||
// explicit and must stay in sync — the 990_selfhost test diffs wwdump
|
||||
// output against the C side, byte for byte.
|
||||
// explicit and must stay in sync with the C side.
|
||||
|
||||
export type tkind = enum i32 {
|
||||
TK_NONE = 0,
|
||||
@@ -112,7 +110,7 @@ export type tkind = enum i32 {
|
||||
TK_FATARROW = 81,
|
||||
|
||||
// Tail-appended values — keeps every prior TK_* numeric value
|
||||
// stable for the 990_selfhost byte-diff against the C side.
|
||||
// stable against the C side.
|
||||
TK_IS = 82,
|
||||
TK_VOID = 83,
|
||||
TK_YIELD = 84,
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
// switch (STR/IDENT/ERR vs INT/RUNE vs the value-less default) and,
|
||||
// through the STR text, fputq's full escape switch (\\, ", \n, \t,
|
||||
// \r, the c<0x20 and c==0x7f \xNN arms, and the printable tail) —
|
||||
// branches the 990_selfhost corpus does not exercise (source tokens
|
||||
// hold raw `\`+`n`, never a literal control byte).
|
||||
// branches ordinary source tokens do not exercise (they hold raw
|
||||
// `\`+`n`, never a literal control byte).
|
||||
// A failing row aborts via the assert/abort builtin (task #5 @test
|
||||
// conversion); per-row exit-code pinpoint is intentionally dropped (the
|
||||
// abort reports the file, not the row; drew-t2-conversion-spec sec.5).
|
||||
|
||||
Reference in New Issue
Block a user