refactor(ffi-linkage): Phase 9.1b — rename 'foreign symbol' diagnostic + panic to 'extern'

The dup-C-symbol diagnostic (decl.zig) and the resolveFuncByName panic (call.zig)
now say 'extern symbol' instead of 'foreign symbol' — the keyword-neutral internal
wording catches up to the extern-only surface. Intentional snapshot regen of 1172
(the only assertion of this message). Suite green (646/444).
This commit is contained in:
agra
2026-06-15 08:42:59 +03:00
parent b838f6383f
commit b78e7ddeb1
3 changed files with 3 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
error: foreign symbol 'getenv' is already bound with a different signature; two views of one C symbol must declare identical types error: extern symbol 'getenv' is already bound with a different signature; two views of one C symbol must declare identical types
--> examples/1172-diagnostics-foreign-symbol-conflict.sx:9:61 --> examples/1172-diagnostics-foreign-symbol-conflict.sx:9:61
| |
9 | getenv_opt :: (name: [:0]u8) -> ?[:0]u8 extern libc "getenv"; 9 | getenv_opt :: (name: [:0]u8) -> ?[:0]u8 extern libc "getenv";

View File

@@ -1256,7 +1256,7 @@ pub fn allocViaContext(self: *Lowering, size_ref: Ref, void_ptr_ty: TypeId) Ref
/// heap path and the closure env-copy path, both of which need /// heap path and the closure env-copy path, both of which need
/// libc `memcpy` after the `#builtin` form was dropped. /// libc `memcpy` after the `#builtin` form was dropped.
pub fn callExtern(self: *Lowering, name: []const u8, args: []const Ref, ret_ty: TypeId) Ref { pub fn callExtern(self: *Lowering, name: []const u8, args: []const Ref, ret_ty: TypeId) Ref {
const fid = self.resolveFuncByName(name) orelse @panic("foreign symbol missing — std.sx not imported?"); const fid = self.resolveFuncByName(name) orelse @panic("extern symbol missing — std.sx not imported?");
return self.builder.call(fid, args, ret_ty); return self.builder.call(fid, args, ret_ty);
} }

View File

@@ -2052,7 +2052,7 @@ pub fn dedupeExternSymbol(self: *Lowering, fd: *const ast.FnDecl, sym_name: Stri
return true; return true;
} }
if (self.diagnostics) |d| { if (self.diagnostics) |d| {
d.addFmt(.err, fd.body.span, "foreign symbol '{s}' is already bound with a different signature; two views of one C symbol must declare identical types", .{self.module.types.getString(sym_name)}); d.addFmt(.err, fd.body.span, "extern symbol '{s}' is already bound with a different signature; two views of one C symbol must declare identical types", .{self.module.types.getString(sym_name)});
} }
return true; return true;
} }