docs(ffi-linkage): checkpoint — Phase 3.0 xfail logged

This commit is contained in:
agra
2026-06-14 15:01:19 +03:00
parent 0bde545f24
commit 9f1d7be105

View File

@@ -5,7 +5,14 @@ Companion to `current/PLAN-EXTERN-EXPORT.md` — one merged plan: **Part A** add
every commit, one step at a time per the cadence rule. every commit, one step at a time per the cadence rule.
## Last completed step ## Last completed step
**Phase 2.2** (green) — **PHASE 2 COMPLETE.** `export` (define + expose) fully works: **Phase 3.0** (xfail) — `examples/1348-ffi-objc-extern-class.sx` exercises the new
postfix-`extern` aggregate spelling (`NSObject :: #objc_class("NSObject") extern { … }`,
the new way to write `#foreign #objc_class("NSObject") { … }`). RED: parser rejects
`extern` after the `#objc_class(...)` directive (`expected '{'`). Green-state snapshots
hand-authored (exit 0, stdout `extern-class dispatch ok`). Suite: 639 corpus / 443 unit,
**1 fail (1348, the intended xfail)**. Step 3.1 wires parse+lowering to green it.
### Prior: Phase 2.2 (green) — **PHASE 2 COMPLETE.** `export` (define + expose) fully works:
external linkage + C ABI + no sx ctx + force-lowered root + optional `"csym"` rename. external linkage + C ABI + no sx ctx + force-lowered root + optional `"csym"` rename.
All four export-gap conditions filled in `decl.zig`: (i) `.external` linkage for All four export-gap conditions filled in `decl.zig`: (i) `.external` linkage for
`extern_export == .export_` on both define paths (`lowerFunctionBodyInto`, `extern_export == .export_` on both define paths (`lowerFunctionBodyInto`,
@@ -40,11 +47,13 @@ gate). Examples: 1223 (extern bare fn), 1224 (extern fn rename), 1225 (extern ba
global), 1226 (export bare fn, AOT), 1227 (export fn rename, AOT). global), 1226 (export bare fn, AOT), 1227 (export fn rename, AOT).
## Next step ## Next step
**Phase 3 — aggregates** (objc / jni runtime classes): `#objc_class("X") extern { … }` **Phase 3.1** (green) — wire the postfix `extern`/`export` aggregate path. `parseForeignClassDecl`
(import) + `… export { … }` (define) parse alongside legacy `#foreign #objc_class` already consumes the directive + `("X")` + body; add an optional postfix-modifier slot
(`parser.zig` `tryParseForeignClassPrefix`/`parseForeignClassDecl`); map postfix **after** the `)` and before the `{`: `extern`→reference (== `is_foreign`), `export`
`extern`→reference, `export`define+register (`objc_class.zig`); per-runtime tests define+register (== no `#foreign`). Map the postfix modifier onto the same downstream
(objc, jni). Then Phase 4 (interplay/diagnostics/docs + the A→B gate: unit test that `is_foreign` decision that `tryParseForeignClassPrefix` feeds, so `objc_class.zig` lowering
is unchanged. Green 1348; add a jni postfix test + an `export` (defined-class) test for the
per-runtime coverage. Then Phase 4 (interplay/diagnostics/docs + the A→B gate: unit test that
`#foreign` and `extern`/`export` lower to identical IR) before Part B migration. `#foreign` and `extern`/`export` lower to identical IR) before Part B migration.
**FUTURE MILESTONE — C→sx-by-name in JIT (`sx run`).** Investigated this session **FUTURE MILESTONE — C→sx-by-name in JIT (`sx run`).** Investigated this session
@@ -131,6 +140,9 @@ historical carve-out — keep `issues/*.md` provenance, gate the live tree only.
the body promotes into the C-named function (`define @triple_c`). sx-side call sites the body promotes into the C-named function (`define @triple_c`). sx-side call sites
resolve via the same map (probe: 5*5→25). 1227 green (22); 1226 unregressed. Suite resolve via the same map (probe: 5*5→25). 1227 green (22); 1226 unregressed. Suite
green (638/443). `green` commit. **PHASE 2 COMPLETE**`export` fully works. green (638/443). `green` commit. **PHASE 2 COMPLETE**`export` fully works.
- (3.0) Added `examples/1348-ffi-objc-extern-class.sx` (postfix `extern` on `#objc_class`,
new spelling of `#foreign #objc_class`). RED (parser: `expected '{'` after the
directive). Hand-authored green snapshots. `xfail` commit; 3.1 greens it.
## Known issues ## Known issues
- **Workflow hazard (1.2):** an editor format-on-save (or `zig fmt`) clobbered the - **Workflow hazard (1.2):** an editor format-on-save (or `zig fmt`) clobbered the