test: remove package-wide import assumptions

This commit is contained in:
2026-08-14 03:45:02 +09:00
parent a841278333
commit 04d9560d51
74 changed files with 121 additions and 154 deletions

View File

@@ -509,10 +509,11 @@ wwtest/test/tool/ffivariadic_test.ww: $(OUT)/ffivariadic/libffifix.a
# *_test.ww is discovered by the walk, and the libbyteid completeness
# scan still fails loudly on any unenrolled lib/ dir.
# These real sources have a standalone-compilation contract that is not
# subsumed by a library @test import owner.
LIBRARY_STANDALONE_SOURCES = lib/io/io.ww lib/strconv/strconv.ww \
lib/hash/fnv/fnv.ww lib/net/net.ww
# These import-free real sources have a standalone-compilation contract that
# is not subsumed by a library @test import owner. Import-bearing sources need
# their direct export data so the compiler can obtain declared package names;
# the package coordinator's lib/... walk owns those checks.
LIBRARY_STANDALONE_SOURCES = lib/io/io.ww lib/hash/fnv/fnv.ww lib/net/net.ww
test-unit: $(UNIT_BINS)
@set -e; for t in $(UNIT_BINS); do \

View File

@@ -27,14 +27,14 @@ categories out of the ordinary developer target.
| Package semantics | `test/package` and the native package-test coordinator |
| Language behavior | `test/lang/*_test.ww` through the language `@test` runtime |
| Library behavior | The package coordinator's `lib/...` tree walk (`ww test -j N lib/...`) |
| Standalone library-source compilation | Four real source paths named by `LIBRARY_STANDALONE_SOURCES`, compiled directly by both frontends |
| Standalone library-source compilation | Three import-free real source paths named by `LIBRARY_STANDALONE_SOURCES`, compiled directly by both frontends |
| Compiler-output identity | `test-lang-byteid` and `test-data-byteid` plus residual byte/artifact carriers |
| Fixed point and self-host | `test-bootstrap` |
| Host linker/platform behavior | `test-platform` |
The live declarative compiler corpus has 1,745 fixtures and 3,490 C/WW cells:
346 expected rejections, 21 compile-only successes, 209 exit-zero
programs, and 1,169 explicit-exit programs.
The live declarative compiler corpus has 1,759 fixtures and 3,518 C/WW cells:
351 expected rejections, 22 compile-only successes, 209 exit-zero
programs, and 1,177 explicit-exit programs.
15 native C carriers remain. They are partitioned exactly once into
the two terminal classes: six in-process units (`738_module_decl`
@@ -101,7 +101,7 @@ outright; git history is the archive.
| `test-compiler` | Complete fixture corpus plus residual compiler/integration carriers |
| `test-package` | Package planning, grouping, routing, and package runtime only |
| `test-lang` | Language-owned `@test` behavior |
| `test-library` | The coordinator's `lib/...` walk plus four direct standalone-source C/WW compilation checks |
| `test-library` | The coordinator's `lib/...` walk plus three import-free standalone-source C/WW compilation checks |
| `test-commit` | Unit + compiler + package + language + library behavior |
| `test-byteid` | Compiler-output identity gates |
| `test-bootstrap` | Fixed-point bootstrap plus the 950/991995 native gates |

View File

@@ -13,7 +13,6 @@ import bytes;
import errors;
import io;
import memio;
import strings;
import test;

View File

@@ -21,7 +21,6 @@ package getopt_test;
import getopt;
import io;
import memio;
import strings;
fn streq(a: str, b: str) bool = {
if (a.len != b.len) { return false; };

View File

@@ -6,7 +6,6 @@
package strings_test;
import strings;
import encoding.utf8;
// ref/hare/strings/utf8.ha:31. Validation-half coverage lives in
// lib/encoding/utf8 (utf8test) per CLAUDE.md rule 9 carve-out.

View File

@@ -2470,11 +2470,22 @@ fn hexbytes(value: str) str = {
let roota: str = "package main;\n// ROOT_A\n";
i = 0;
for (i < packagecount) {
if (i != 150) {
roota = strings.concat(roota, "import ", boundarypkgname(i), ";\n");
};
i += 1;
};
i = 0;
for (i < packagecount) {
if (i != 150) {
let name: str = boundarypkgname(i);
roota = strings.concat(roota, "fn use_", name,
"() i32 = { return ", name, ".value(); };\n");
};
i += 1;
};
let rootz: str = strings.concat("package main;\nimport p150;\n",
"// ROOT_Z\nfn main() i32 = { return p000.value() - 42; };\n");
"// ROOT_Z\nfn main() i32 = { return p150.value() - 42; };\n");
writefile(strings.concat(target, "/a.ww"), roota);
writefile(strings.concat(target, "/z.ww"), rootz);
let chainsource: str = strings.concat("package main;\nimport p000;\n",
@@ -2847,9 +2858,9 @@ fn hexbytes(value: str) str = {
let totaldirectorycount: i32 = directorycount + aliascount;
let productcount: i32 = directorycount * 2 + aliascount;
// Each selected directory contributes production, internal, external, and
// two generated-main actions. The shared test support action and its nine
// two generated-main actions. The shared test support action and its eight
// ordinary dependencies are command-global actions too.
let directactioncount: i32 = directorycount * 5 + 10;
let directactioncount: i32 = directorycount * 5 + 9;
let coordinatoractioncount: i32 = directactioncount + aliascount * 2;
let i: i32 = 0;
for (i < directorycount) {
@@ -3218,7 +3229,7 @@ fn hexbytes(value: str) str = {
i += 1;
};
let supportactions: []str = ["ascii", "bytes", "encoding.utf8",
"fnmatch", "os", "rt", "strings", "test", "time", "types"];
"fnmatch", "os", "strings", "test", "time", "types"];
let ai: i32 = 0;
for (ai < supportactions.len) {
i = 0;
@@ -3643,7 +3654,6 @@ fn hexbytes(value: str) str = {
let clientbody: str = strings.concat(
"package main;\n",
"import domain.internal.secret;\n",
"import domain.internal.secret;\n",
"fn main() i32 = { return secret.value(); };\n");
writefile(strings.concat(leaf, "/leaf.ww"), leafbody);
writefile(strings.concat(secret, "/a.ww"), secreta);

View File

@@ -7,12 +7,12 @@ package sepbuild_test;
// remains live.
//
// sepbuild (#46 commit-3) — build_one_sep END-TO-END on the real lib
// chain root -> os -> {rt,time} (transitive-closure discovery + topo):
// build+run exit 7 both stages; {time,rt,os,__root}.wwi/.a
// chain root -> os -> time (transitive-closure discovery + topo):
// build+run exit 7 both stages; {time,os,__root}.wwi/.a
// materialize; per-package .s/.wwi/.a/.unit.ww and the final binary
// byte-id cs vs ww; every .unit.ww is the package's own sorted source
// set; `ww run` routes through the same sole sep path (exit 7 both
// stages).
// set; the runtime remains a fixed linker input rather than a source graph
// action; `ww run` routes through the same sole sep path (exit 7 both stages).
//
// seproot — a ROOT whose `export fn use(a: *t)` reaches an unexported
// local `type t` builds and emits a deterministic self-contained .wwi/.a.
@@ -89,7 +89,7 @@ fn samefile(label: str, what: str, a: str, b: str) void = {
};
// discovery/topo: every reachable package action materialized.
let pkgs: []str = ["time", "rt", "os", "__root"];
let pkgs: []str = ["time", "os", "__root"];
let i: i32 = 0;
for (i < pkgs.len) {
if (!testenv.exists(strings.concat(td, "/prog.cs.sepwork/",

View File

@@ -18,12 +18,10 @@ package sepimport_test;
// emitting a bare `TEXT main` that collides with the root entry;
// EXACTLY one column-0 `TEXT main,` across the whole sep build.
//
// declns (#23/#30 modfn leg) — a value-namespace `fn aa` coexists
// with an imported MODULE aa (exit 6 = aa() + aa.helper()); the _vbu
// layout flips decl order and must stay byte-identical on
// {aa.s,aa.wwi,__root.s} (silent order-dependence in the SK_USE/value
// promote is the regression); __root.s carries BOTH
// `CALL aa.helper(SB)` and `CALL main.aa(SB)`.
// declns (#23/#30 modfn leg) — a distinct local `fn localaa` and the
// file-scoped imported qualifier aa both resolve (exit 6 = localaa() +
// aa.helper()); the _vbu layout flips declaration/import order and must stay
// byte-identical on {aa.s,aa.wwi,__root.s}; __root.s carries both calls.
//
// slttypepref (#58/#50 c1) — scopelookuptype must prefer the current
// module's SK_TYPE when a param shadows a type leaf two modules both
@@ -204,7 +202,7 @@ fn depmainrow(label: str, entry: str, want: i32, deps: str,
if (runcode(td, strings.concat("r_", labs[l], "_", tags[s]),
rav) != 6) {
fail(labs[l], strings.concat(drvs[s],
" exit != 6 (coexistence mis-resolved)"));
" exit != 6 (qualified/local resolution failed)"));
};
s += 1;
};
@@ -264,9 +262,9 @@ fn depmainrow(label: str, entry: str, want: i32, deps: str,
fail("declns", strings.concat("__root.s (", tags[t2],
") lacks module-qualified `CALL aa.helper(SB)`"));
};
if (!testenv.has(rs, "CALL\tmain.aa(SB)")) {
if (!testenv.has(rs, "CALL\tmain.localaa(SB)")) {
fail("declns", strings.concat("__root.s (", tags[t2],
") lacks local-fn `CALL main.aa(SB)`"));
") lacks local-fn `CALL main.localaa(SB)`"));
};
t2 += 1;
};
@@ -287,11 +285,13 @@ fn sltbuild(drv: str, param: str) i32 = {
"import xa;\n",
"export type invalid = !i64;\n",
"export fn f(", param,
": i32) i64 = { return size(invalid): i64; };\n"));
": i32) i64 = {\n",
"\tlet foreign: i64 = size(xa.invalid): i64;\n",
"\treturn (size(invalid): i64) + foreign - foreign;\n",
"};\n"));
testenv.writefile(strings.concat(dir, "/root.ww"), strings.concat(
"package main;\n",
"import xb;\n",
"import xa;\n",
"fn main() int = { return xb.f(0): int; };\n"));
let bav: []str = [testenv.driver(drv), "build", "root.ww"];
let brc: i32 = runcode(dir, "build", bav);

View File

@@ -1,5 +1,4 @@
// #30 dir-package — the imported module `aa`. Paired with ../main.ww,
// whose primary package also declares a value-namespace `fn aa`. Driver:
// the modfn_coexist leg of the decl-namespace gate (NNN_declns_sep.c).
// #30 dir-package — the imported package whose declared name supplies the
// `aa` binding in ../main.ww. Driver: the declns leg of sepimport_test.
package aa;
export fn helper() i32 = { return 5; };

View File

@@ -1,11 +1,8 @@
// #30 dir-package coexistence — the value-namespace `fn aa` and the
// imported MODULE `aa` (SK_USE) coexist. `aa()` binds the local fn (a
// module is not callable); `aa.helper()` binds through the module (the
// fn has no field `helper`). Both must resolve, so any mis-resolution
// fails to COMPILE; running to 1+5=6 proves both bind. The dir-package
// reshape of the dying single-file modfn_coexist_ok.ww (M4 amalgamation
// shape retired at the flip).
// The imported default qualifier `aa` and package-level declarations occupy
// overlapping Go-style scopes, so the local function deliberately has a
// distinct name. Running to 1+5=6 proves both the local declaration and the
// file-scoped import binding resolve independently.
package main;
import aa;
fn aa() i32 = { return 1; };
export fn main() i32 = { return aa() + aa.helper(); };
fn localaa() i32 = { return 1; };
export fn main() i32 = { return localaa() + aa.helper(); };

View File

@@ -1,6 +1,5 @@
// #30 dir-package — the imported module `aa` for the VALUE-BEFORE-USE
// twin. Identical to ../../modfn_coexist/aa/aa.ww; kept as its own dir so
// the two layouts are independently buildable. Driver: the
// modfn_coexist_vbu leg of the decl-namespace gate (NNN_declns_sep.c).
// #30 dir-package — the imported package for the declaration-before-import
// twin. It stays in its own directory so the two layouts are independently
// buildable.
package aa;
export fn helper() i32 = { return 5; };

View File

@@ -1,12 +1,7 @@
// #30 VALUE-BEFORE-USE — the twin of ../modfn_coexist/main.ww with the
// decl order flipped: `fn aa` is declared BEFORE `import aa`. cstage is
// order-independent (installs every SK_USE in a first pass); wwstage
// installs in source order, so this direction exercises a DISTINCT path
// (installdecl's N_USE arm must set use_alias on the pre-installed value
// sym). The gate asserts this builds + runs to 6 AND emits asm
// byte-identical to the use-before-value order — silent order-dependence
// is exactly what regresses.
// Declaration-before-import twin of ../modfn_coexist/main.ww. The distinct
// local name follows Go's import/package-scope collision rule while retaining
// the order-independence check for installing a real import binding.
package main;
fn aa() i32 = { return 1; };
fn localaa() i32 = { return 1; };
import aa;
export fn main() i32 = { return aa() + aa.helper(); };
export fn main() i32 = { return localaa() + aa.helper(); };

View File

@@ -1,13 +1,8 @@
//ww:run-exit 42
package main;
// migrated from test/wcc/699_use_promote_alias.c: SK_USE->SK_DEF promotion must keep use_alias so `defmod.flag` resolves.
package defmod;
export def defmod: i32 = 0i32;
export type flag = enum i32 {
NONE = 0,
A = 42,
};
package main;
// migrated from test/wcc/699_use_promote_alias.c: importing a package whose
// export has the same name as its default qualifier must retain the qualifier
// binding so `defmod.flag` resolves.
import defmod;
fn main() i32 = {
let m: defmod.flag = defmod.flag.A;

View File

@@ -0,0 +1,7 @@
package defmod;
export def defmod: i32 = 0i32;
export type flag = enum i32 {
NONE = 0,
A = 42,
};

View File

@@ -1,15 +1,8 @@
//ww:run-exit 42
package main;
// migrated from test/wcc/699_use_promote_alias.c: SK_USE->SK_FN promotion (the original bug) must keep use_alias or `fnmod.flag` fails "unknown type".
package fnmod;
export type flag = enum i32 {
NONE = 0,
A = 42,
};
export fn fnmod() i32 = {
return 0i32;
};
package main;
// migrated from test/wcc/699_use_promote_alias.c: importing a package whose
// export has the same name as its default qualifier must retain the qualifier
// binding so `fnmod.flag` resolves.
import fnmod;
fn main() i32 = {
let m: fnmod.flag = fnmod.flag.A;

View File

@@ -0,0 +1,9 @@
package fnmod;
export type flag = enum i32 {
NONE = 0,
A = 42,
};
export fn fnmod() i32 = {
return 0i32;
};

View File

@@ -1,15 +1,8 @@
//ww:run-exit 42
package main;
// migrated from test/wcc/699_use_promote_alias.c: SK_USE->SK_TYPE in-place promotion keeps use_alias so `typmod.flag` resolves (check.c self-import branch).
package typmod;
export type typmod = struct {
x: i32,
};
export type flag = enum i32 {
NONE = 0,
A = 42,
};
package main;
// migrated from test/wcc/699_use_promote_alias.c: importing a package whose
// export has the same name as its default qualifier must retain the qualifier
// binding so `typmod.flag` resolves.
import typmod;
fn main() i32 = {
let m: typmod.flag = typmod.flag.A;

View File

@@ -0,0 +1,9 @@
package typmod;
export type typmod = struct {
x: i32,
};
export type flag = enum i32 {
NONE = 0,
A = 42,
};

View File

@@ -1,13 +1,8 @@
//ww:run-exit 42
package main;
// migrated from test/wcc/699_use_promote_alias.c: SK_USE->SK_VAR promotion must keep use_alias so `varmod.flag` resolves.
package varmod;
export let varmod: i32 = 0i32;
export type flag = enum i32 {
NONE = 0,
A = 42,
};
package main;
// migrated from test/wcc/699_use_promote_alias.c: importing a package whose
// export has the same name as its default qualifier must retain the qualifier
// binding so `varmod.flag` resolves.
import varmod;
fn main() i32 = {
let m: varmod.flag = varmod.flag.A;

View File

@@ -0,0 +1,7 @@
package varmod;
export let varmod: i32 = 0i32;
export type flag = enum i32 {
NONE = 0,
A = 42,
};

View File

@@ -1,8 +1,6 @@
//ww:run-exit 42
// Migrated from 700_e2e row 45.
package main;
import os;
import rt;
type point = struct { x: i64, y: i64 };
fn main() i32 = {
let p: *point = alloc(point { x = 7, y = 35 })!;

View File

@@ -1,7 +1,6 @@
//ww:run-exit 16
// Migrated from 700_e2e row 36.
package main;
import rt;
fn main() i32 = {
let s: []u8 = alloc([], 16)!;
append(s, 72u8, 105u8);

View File

@@ -1,7 +1,6 @@
//ww:run-exit 12
// Migrated from 700_e2e row 39.
package main;
import rt;
fn doit() (i32 | nomem) = {
let s: []str = alloc([], 12)?;
return s.cap: i32;

View File

@@ -1,7 +1,6 @@
//ww:run-exit 8
// Migrated from 700_e2e row 37.
package main;
import rt;
fn main() i32 = {
let s: []rune = alloc([], 8)!;
return s.cap;

View File

@@ -1,7 +1,6 @@
//ww:run-exit 4
// Migrated from 700_e2e row 38.
package main;
import rt;
fn main() i32 = {
let s: []str = alloc([], 4)!;
return s.cap;

View File

@@ -1,7 +1,6 @@
//ww:run-exit 25
// Migrated from 700_e2e row 34.
package main;
import rt;
type point = struct { x: i32, y: i32 };
fn main() i32 = {
let p: *point = alloc(point { x = 3, y = 4 })!;

View File

@@ -1,7 +1,6 @@
//ww:run-exit 100
// Migrated from 700_e2e row 35.
package main;
import os;
fn main() i32 = {
let s: []u8;
s.ptr = nil; s.len = 0; s.cap = 0;

View File

@@ -1,6 +1,5 @@
//ww:run-exit 5
package main;
import rt;
fn main() i32 = {
let w: []i32 = alloc([], 4u64)!;
w[2] = 5i32;

View File

@@ -1,6 +1,5 @@
//ww:run-exit 16
package main;
import rt;
fn main() i32 = {
let b: []u8 = alloc([], 8u64)!;
b[0] = 7u8;

View File

@@ -1,6 +1,5 @@
//ww:run-exit 11
package main;
import os;
fn want(args: (str | rune)...) i64 = {
let total: i64 = 0;
let i: i32 = 0;

View File

@@ -4,6 +4,7 @@ package main;
import alpha;
import beta;
export fn main() i32 = {
let _ = alpha.foo(0, 1);
let n: (u8 | []u8) = 7u8;
let r: i32 = beta.foo(10, n);
if (r != 17) { return 11; };

View File

@@ -1,5 +1,4 @@
//ww:run-exit 13
package main;
import rt;
type holder = struct { f: f64, s: str, n: i32 };
fn main() i32 = { let p: *holder = alloc(holder { f = 1.5f64, s = "abc", n = 10 })!; return p.s.len + p.n; };

View File

@@ -1,5 +1,4 @@
//ww:run-exit 102
package main;
import rt;
type holder = struct { n: i32, s: str };
fn main() i32 = { let p: *holder = alloc(holder { n = 100, s = "hi" })!; return p.n + p.s.len; };

View File

@@ -1,5 +1,4 @@
//ww:run-exit 209
package main;
import rt;
type holder = struct { s: str };
fn main() i32 = { let p: *holder = alloc(holder { s = "hi" })!; let sum: i32 = 0; let i: i32 = 0; for (i < p.s.len) { sum += p.s[i]: i32; i += 1; }; return sum; };

View File

@@ -1,5 +1,4 @@
//ww:run-exit 5
package main;
import rt;
type holder = struct { s: str };
fn main() i32 = { let p: *holder = alloc(holder { s = "hello" })!; return p.s.len; };

View File

@@ -1,5 +1,4 @@
//ww:run-exit 12
package main;
import rt;
type holder = struct { s: str, n: i32 };
fn main() i32 = { let p: *holder = alloc(holder { s = "world", n = 7 })!; return p.s.len + p.n; };

View File

@@ -1,5 +1,4 @@
//ww:run-exit 9
package main;
import rt;
type holder = struct { a: str, b: str };
fn main() i32 = { let p: *holder = alloc(holder { a = "foo", b = "barbaz" })!; return p.a.len + p.b.len; };

View File

@@ -3,7 +3,6 @@
package main;
import memio;
import io;
import os;
export fn main() i32 = {
let buf: [16]u8;
let st: memio.stream = memio.fixed(buf[0:16]);

View File

@@ -3,7 +3,6 @@
package main;
import memio;
import io;
import os;
export fn main() i32 = {
let seed: [4]u8;
seed[0] = 1u8; seed[1] = 2u8; seed[2] = 3u8; seed[3] = 4u8;

View File

@@ -3,7 +3,6 @@
package main;
import memio;
import io;
import os;
export fn main() i32 = {
let a: [3]u8;
a[0] = 10u8; a[1] = 11u8; a[2] = 12u8;

View File

@@ -3,7 +3,6 @@
package main;
import memio;
import io;
import os;
export fn main() i32 = {
let st: memio.stream = memio.dynamic();
let s: io.stream = &st.vt;

View File

@@ -3,7 +3,6 @@
package main;
import memio;
import io;
import os;
export fn main() i32 = {
let seed: [4]u8;
seed[0] = 1u8; seed[1] = 2u8; seed[2] = 3u8; seed[3] = 4u8;

View File

@@ -3,7 +3,6 @@
package main;
import memio;
import io;
import os;
export fn main() i32 = {
let buf: [8]u8;
buf[0] = 65u8; buf[1] = 66u8; buf[2] = 67u8; buf[3] = 68u8;

View File

@@ -1,7 +1,6 @@
//ww:run-exit 46
// Migrated from 777_fmt_handle_run row fprintf_stream.
package main;
import os;
import fmt;
import io;
import memio;

View File

@@ -1,7 +1,6 @@
//ww:run-exit 51
// Migrated from 778_bufio_vstream_run row branched_bufio_wrap.
package main;
import os;
import bufio;
import memio;
import io;

View File

@@ -1,7 +1,6 @@
//ww:run-exit 49
// Migrated from 778_bufio_vstream_run row isbuffered_v_boundary.
package main;
import os;
import bufio;
import memio;
import io;

View File

@@ -1,7 +1,6 @@
//ww:run-exit 48
// Migrated from 778_bufio_vstream_run row isbuffered_v_discriminate.
package main;
import os;
import bufio;
import memio;
import io;

View File

@@ -1,7 +1,6 @@
//ww:run-exit 53
// Migrated from 778_bufio_vstream_run row scanner_byte_bytes.
package main;
import os;
import bufio;
import errors;
import memio;

View File

@@ -1,7 +1,6 @@
//ww:run-exit 52
// Migrated from 778_bufio_vstream_run row scanner_lines.
package main;
import os;
import bufio;
import errors;
import memio;

View File

@@ -1,7 +1,6 @@
//ww:run-exit 47
// Migrated from 778_bufio_vstream_run row stream_read_unread.
package main;
import os;
import bufio;
import memio;
import io;

View File

@@ -1,7 +1,6 @@
//ww:run-exit 54
// Migrated from 778_bufio_vstream_run row stream_setflush.
package main;
import os;
import bufio;
import memio;
import io;

View File

@@ -1,7 +1,6 @@
//ww:run-exit 55
// Migrated from 778_bufio_vstream_run row stream_unread.
package main;
import os;
import bufio;
import memio;
import io;

View File

@@ -1,7 +1,6 @@
//ww:run-exit 46
// Migrated from 778_bufio_vstream_run row stream_write_flush.
package main;
import os;
import bufio;
import memio;
import io;

View File

@@ -1,6 +1,5 @@
//ww:run-exit 45
package main;
import os;
import log;
import memio;
import io;

View File

@@ -1,6 +1,5 @@
//ww:run-exit 44
package main;
import os;
import log;
import memio;
import io;

View File

@@ -1,6 +1,5 @@
//ww:run-exit 43
package main;
import os;
import log;
export fn main() i32 = {
log.printfln("v={}", 7i64);

View File

@@ -1,6 +1,5 @@
//ww:run-exit 42
package main;
import os;
import log;
export fn main() i32 = {
log.println("hello");

View File

@@ -5,6 +5,7 @@ import sa;
import sb;
fn cb(x: sa.s, v: i32) i32 = { return v + 100; };
export fn main() i32 = {
let bait: sb.s;
let vt = sa.mkvt((&cb): *sa.reader);
let st: sa.s = &vt;
let r = sa.read(st, 5);

View File

@@ -4,6 +4,7 @@ package main;
import sa;
import sb;
export fn main() i32 = {
let bait: sb.s;
let o = sa.mk(21, 8);
let r = sa.geta(o);
if (r != 21) { return 11; };

View File

@@ -1,6 +1,5 @@
//ww:run-exit 50
package main;
import os;
import fmt;
import io;
import memio;

View File

@@ -1,6 +1,5 @@
//ww:run-exit 51
package main;
import os;
import fmt;
import io;
import memio;

View File

@@ -1,6 +1,5 @@
//ww:run-exit 52
package main;
import os;
import fmt;
import io;
import memio;

View File

@@ -1,6 +1,5 @@
//ww:run-exit 54
package main;
import os;
import fmt;
import io;
export fn main() i32 = { let buf: [16]u8; let x: int = 42; let v: str = ""; match (fmt.bsprintf(buf[0:16], "{}", x)) { case let s: str => { v = s; }; case io.error => { return 91; }; }; if (v.len != 2) { return 92; }; if (v[0] != 52u8 || v[1] != 50u8) { return 93; }; return 54; };

View File

@@ -1,6 +1,5 @@
//ww:run-exit 57
package main;
import os;
import fmt;
import io;
import memio;

View File

@@ -1,6 +1,5 @@
//ww:run-exit 53
package main;
import os;
import fmt;
import io;
import memio;

View File

@@ -1,6 +1,5 @@
//ww:run-exit 55
package main;
import os;
import fmt;
import io;
import memio;

View File

@@ -1,6 +1,5 @@
//ww:run-exit 56
package main;
import os;
import fmt;
import io;
import memio;

View File

@@ -1,7 +1,6 @@
//ww:run
// Runtime half of 930_free_noop_run.c free_alloc_roundtrip.
package main;
import rt;
export fn main() i32 = {
let p: *i64 = alloc(11i64)!;
free(p);

View File

@@ -10,4 +10,4 @@ export fn handler(s: str) str = { return s; };
package main;
import beta;
import gamma;
fn main() int = { return beta.usebeta(): int; };
fn main() int = { let _ = gamma.handler(""); return beta.usebeta(): int; };

View File

@@ -1,14 +1,14 @@
//ww:run-exit 42
package main;
package beta;
import gamma;
export type berr = !void;
export fn op() (i32 | berr) = { return 5; };
export fn user() (i32 | berr) = { let v: i32 = op()?; return v + 37; };
export fn user() (i32 | berr) = { let _ = gamma.op(); let v: i32 = op()?; return v + 37; };
package gamma;
export type gerr1 = !void;
export type gerr2 = !u8;
export fn op() (i32 | gerr1 | gerr2) = { return 0; };
package main;
import beta;
import gamma;
fn main() int = { match (beta.user()) { case let n: i32 => return n: int; case berr => return 99; }; };

View File

@@ -1,13 +1,13 @@
//ww:run-exit 42
package main;
package beta;
import gamma;
export type berr = !void;
export fn op() (i32 | berr) = { return 5; };
export fn user() (i32 | berr) = { let v: i32 = op()?; return v + 37; };
export fn user() (i32 | berr) = { let _ = gamma.other(); let v: i32 = op()?; return v + 37; };
package gamma;
export type gerr1 = !void;
export fn other() (i32 | gerr1) = { return 0; };
package main;
import beta;
import gamma;
fn main() int = { match (beta.user()) { case let n: i32 => return n: int; case berr => return 99; }; };

View File

@@ -13,8 +13,9 @@ package collide_test;
// global), so a single-file fixture cannot express it.
//
// barefn (#84/#24a) — a `package main;` root `fn run` coexists with
// imported aa.run: build+run exit 9 on BOTH stages (the user's
// main.run wins, never aa.run=5); the concatenated
// imported aa.run: build+run exit 9 on BOTH stages while an explicit
// `aa.run()` use keeps the source import real; the user's unqualified
// `run()` resolves to main.run, never aa.run=5. The concatenated
// __root.s+aa.s (fixed #93 sep order) carries EXACTLY ONE
// `TEXT main.run,` and EXACTLY ONE `TEXT aa.run,` (distinct symbols,
// no #31-class w6l-tolerated duplicate, no silently-dead bare fn);
@@ -65,7 +66,8 @@ fn runcode(dir: str, name: str, argv: []str) i32 = {
"import bar;\n",
"let slot: i64 = 7;\n",
"let fp: *i64 = &slot;\n",
"export fn main() int = { return (*fp): int; };\n"));
"export fn main() int = { let _ = bar.slot(); ",
"return (*fp): int; };\n"));
let av: []str = [testenv.driver(drvs[i]), "build", "-I", "bar",
"main.ww"];
if (runcode(td, strings.concat("build_", drvs[i]), av) == 0) {
@@ -102,7 +104,10 @@ fn textcount(s: str, sym: str) i32 = {
"package main;\n",
"import aa;\n",
"fn run() i32 = { return 9; };\n",
"export fn main() i32 = { return run(); };\n"));
"export fn main() i32 = {\n",
"\tlet foreign: i32 = aa.run();\n",
"\treturn run() + foreign - foreign;\n",
"};\n"));
let drvs: []str = ["ww", "ww_ww"];
let tags: []str = ["cs", "ww"];
let asms: []str = ["", ""];

View File

@@ -77,7 +77,7 @@ fn row(label: str, nfiles: i32) void = {
};
let mainww: str = strings.concat(td, "/main.ww");
testenv.writefile(mainww,
"package main;\nimport bigmod;\nfn main() void = {};\n");
"package main;\nimport bigmod;\nfn main() i32 = { return bigmod.f000(); };\n");
let drvs: []str = ["ww", "ww_ww"];
let stems: []str = ["X_c", "X_w"];

View File

@@ -12,7 +12,7 @@ package modreset_test;
// rejected against import path "e". The unit is fed STRAIGHT to
// w6c/w6c_ww: the natural empty-module dir route trips the separate
// #11 wwi_emit bug first, and the driver cannot locate the phantom
// package e (which is also why the corpus cannot host it -- the
// directive owner e (which is also why the corpus cannot host it -- the
// blanket data byte-id gate drives every non-error fixture through
// `ww build`).
//
@@ -52,7 +52,6 @@ fn runcode(dir: str, name: str, argv: []str) i32 = {
"//ww:module e\n",
"//ww:module-reset\n",
"package main;\n",
"import e;\n",
"export fn main() i32 = { return 42; };\n"));
let scs: str = strings.concat(td, "/cs.s");
let sww: str = strings.concat(td, "/ww.s");