refactor(ffi-linkage): Phase 9.3-src — purge 'foreign' from src/ comments + a user-facing diagnostic

Reword every 'foreign' comment to the extern/runtime-class vocabulary matching the
renamed identifiers (foreign call→extern call, foreign class→runtime class, foreign
path→runtime path, the #foreign-literal comment mentions → extern, etc.). Also fixes
two USER-FACING issues: the 'expected … #foreign … after type annotation' parse error
no longer advertises the removed keyword, and the Android 'no #jni_main' help
diagnostic now shows '#jni_class(…) extern' instead of the rejected '#foreign
#jni_class'. Removed the now-dead prefix-#foreign-vs-postfix conflict branch in
parseRuntimeClassDecl (the caller rejects #foreign before it runs).

src/ now contains 'foreign' ONLY in the hash_foreign token machinery + its 4
rejection messages — the deprecation mechanism (kept per the 9.0 recommendation; the
message MUST name #foreign to guide migration). Snapshot-neutral; suite green
(646 corpus / 444 unit, 0 failed).
This commit is contained in:
agra
2026-06-15 09:35:00 +03:00
parent e99383fcb4
commit dc51c4b5bf
35 changed files with 172 additions and 180 deletions

View File

@@ -355,7 +355,7 @@ test "emit: type conversion toLLVMType" {
// ── A7.1 scaffolding: ABI param coercion ────────────────────────────
// Lock the C-ABI struct-coercion buckets (abiCoerceParamType / needsByval),
// which feed callconv(.c) / #foreign signatures, before they move to
// which feed callconv(.c) / #extern signatures, before they move to
// src/backend/llvm/abi.zig in A7.1 sub-step 2.
const llvm = @import("../llvm_api.zig");
@@ -1103,7 +1103,7 @@ test "emit: ERR E3.0 — no DWARF without a debug context (unit-test default)" {
// JNI Call<Type>Method / non-virtual / constructor). A ref it cannot resolve is
// a codegen invariant violation; it must surface the dedicated `.unresolved`
// tripwire sentinel (which `toLLVMType` hard-panics on) rather than the old
// silent `.void` default that would emit a void-typed foreign-call argument.
// silent `.void` default that would emit a void-typed extern-call argument.
test "emit: argIRTypeOrFail surfaces .unresolved for an unresolvable FFI arg ref (issue 0074)" {
const alloc = std.testing.allocator;
var module = Module.init(alloc);
@@ -1136,7 +1136,7 @@ test "emit: argIRTypeOrFail surfaces .unresolved for an unresolvable FFI arg ref
// Fail-before: the old `getRefIRType(arg) orelse .void` would silently
// yield `.void` here — a real, load-bearing type that downstream ABI
// coercion treats as a legitimate (void-typed) foreign argument.
// coercion treats as a legitimate (void-typed) extern argument.
try std.testing.expectEqual(TypeId.void, emitter.getRefIRType(bogus) orelse TypeId.void);
// Pass-after: the helper returns the dedicated `.unresolved` sentinel,