test: banner purge + WHY-only comment sweep (rule 8)
Every section banner dies (103 -> 0) across test/lang, the observer suites, the C carriers, and the five comment-heavy corpus fixtures; banner provenance (#N cites, carrier numbers, repair-cluster labels) folded into headers or adjacent WHY comments. Narration deleted; row provenance, ref cites, divergence pins, and layout contracts kept (fwd-ref decl-order guards and bootstrap-gate corpus rationale restored where the sweep over-cut). Comment-only proven: all 3742 wwbuild workdir .s byte-identical before/after; test-commit and test-byteid (161 lang + 1399 data, 0 pinned-divergent) green.
This commit is contained in:
@@ -1,9 +1,3 @@
|
||||
/*
|
||||
* 300_check — type-checker tests.
|
||||
*
|
||||
* Each row is (src, expect) where expect is "ok" (no errors) or a
|
||||
* substring that must appear in the captured stderr.
|
||||
*/
|
||||
#include "ww.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -54,7 +48,6 @@ runrow(const char *src, const char *expect)
|
||||
struct row { const char *src, *expect; };
|
||||
|
||||
static const struct row rows[] = {
|
||||
/* OK cases */
|
||||
{ "fn main() void = {};", "ok" },
|
||||
{ "fn id(x: i32) i32 = { return x; };", "ok" },
|
||||
{ "fn add(a: i32, b: i32) i32 = { return a + b; };", "ok" },
|
||||
@@ -81,14 +74,12 @@ static const struct row rows[] = {
|
||||
"type point = struct { x: i32 };", "ok" },
|
||||
{ "fn loops() void = { for () { break; }; for () { continue; }; };", "ok" },
|
||||
|
||||
/* multi-return tuples */
|
||||
{ "fn divmod(a: i64, b: i64) (i64, i64) = { return a / b, a % b; };", "ok" },
|
||||
{ "fn dm(a: i64, b: i64) (i64, i64) = { return a, b; };\n"
|
||||
"fn caller() i64 = { let q, r = dm(10, 3); return q + r; };", "ok" },
|
||||
{ "fn dm() (i64, i64) = { return 1, 2; };\n"
|
||||
"fn ass() void = { let q: i64 = 0; let r: i64 = 0; q, r = dm(); };", "ok" },
|
||||
|
||||
/* error cases */
|
||||
{ "fn f() void = { return 1; };", "return value in void" },
|
||||
{ "fn f() i32 = { return; };", "not assignable" },
|
||||
{ "fn f() void = { x = 1; };", "undefined" },
|
||||
@@ -111,7 +102,6 @@ static const struct row rows[] = {
|
||||
"not enough arguments" },
|
||||
{ "fn f() void = { if (1) { }; };", "if condition" },
|
||||
|
||||
/* tagged-union normalization & exhaustiveness */
|
||||
{ "fn f() (i32 | never) = { return 7; }; "
|
||||
"fn g() i32 = { return f(); };", "ok" }, /* (T|never) → T */
|
||||
{ "fn f() (i32 | i32) = { return 5; }; "
|
||||
@@ -130,7 +120,6 @@ static const struct row rows[] = {
|
||||
{ "fn die() never = { for (true) { let _: i32 = 1; }; }; "
|
||||
"fn f() i32 = { die(); };", "ok" }, /* never assignable to anything */
|
||||
|
||||
/* ? error-subset propagation typecheck */
|
||||
{ "fn inner() (i32 | str) = { return 1; }; "
|
||||
"fn outer() i32 = { let v: i32 = inner()?; return v; };",
|
||||
"enclosing function must return a tagged union" },
|
||||
@@ -155,7 +144,6 @@ static const struct row rows[] = {
|
||||
{ "fn lookup(p: *i32) (*i32 | void) = { return p; };", "ok" },
|
||||
{ "fn lookup() (*i32 | void) = { return; };", "ok" }, /* bare return → null */
|
||||
|
||||
/* `case T` must name a variant of the scrutinee */
|
||||
{ "fn pick() (i32 | str) = { return 1; }; "
|
||||
"fn caller() void = { let v: (i32 | str) = pick(); "
|
||||
"match (v) { case let n: i32 => { }; case let s: str => { }; "
|
||||
@@ -168,7 +156,6 @@ static const struct row rows[] = {
|
||||
"return 0; };",
|
||||
"case: f64 is not a variant" },
|
||||
|
||||
/* enum types */
|
||||
{ "type color = enum { RED, GREEN, BLUE };\n"
|
||||
"fn f() i32 = { return color.GREEN as i32; };", "ok" },
|
||||
{ "type mode = enum u8 { R = 1, W = 2, RW = R | W };\n"
|
||||
|
||||
Reference in New Issue
Block a user