Two corpus defects that deliberate failing tests exposed, both fixed here, and one emitter fix that is entangled with an open decision and is therefore not.
Recursive by value — 9 fields in 6 files
A node type that contains itself by value has infinite size and cannot be named:
pub const Tree(T) = struct {
left : "Tree(T)",
right : "Tree(T)",
};
?T does not help — an optional of a value is still the value's size plus a tag — so ?ListNode and [8]?OctNode are the same defect wearing a question mark. All nine become ?*T, one word and terminating.
Found by following the chain rather than grepping one file: A holding B holding A is the same defect and a single-file scan misses it. Six declarations: Tree(T), List(T), ListNode, KDNode, OctNode, QuadNode.
Measured by running: tri/trees/tree.t27 went from 1 test passing, 1 failing on the infinite-size claim to 2 passing. octree 4 passing, quadtree and kd_tree likewise nameable.
A numeric slice initialised from a string — 4 lines in 3 files
const DEFAULT_KERNEL : []u32 = "[2, 2]";
The string already contains a literal of the right shape, so unquoting is the whole fix. avgpool2d_layer now runs 6 tests.
Neither shows up in zig ast-check: 290 valid and 594 errors are unchanged, because these are semantic, not syntactic. That is the third instrument earning its place.
The keyword field-name fix: correct, and reverted
specs/tools/schema.t27 declares a JSON-Schema record with a field literally named enum. The parser accepted a field name only when the token kind was Ident, so the name was dropped and the element type became the field name — any: void. 23 such fields across 21 specs, 22 of them enum.
Fixing it is one line, with the colon as discriminator so enum ErrorCode { in the braced dialect is not mistaken for a field. It emits @"enum": ?[any] correctly.
And it costs 5 specs. bson, msgpack, async_stream, sort, color went 0 errors → 1, valid 290 → 285.
The reason is the entanglement with #2710: those five contain enum : [Ascending, Descending], the damaged shape that means an enum. Today the field name is dropped, and the leftover bracket list is emitted as Ascending: void, Descending: void — a struct that compiles and satisfies the pinning tests. Preserving the field name emits @"enum": [Ascending,Descending], which is not a type.
So the current passing state of those five depends on a name being thrown away. Both available fixes break them: rewriting the shape to an enum (refuted in #2710 by 27 use sites) and preserving the field name (this). The 23 keyword fields cannot be repaired until enum : [A, B] has an owner's answer.
Reverted with git checkout HEAD -- and rebuilt; 290 / 594 confirmed restored before continuing.
Two corpus defects that deliberate failing tests exposed, both fixed here, and one emitter fix that is entangled with an open decision and is therefore not.
Recursive by value — 9 fields in 6 files
A node type that contains itself by value has infinite size and cannot be named:
?Tdoes not help — an optional of a value is still the value's size plus a tag — so?ListNodeand[8]?OctNodeare the same defect wearing a question mark. All nine become?*T, one word and terminating.Found by following the chain rather than grepping one file: A holding B holding A is the same defect and a single-file scan misses it. Six declarations:
Tree(T),List(T),ListNode,KDNode,OctNode,QuadNode.Measured by running:
tri/trees/tree.t27went from 1 test passing, 1 failing on the infinite-size claim to 2 passing.octree4 passing,quadtreeandkd_treelikewise nameable.A numeric slice initialised from a string — 4 lines in 3 files
The string already contains a literal of the right shape, so unquoting is the whole fix.
avgpool2d_layernow runs 6 tests.Neither shows up in
zig ast-check: 290 valid and 594 errors are unchanged, because these are semantic, not syntactic. That is the third instrument earning its place.The keyword field-name fix: correct, and reverted
specs/tools/schema.t27declares a JSON-Schema record with a field literally namedenum. The parser accepted a field name only when the token kind wasIdent, so the name was dropped and the element type became the field name —any: void. 23 such fields across 21 specs, 22 of themenum.Fixing it is one line, with the colon as discriminator so
enum ErrorCode {in the braced dialect is not mistaken for a field. It emits@"enum": ?[any]correctly.And it costs 5 specs.
bson,msgpack,async_stream,sort,colorwent 0 errors → 1, valid 290 → 285.The reason is the entanglement with #2710: those five contain
enum : [Ascending, Descending], the damaged shape that means an enum. Today the field name is dropped, and the leftover bracket list is emitted asAscending: void, Descending: void— a struct that compiles and satisfies the pinning tests. Preserving the field name emits@"enum": [Ascending,Descending], which is not a type.So the current passing state of those five depends on a name being thrown away. Both available fixes break them: rewriting the shape to an enum (refuted in #2710 by 27 use sites) and preserving the field name (this). The 23 keyword fields cannot be repaired until
enum : [A, B]has an owner's answer.Reverted with
git checkout HEAD --and rebuilt; 290 / 594 confirmed restored before continuing.