From 04d9560d51e0cc2e2847587628ae2cb2d20b3aa7 Mon Sep 17 00:00:00 2001 From: Hojun-Cho Date: Fri, 14 Aug 2026 03:45:02 +0900 Subject: [PATCH] test: remove package-wide import assumptions --- Makefile | 9 ++++---- docs/test-system-v2.md | 10 ++++----- lib/encoding/base64/base64_test.ww | 1 - lib/getopt/getopt_test.ww | 1 - lib/strings/utf8_test.ww | 1 - test/package/package_test.ww | 22 ++++++++++++++----- test/sep/sepbuild_test.ww | 10 ++++----- test/sep/sepimport_test.ww | 22 +++++++++---------- test/wcc/data/modfn_coexist/aa/aa.ww | 5 ++--- test/wcc/data/modfn_coexist/main.ww | 15 +++++-------- test/wcc/data/modfn_coexist_vbu/aa/aa.ww | 7 +++--- test/wcc/data/modfn_coexist_vbu/main.ww | 15 +++++-------- test/wcc/data/r699_usepromote_def/case.ww | 11 +++------- .../data/r699_usepromote_def/defmod/defmod.ww | 7 ++++++ test/wcc/data/r699_usepromote_fn/case.ww | 13 +++-------- .../data/r699_usepromote_fn/fnmod/fnmod.ww | 9 ++++++++ test/wcc/data/r699_usepromote_type/case.ww | 13 +++-------- .../r699_usepromote_type/typmod/typmod.ww | 9 ++++++++ test/wcc/data/r699_usepromote_var/case.ww | 11 +++------- .../data/r699_usepromote_var/varmod/varmod.ww | 7 ++++++ test/wcc/data/r700_alloc_free_assert/case.ww | 2 -- test/wcc/data/r700_alloc_slice_cap/case.ww | 1 - test/wcc/data/r700_alloc_slice_prop/case.ww | 1 - test/wcc/data/r700_alloc_slice_rune/case.ww | 1 - test/wcc/data/r700_alloc_slice_str/case.ww | 1 - test/wcc/data/r700_alloc_struct/case.ww | 1 - test/wcc/data/r700_for_range/case.ww | 1 - .../r72_empty_alloc_annotated_i32/case.ww | 1 - .../data/r72_empty_alloc_annotated_u8/case.ww | 1 - .../r74_size_tag_variadic_runearm/case.ww | 1 - .../case.ww | 1 + test/wcc/data/r75_alloc_f64_str_i32/case.ww | 1 - test/wcc/data/r75_alloc_i32_then_str/case.ww | 1 - test/wcc/data/r75_alloc_str_readback/case.ww | 1 - test/wcc/data/r75_alloc_str_singleton/case.ww | 1 - test/wcc/data/r75_alloc_str_then_i32/case.ww | 1 - test/wcc/data/r75_alloc_two_str/case.ww | 1 - .../case.ww | 1 - .../data/r776_borrowedread_view_eof/case.ww | 1 - test/wcc/data/r776_branched_fixed/case.ww | 1 - test/wcc/data/r776_dynamic_write_grow/case.ww | 1 - test/wcc/data/r776_dynamicfrom_alt_rw/case.ww | 1 - test/wcc/data/r776_fixed_read_5/case.ww | 1 - test/wcc/data/r777_fprintf_stream/case.ww | 1 - .../wcc/data/r778_branched_bufio_wrap/case.ww | 1 - .../data/r778_isbuffered_v_boundary/case.ww | 1 - .../r778_isbuffered_v_discriminate/case.ww | 1 - test/wcc/data/r778_scanner_byte_bytes/case.ww | 1 - test/wcc/data/r778_scanner_lines/case.ww | 1 - test/wcc/data/r778_stream_read_unread/case.ww | 1 - test/wcc/data/r778_stream_setflush/case.ww | 1 - test/wcc/data/r778_stream_unread/case.ww | 1 - test/wcc/data/r778_stream_write_flush/case.ww | 1 - test/wcc/data/r779_branched_lprintln/case.ww | 1 - .../data/r779_lprintln_custom_sink/case.ww | 1 - .../data/r779_printfln_default_stderr/case.ww | 1 - .../data/r779_println_default_stderr/case.ww | 1 - .../r784_xmod_alias_struct_collide/case.ww | 1 + .../r784_xmod_alias_struct_symmetric/case.ww | 1 + test/wcc/data/r815_bare_int/case.ww | 1 - test/wcc/data/r815_bare_int_neg/case.ww | 1 - test/wcc/data/r815_bare_uint/case.ww | 1 - test/wcc/data/r815_int_printf/case.ww | 1 - test/wcc/data/r815_mixed/case.ww | 1 - test/wcc/data/r815_uint_highbit/case.ww | 1 - test/wcc/data/r815_unaffected_i64/case.ww | 1 - test/wcc/data/r815_unaffected_str/case.ww | 1 - test/wcc/data/r930_free_alloc/case.ww | 1 - test/wcc/data/r989_ampfncollide_loud/case.ww | 2 +- .../wcc/data/r989_trycallcollide_call/case.ww | 4 ++-- .../data/r989_trycallcollide_control/case.ww | 4 ++-- test/xmod/collide_test.ww | 13 +++++++---- test/xmod/enumcap_test.ww | 2 +- test/xmod/modreset_test.ww | 3 +-- 74 files changed, 121 insertions(+), 154 deletions(-) create mode 100644 test/wcc/data/r699_usepromote_def/defmod/defmod.ww create mode 100644 test/wcc/data/r699_usepromote_fn/fnmod/fnmod.ww create mode 100644 test/wcc/data/r699_usepromote_type/typmod/typmod.ww create mode 100644 test/wcc/data/r699_usepromote_var/varmod/varmod.ww diff --git a/Makefile b/Makefile index 87b56360..fe59689e 100644 --- a/Makefile +++ b/Makefile @@ -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 \ diff --git a/docs/test-system-v2.md b/docs/test-system-v2.md index a8d5b19d..42cf4b8a 100644 --- a/docs/test-system-v2.md +++ b/docs/test-system-v2.md @@ -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/991–995 native gates | diff --git a/lib/encoding/base64/base64_test.ww b/lib/encoding/base64/base64_test.ww index d7095e74..35078e3c 100644 --- a/lib/encoding/base64/base64_test.ww +++ b/lib/encoding/base64/base64_test.ww @@ -13,7 +13,6 @@ import bytes; import errors; import io; import memio; -import strings; import test; diff --git a/lib/getopt/getopt_test.ww b/lib/getopt/getopt_test.ww index 13c4cef1..2e399634 100644 --- a/lib/getopt/getopt_test.ww +++ b/lib/getopt/getopt_test.ww @@ -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; }; diff --git a/lib/strings/utf8_test.ww b/lib/strings/utf8_test.ww index da6845d2..ca173a1f 100644 --- a/lib/strings/utf8_test.ww +++ b/lib/strings/utf8_test.ww @@ -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. diff --git a/test/package/package_test.ww b/test/package/package_test.ww index 015f0dc6..caeca83d 100644 --- a/test/package/package_test.ww +++ b/test/package/package_test.ww @@ -2470,11 +2470,22 @@ fn hexbytes(value: str) str = { let roota: str = "package main;\n// ROOT_A\n"; i = 0; for (i < packagecount) { - roota = strings.concat(roota, "import ", boundarypkgname(i), ";\n"); + 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); diff --git a/test/sep/sepbuild_test.ww b/test/sep/sepbuild_test.ww index d46c2139..1b852b30 100644 --- a/test/sep/sepbuild_test.ww +++ b/test/sep/sepbuild_test.ww @@ -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/", diff --git a/test/sep/sepimport_test.ww b/test/sep/sepimport_test.ww index d49c00c3..a436d286 100644 --- a/test/sep/sepimport_test.ww +++ b/test/sep/sepimport_test.ww @@ -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); diff --git a/test/wcc/data/modfn_coexist/aa/aa.ww b/test/wcc/data/modfn_coexist/aa/aa.ww index fedf3da5..24358b88 100644 --- a/test/wcc/data/modfn_coexist/aa/aa.ww +++ b/test/wcc/data/modfn_coexist/aa/aa.ww @@ -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; }; diff --git a/test/wcc/data/modfn_coexist/main.ww b/test/wcc/data/modfn_coexist/main.ww index 22e939f5..b86b65ce 100644 --- a/test/wcc/data/modfn_coexist/main.ww +++ b/test/wcc/data/modfn_coexist/main.ww @@ -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(); }; diff --git a/test/wcc/data/modfn_coexist_vbu/aa/aa.ww b/test/wcc/data/modfn_coexist_vbu/aa/aa.ww index 61486cbe..213237f8 100644 --- a/test/wcc/data/modfn_coexist_vbu/aa/aa.ww +++ b/test/wcc/data/modfn_coexist_vbu/aa/aa.ww @@ -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; }; diff --git a/test/wcc/data/modfn_coexist_vbu/main.ww b/test/wcc/data/modfn_coexist_vbu/main.ww index f62990d6..97b092aa 100644 --- a/test/wcc/data/modfn_coexist_vbu/main.ww +++ b/test/wcc/data/modfn_coexist_vbu/main.ww @@ -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(); }; diff --git a/test/wcc/data/r699_usepromote_def/case.ww b/test/wcc/data/r699_usepromote_def/case.ww index 0962a4e2..57f7efa0 100644 --- a/test/wcc/data/r699_usepromote_def/case.ww +++ b/test/wcc/data/r699_usepromote_def/case.ww @@ -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; diff --git a/test/wcc/data/r699_usepromote_def/defmod/defmod.ww b/test/wcc/data/r699_usepromote_def/defmod/defmod.ww new file mode 100644 index 00000000..6ebb2e00 --- /dev/null +++ b/test/wcc/data/r699_usepromote_def/defmod/defmod.ww @@ -0,0 +1,7 @@ +package defmod; + +export def defmod: i32 = 0i32; +export type flag = enum i32 { + NONE = 0, + A = 42, +}; diff --git a/test/wcc/data/r699_usepromote_fn/case.ww b/test/wcc/data/r699_usepromote_fn/case.ww index c74ee78d..6a309086 100644 --- a/test/wcc/data/r699_usepromote_fn/case.ww +++ b/test/wcc/data/r699_usepromote_fn/case.ww @@ -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; diff --git a/test/wcc/data/r699_usepromote_fn/fnmod/fnmod.ww b/test/wcc/data/r699_usepromote_fn/fnmod/fnmod.ww new file mode 100644 index 00000000..771a5ed3 --- /dev/null +++ b/test/wcc/data/r699_usepromote_fn/fnmod/fnmod.ww @@ -0,0 +1,9 @@ +package fnmod; + +export type flag = enum i32 { + NONE = 0, + A = 42, +}; +export fn fnmod() i32 = { + return 0i32; +}; diff --git a/test/wcc/data/r699_usepromote_type/case.ww b/test/wcc/data/r699_usepromote_type/case.ww index d0ce6705..ea8dcf54 100644 --- a/test/wcc/data/r699_usepromote_type/case.ww +++ b/test/wcc/data/r699_usepromote_type/case.ww @@ -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; diff --git a/test/wcc/data/r699_usepromote_type/typmod/typmod.ww b/test/wcc/data/r699_usepromote_type/typmod/typmod.ww new file mode 100644 index 00000000..1b0fbe93 --- /dev/null +++ b/test/wcc/data/r699_usepromote_type/typmod/typmod.ww @@ -0,0 +1,9 @@ +package typmod; + +export type typmod = struct { + x: i32, +}; +export type flag = enum i32 { + NONE = 0, + A = 42, +}; diff --git a/test/wcc/data/r699_usepromote_var/case.ww b/test/wcc/data/r699_usepromote_var/case.ww index 07bbd4db..07508f4f 100644 --- a/test/wcc/data/r699_usepromote_var/case.ww +++ b/test/wcc/data/r699_usepromote_var/case.ww @@ -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; diff --git a/test/wcc/data/r699_usepromote_var/varmod/varmod.ww b/test/wcc/data/r699_usepromote_var/varmod/varmod.ww new file mode 100644 index 00000000..c54d9219 --- /dev/null +++ b/test/wcc/data/r699_usepromote_var/varmod/varmod.ww @@ -0,0 +1,7 @@ +package varmod; + +export let varmod: i32 = 0i32; +export type flag = enum i32 { + NONE = 0, + A = 42, +}; diff --git a/test/wcc/data/r700_alloc_free_assert/case.ww b/test/wcc/data/r700_alloc_free_assert/case.ww index fe539156..1a9c29ab 100644 --- a/test/wcc/data/r700_alloc_free_assert/case.ww +++ b/test/wcc/data/r700_alloc_free_assert/case.ww @@ -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 })!; diff --git a/test/wcc/data/r700_alloc_slice_cap/case.ww b/test/wcc/data/r700_alloc_slice_cap/case.ww index d1125086..da858edd 100644 --- a/test/wcc/data/r700_alloc_slice_cap/case.ww +++ b/test/wcc/data/r700_alloc_slice_cap/case.ww @@ -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); diff --git a/test/wcc/data/r700_alloc_slice_prop/case.ww b/test/wcc/data/r700_alloc_slice_prop/case.ww index f1f7966f..ab01f42e 100644 --- a/test/wcc/data/r700_alloc_slice_prop/case.ww +++ b/test/wcc/data/r700_alloc_slice_prop/case.ww @@ -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; diff --git a/test/wcc/data/r700_alloc_slice_rune/case.ww b/test/wcc/data/r700_alloc_slice_rune/case.ww index 3671f9af..d197c430 100644 --- a/test/wcc/data/r700_alloc_slice_rune/case.ww +++ b/test/wcc/data/r700_alloc_slice_rune/case.ww @@ -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; diff --git a/test/wcc/data/r700_alloc_slice_str/case.ww b/test/wcc/data/r700_alloc_slice_str/case.ww index 62696b7f..11d45f92 100644 --- a/test/wcc/data/r700_alloc_slice_str/case.ww +++ b/test/wcc/data/r700_alloc_slice_str/case.ww @@ -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; diff --git a/test/wcc/data/r700_alloc_struct/case.ww b/test/wcc/data/r700_alloc_struct/case.ww index a0dfa1ab..2e1c22bc 100644 --- a/test/wcc/data/r700_alloc_struct/case.ww +++ b/test/wcc/data/r700_alloc_struct/case.ww @@ -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 })!; diff --git a/test/wcc/data/r700_for_range/case.ww b/test/wcc/data/r700_for_range/case.ww index 2ccdb3c8..0804235b 100644 --- a/test/wcc/data/r700_for_range/case.ww +++ b/test/wcc/data/r700_for_range/case.ww @@ -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; diff --git a/test/wcc/data/r72_empty_alloc_annotated_i32/case.ww b/test/wcc/data/r72_empty_alloc_annotated_i32/case.ww index 60091f0d..f2ffb56c 100644 --- a/test/wcc/data/r72_empty_alloc_annotated_i32/case.ww +++ b/test/wcc/data/r72_empty_alloc_annotated_i32/case.ww @@ -1,6 +1,5 @@ //ww:run-exit 5 package main; -import rt; fn main() i32 = { let w: []i32 = alloc([], 4u64)!; w[2] = 5i32; diff --git a/test/wcc/data/r72_empty_alloc_annotated_u8/case.ww b/test/wcc/data/r72_empty_alloc_annotated_u8/case.ww index d412fdc8..8cc6093e 100644 --- a/test/wcc/data/r72_empty_alloc_annotated_u8/case.ww +++ b/test/wcc/data/r72_empty_alloc_annotated_u8/case.ww @@ -1,6 +1,5 @@ //ww:run-exit 16 package main; -import rt; fn main() i32 = { let b: []u8 = alloc([], 8u64)!; b[0] = 7u8; diff --git a/test/wcc/data/r74_size_tag_variadic_runearm/case.ww b/test/wcc/data/r74_size_tag_variadic_runearm/case.ww index 61d97edb..3fccc83f 100644 --- a/test/wcc/data/r74_size_tag_variadic_runearm/case.ww +++ b/test/wcc/data/r74_size_tag_variadic_runearm/case.ww @@ -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; diff --git a/test/wcc/data/r752_modparam_xmod_variadic_vs_scalar/case.ww b/test/wcc/data/r752_modparam_xmod_variadic_vs_scalar/case.ww index 77d5c2cc..cc618098 100644 --- a/test/wcc/data/r752_modparam_xmod_variadic_vs_scalar/case.ww +++ b/test/wcc/data/r752_modparam_xmod_variadic_vs_scalar/case.ww @@ -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; }; diff --git a/test/wcc/data/r75_alloc_f64_str_i32/case.ww b/test/wcc/data/r75_alloc_f64_str_i32/case.ww index 4e665327..7e3ec8ff 100644 --- a/test/wcc/data/r75_alloc_f64_str_i32/case.ww +++ b/test/wcc/data/r75_alloc_f64_str_i32/case.ww @@ -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; }; diff --git a/test/wcc/data/r75_alloc_i32_then_str/case.ww b/test/wcc/data/r75_alloc_i32_then_str/case.ww index 1cbb1dac..bccf1544 100644 --- a/test/wcc/data/r75_alloc_i32_then_str/case.ww +++ b/test/wcc/data/r75_alloc_i32_then_str/case.ww @@ -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; }; diff --git a/test/wcc/data/r75_alloc_str_readback/case.ww b/test/wcc/data/r75_alloc_str_readback/case.ww index 775513e0..346caa38 100644 --- a/test/wcc/data/r75_alloc_str_readback/case.ww +++ b/test/wcc/data/r75_alloc_str_readback/case.ww @@ -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; }; diff --git a/test/wcc/data/r75_alloc_str_singleton/case.ww b/test/wcc/data/r75_alloc_str_singleton/case.ww index 0835bd6e..456dd803 100644 --- a/test/wcc/data/r75_alloc_str_singleton/case.ww +++ b/test/wcc/data/r75_alloc_str_singleton/case.ww @@ -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; }; diff --git a/test/wcc/data/r75_alloc_str_then_i32/case.ww b/test/wcc/data/r75_alloc_str_then_i32/case.ww index 7c7bbcdf..a95b4a08 100644 --- a/test/wcc/data/r75_alloc_str_then_i32/case.ww +++ b/test/wcc/data/r75_alloc_str_then_i32/case.ww @@ -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; }; diff --git a/test/wcc/data/r75_alloc_two_str/case.ww b/test/wcc/data/r75_alloc_two_str/case.ww index d217f0f9..8ac19b7c 100644 --- a/test/wcc/data/r75_alloc_two_str/case.ww +++ b/test/wcc/data/r75_alloc_two_str/case.ww @@ -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; }; diff --git a/test/wcc/data/r776_accessors_string_buffer_reset/case.ww b/test/wcc/data/r776_accessors_string_buffer_reset/case.ww index beadcec8..65ebf959 100644 --- a/test/wcc/data/r776_accessors_string_buffer_reset/case.ww +++ b/test/wcc/data/r776_accessors_string_buffer_reset/case.ww @@ -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]); diff --git a/test/wcc/data/r776_borrowedread_view_eof/case.ww b/test/wcc/data/r776_borrowedread_view_eof/case.ww index 3e4ac290..67a5731a 100644 --- a/test/wcc/data/r776_borrowedread_view_eof/case.ww +++ b/test/wcc/data/r776_borrowedread_view_eof/case.ww @@ -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; diff --git a/test/wcc/data/r776_branched_fixed/case.ww b/test/wcc/data/r776_branched_fixed/case.ww index 5f665c65..1af31718 100644 --- a/test/wcc/data/r776_branched_fixed/case.ww +++ b/test/wcc/data/r776_branched_fixed/case.ww @@ -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; diff --git a/test/wcc/data/r776_dynamic_write_grow/case.ww b/test/wcc/data/r776_dynamic_write_grow/case.ww index 2dbf8fa4..df513cc3 100644 --- a/test/wcc/data/r776_dynamic_write_grow/case.ww +++ b/test/wcc/data/r776_dynamic_write_grow/case.ww @@ -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; diff --git a/test/wcc/data/r776_dynamicfrom_alt_rw/case.ww b/test/wcc/data/r776_dynamicfrom_alt_rw/case.ww index 67cf6f0a..d87c7413 100644 --- a/test/wcc/data/r776_dynamicfrom_alt_rw/case.ww +++ b/test/wcc/data/r776_dynamicfrom_alt_rw/case.ww @@ -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; diff --git a/test/wcc/data/r776_fixed_read_5/case.ww b/test/wcc/data/r776_fixed_read_5/case.ww index 09fb1828..2ee03e31 100644 --- a/test/wcc/data/r776_fixed_read_5/case.ww +++ b/test/wcc/data/r776_fixed_read_5/case.ww @@ -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; diff --git a/test/wcc/data/r777_fprintf_stream/case.ww b/test/wcc/data/r777_fprintf_stream/case.ww index ea915e51..c62d0442 100644 --- a/test/wcc/data/r777_fprintf_stream/case.ww +++ b/test/wcc/data/r777_fprintf_stream/case.ww @@ -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; diff --git a/test/wcc/data/r778_branched_bufio_wrap/case.ww b/test/wcc/data/r778_branched_bufio_wrap/case.ww index 85df4f4b..230c6345 100644 --- a/test/wcc/data/r778_branched_bufio_wrap/case.ww +++ b/test/wcc/data/r778_branched_bufio_wrap/case.ww @@ -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; diff --git a/test/wcc/data/r778_isbuffered_v_boundary/case.ww b/test/wcc/data/r778_isbuffered_v_boundary/case.ww index 7b87d747..e91bbc51 100644 --- a/test/wcc/data/r778_isbuffered_v_boundary/case.ww +++ b/test/wcc/data/r778_isbuffered_v_boundary/case.ww @@ -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; diff --git a/test/wcc/data/r778_isbuffered_v_discriminate/case.ww b/test/wcc/data/r778_isbuffered_v_discriminate/case.ww index 26312e7e..1ac45ae9 100644 --- a/test/wcc/data/r778_isbuffered_v_discriminate/case.ww +++ b/test/wcc/data/r778_isbuffered_v_discriminate/case.ww @@ -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; diff --git a/test/wcc/data/r778_scanner_byte_bytes/case.ww b/test/wcc/data/r778_scanner_byte_bytes/case.ww index 13be133a..b84fe7e1 100644 --- a/test/wcc/data/r778_scanner_byte_bytes/case.ww +++ b/test/wcc/data/r778_scanner_byte_bytes/case.ww @@ -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; diff --git a/test/wcc/data/r778_scanner_lines/case.ww b/test/wcc/data/r778_scanner_lines/case.ww index 26fce831..98bd2875 100644 --- a/test/wcc/data/r778_scanner_lines/case.ww +++ b/test/wcc/data/r778_scanner_lines/case.ww @@ -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; diff --git a/test/wcc/data/r778_stream_read_unread/case.ww b/test/wcc/data/r778_stream_read_unread/case.ww index 7773ae3f..75e83c67 100644 --- a/test/wcc/data/r778_stream_read_unread/case.ww +++ b/test/wcc/data/r778_stream_read_unread/case.ww @@ -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; diff --git a/test/wcc/data/r778_stream_setflush/case.ww b/test/wcc/data/r778_stream_setflush/case.ww index dbfb4b80..9d99ecda 100644 --- a/test/wcc/data/r778_stream_setflush/case.ww +++ b/test/wcc/data/r778_stream_setflush/case.ww @@ -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; diff --git a/test/wcc/data/r778_stream_unread/case.ww b/test/wcc/data/r778_stream_unread/case.ww index 1534e445..bbc9d043 100644 --- a/test/wcc/data/r778_stream_unread/case.ww +++ b/test/wcc/data/r778_stream_unread/case.ww @@ -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; diff --git a/test/wcc/data/r778_stream_write_flush/case.ww b/test/wcc/data/r778_stream_write_flush/case.ww index 6b963cac..2e34612e 100644 --- a/test/wcc/data/r778_stream_write_flush/case.ww +++ b/test/wcc/data/r778_stream_write_flush/case.ww @@ -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; diff --git a/test/wcc/data/r779_branched_lprintln/case.ww b/test/wcc/data/r779_branched_lprintln/case.ww index fcca4ec7..cd217fc0 100644 --- a/test/wcc/data/r779_branched_lprintln/case.ww +++ b/test/wcc/data/r779_branched_lprintln/case.ww @@ -1,6 +1,5 @@ //ww:run-exit 45 package main; -import os; import log; import memio; import io; diff --git a/test/wcc/data/r779_lprintln_custom_sink/case.ww b/test/wcc/data/r779_lprintln_custom_sink/case.ww index 26c8b473..61c6d317 100644 --- a/test/wcc/data/r779_lprintln_custom_sink/case.ww +++ b/test/wcc/data/r779_lprintln_custom_sink/case.ww @@ -1,6 +1,5 @@ //ww:run-exit 44 package main; -import os; import log; import memio; import io; diff --git a/test/wcc/data/r779_printfln_default_stderr/case.ww b/test/wcc/data/r779_printfln_default_stderr/case.ww index 7255a026..96d2833f 100644 --- a/test/wcc/data/r779_printfln_default_stderr/case.ww +++ b/test/wcc/data/r779_printfln_default_stderr/case.ww @@ -1,6 +1,5 @@ //ww:run-exit 43 package main; -import os; import log; export fn main() i32 = { log.printfln("v={}", 7i64); diff --git a/test/wcc/data/r779_println_default_stderr/case.ww b/test/wcc/data/r779_println_default_stderr/case.ww index a6077643..4385fa25 100644 --- a/test/wcc/data/r779_println_default_stderr/case.ww +++ b/test/wcc/data/r779_println_default_stderr/case.ww @@ -1,6 +1,5 @@ //ww:run-exit 42 package main; -import os; import log; export fn main() i32 = { log.println("hello"); diff --git a/test/wcc/data/r784_xmod_alias_struct_collide/case.ww b/test/wcc/data/r784_xmod_alias_struct_collide/case.ww index 7066a573..360cc57b 100644 --- a/test/wcc/data/r784_xmod_alias_struct_collide/case.ww +++ b/test/wcc/data/r784_xmod_alias_struct_collide/case.ww @@ -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); diff --git a/test/wcc/data/r784_xmod_alias_struct_symmetric/case.ww b/test/wcc/data/r784_xmod_alias_struct_symmetric/case.ww index fec778db..24e2c790 100644 --- a/test/wcc/data/r784_xmod_alias_struct_symmetric/case.ww +++ b/test/wcc/data/r784_xmod_alias_struct_symmetric/case.ww @@ -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; }; diff --git a/test/wcc/data/r815_bare_int/case.ww b/test/wcc/data/r815_bare_int/case.ww index 5ef4885a..a98edbf6 100644 --- a/test/wcc/data/r815_bare_int/case.ww +++ b/test/wcc/data/r815_bare_int/case.ww @@ -1,6 +1,5 @@ //ww:run-exit 50 package main; -import os; import fmt; import io; import memio; diff --git a/test/wcc/data/r815_bare_int_neg/case.ww b/test/wcc/data/r815_bare_int_neg/case.ww index 6969d5c0..10b826cd 100644 --- a/test/wcc/data/r815_bare_int_neg/case.ww +++ b/test/wcc/data/r815_bare_int_neg/case.ww @@ -1,6 +1,5 @@ //ww:run-exit 51 package main; -import os; import fmt; import io; import memio; diff --git a/test/wcc/data/r815_bare_uint/case.ww b/test/wcc/data/r815_bare_uint/case.ww index ccedab95..cac0f85b 100644 --- a/test/wcc/data/r815_bare_uint/case.ww +++ b/test/wcc/data/r815_bare_uint/case.ww @@ -1,6 +1,5 @@ //ww:run-exit 52 package main; -import os; import fmt; import io; import memio; diff --git a/test/wcc/data/r815_int_printf/case.ww b/test/wcc/data/r815_int_printf/case.ww index e664e963..b3013bce 100644 --- a/test/wcc/data/r815_int_printf/case.ww +++ b/test/wcc/data/r815_int_printf/case.ww @@ -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; }; diff --git a/test/wcc/data/r815_mixed/case.ww b/test/wcc/data/r815_mixed/case.ww index 17043160..a6ed0a7b 100644 --- a/test/wcc/data/r815_mixed/case.ww +++ b/test/wcc/data/r815_mixed/case.ww @@ -1,6 +1,5 @@ //ww:run-exit 57 package main; -import os; import fmt; import io; import memio; diff --git a/test/wcc/data/r815_uint_highbit/case.ww b/test/wcc/data/r815_uint_highbit/case.ww index e3f32838..4c38c3c7 100644 --- a/test/wcc/data/r815_uint_highbit/case.ww +++ b/test/wcc/data/r815_uint_highbit/case.ww @@ -1,6 +1,5 @@ //ww:run-exit 53 package main; -import os; import fmt; import io; import memio; diff --git a/test/wcc/data/r815_unaffected_i64/case.ww b/test/wcc/data/r815_unaffected_i64/case.ww index 8d401e8b..6a7edf27 100644 --- a/test/wcc/data/r815_unaffected_i64/case.ww +++ b/test/wcc/data/r815_unaffected_i64/case.ww @@ -1,6 +1,5 @@ //ww:run-exit 55 package main; -import os; import fmt; import io; import memio; diff --git a/test/wcc/data/r815_unaffected_str/case.ww b/test/wcc/data/r815_unaffected_str/case.ww index 706cf848..23ab4960 100644 --- a/test/wcc/data/r815_unaffected_str/case.ww +++ b/test/wcc/data/r815_unaffected_str/case.ww @@ -1,6 +1,5 @@ //ww:run-exit 56 package main; -import os; import fmt; import io; import memio; diff --git a/test/wcc/data/r930_free_alloc/case.ww b/test/wcc/data/r930_free_alloc/case.ww index 294f5257..5b28ced0 100644 --- a/test/wcc/data/r930_free_alloc/case.ww +++ b/test/wcc/data/r930_free_alloc/case.ww @@ -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); diff --git a/test/wcc/data/r989_ampfncollide_loud/case.ww b/test/wcc/data/r989_ampfncollide_loud/case.ww index fe97db0b..6369b797 100644 --- a/test/wcc/data/r989_ampfncollide_loud/case.ww +++ b/test/wcc/data/r989_ampfncollide_loud/case.ww @@ -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; }; diff --git a/test/wcc/data/r989_trycallcollide_call/case.ww b/test/wcc/data/r989_trycallcollide_call/case.ww index 79e8f363..6cca5810 100644 --- a/test/wcc/data/r989_trycallcollide_call/case.ww +++ b/test/wcc/data/r989_trycallcollide_call/case.ww @@ -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; }; }; diff --git a/test/wcc/data/r989_trycallcollide_control/case.ww b/test/wcc/data/r989_trycallcollide_control/case.ww index 6e65537e..022976d6 100644 --- a/test/wcc/data/r989_trycallcollide_control/case.ww +++ b/test/wcc/data/r989_trycallcollide_control/case.ww @@ -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; }; }; diff --git a/test/xmod/collide_test.ww b/test/xmod/collide_test.ww index cf6b8b14..536205f9 100644 --- a/test/xmod/collide_test.ww +++ b/test/xmod/collide_test.ww @@ -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 = ["", ""]; diff --git a/test/xmod/enumcap_test.ww b/test/xmod/enumcap_test.ww index 512cf96c..80801485 100644 --- a/test/xmod/enumcap_test.ww +++ b/test/xmod/enumcap_test.ww @@ -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"]; diff --git a/test/xmod/modreset_test.ww b/test/xmod/modreset_test.ww index a8a5b5b0..11128a41 100644 --- a/test/xmod/modreset_test.ww +++ b/test/xmod/modreset_test.ww @@ -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");