wcc/ww: tag sep-built dotted-path packages by full path not leaf (#57)

A separately-compiled package's primary body was emitted under a bare
`//ww:module-reset`, so its own `package <leaf>;` clause set curmod to
the leaf (e.g. utf8) while the importer spliced the .wwi under the full
`//ww:module encoding.utf8` — definer mangled `utf8.X`, importer wanted
`encoding.utf8.X`, unresolved. Thread the dotted path through the
directive: `//ww:module-reset <path>` sets curmod to the dotted path
(imported stays 0, so the root `fn main` stays bare per #32), and the
body's package clause is demoted to a leaf==last-component assertion
instead of overwriting curmod. Aligns sep-build to the M1 path-mangle
model; only the SEP emitter changes (the combined build_one arm is
untouched, so all combined byte-id gates hold). Both stages mirrored.

Commit-6 broad-soak prerequisite. Gate 989_sepdotpath_run sep-builds a
2-level dotted package and proves definer==importer qualification +
single-component non-vacuity, cs==ww.
This commit is contained in:
2026-06-16 16:36:03 +09:00
parent 7b36f961a9
commit 747475174a
12 changed files with 639 additions and 58 deletions

View File

@@ -564,6 +564,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
$(BIN)/test_m2wwi_run \
$(BIN)/test_m3sep_run \
$(BIN)/test_sepbuild_run \
$(BIN)/test_sepdotpath_run \
$(BIN)/test_sepcycle_dup \
$(BIN)/test_separchive_run \
$(BIN)/test_pkgcache_run \
@@ -3110,6 +3111,17 @@ $(BIN)/test_sepbuild_run: test/wcc/989_sepbuild_run.c $(BIN)/ww $(BIN)/ww_ww \
$(BIN)/w6l $(BIN)/w6l_ww $(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# 989_sepdotpath_run — sep-build of a DOTTED-path (multi-component) package
# (#57): the producer must tag a primary body by its full dotted import path
# (`//ww:module-reset a.b`), not the leaf `package` clause, so definer ==
# importer. Drives BOTH driver stages (synthetic a.b + c graph) and re-greps
# the producer .s, so it needs both driver + both compiler + both linker
# stages + libwwrt for the link.
$(BIN)/test_sepdotpath_run: test/wcc/989_sepdotpath_run.c $(BIN)/ww $(BIN)/ww_ww \
$(BIN)/w6c $(BIN)/w6c_ww $(BIN)/w6a $(BIN)/w6a_ww \
$(BIN)/w6l $(BIN)/w6l_ww $(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# 989_sepcycle_dup — M3-tail commit-4 negative gates (#46, #31): a loud
# dep-cycle reject (both driver stages, cs==ww stderr) + the #31
# duplicate-symbol reject (both linker stages). Needs both driver stages,