Files
sx/examples/1228-ffi-extern-c-non-transitive.sx
agra 720556b24e refactor(ffi-linkage): Phase 8 pre-cutover — migrate keyword-neutral diagnostic tests
Migrate the two #foreign-bearing diagnostic tests whose assertions survive the
cutover, with INTENTIONAL snapshot regens (reviewed):
- 1172 (foreign-symbol-conflict): decl '#foreign libc "getenv"' → 'extern libc
  "getenv"'. Still tests the dup-C-symbol conflict; the 'foreign symbol already
  bound' message is the keyword-neutral INTERNAL wording (renamed to 'extern symbol'
  in Phase 9.1), so it persists — only the echoed source line + caret moved.
- 1228 (non-transitive C-import visibility): its identity was the #foreign≡extern
  equivalence lock, now historical (structural via the A→B gate + unified AST). The
  identifier 'c_foreign_abs' itself contained 'foreign' (would fail the Phase 9.4
  gate), so converted c.sx/b.sx/main to two foreign-free extern symbols
  (c_abs_one/c_abs_two); still pins per-symbol non-transitive visibility.

Reverted the orthogonal 0→1-byte empty-stdout normalization on 1228/1231 (known
writeGolden idempotency quirk, not a behavior change). Suite green (647/444).
2026-06-15 07:34:23 +03:00

15 lines
591 B
Plaintext

// `#import` is non-transitive for C-import functions: main imports b,
// b imports c, so main must NOT see c's lib-less `extern` C functions
// directly. Referencing either is rejected by the C-import visibility
// gate (lower/decl.zig `c_import_bare`) with a C-specific "not visible"
// diagnostic — not the generic top-level-name wording. Two distinct
// extern symbols pin that the gate fires per-symbol.
#import "modules/std.sx";
#import "1228-ffi-extern-c-non-transitive/b.sx";
main :: () -> i32 {
print("{}\n", c_abs_one(-3));
print("{}\n", c_abs_two(-4));
return 0;
}