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:
@@ -305,7 +305,7 @@ pub fn lowerLambda(self: *Lowering, lam: *const ast.Lambda) Ref {
|
||||
// be passed directly. For a capture-free closure whose return type matches
|
||||
// the slot, emit an adapter with the bare ABI. Reject the cases the bare
|
||||
// ABI can't represent: a capturing closure (env has nowhere to live), and
|
||||
// a failable closure into a non-failable slot (foreign code can't observe
|
||||
// a failable closure into a non-failable slot (extern code can't observe
|
||||
// the error channel — ERR E5.1 FFI-boundary rule).
|
||||
if (self.target_type) |tt| {
|
||||
if (!tt.isBuiltin() and self.module.types.get(tt) == .function) {
|
||||
@@ -319,7 +319,7 @@ pub fn lowerLambda(self: *Lowering, lam: *const ast.Lambda) Ref {
|
||||
const adapter = self.createClosureToBareFnAdapter(func_id, self.module.types.get(tt).function, ret_ty, lam.body.span);
|
||||
return self.builder.emit(.{ .func_ref = adapter }, tt);
|
||||
} else if (self.errorChannelOf(ret_ty) != null and self.errorChannelOf(slot_ret) == null) {
|
||||
if (self.diagnostics) |d| d.addFmt(.err, lam.body.span, "failable closure cannot be assigned to a non-failable function-type slot; foreign code can't observe the error channel — handle the error in a wrapper closure that absorbs it", .{});
|
||||
if (self.diagnostics) |d| d.addFmt(.err, lam.body.span, "failable closure cannot be assigned to a non-failable function-type slot; extern code can't observe the error channel — handle the error in a wrapper closure that absorbs it", .{});
|
||||
} else if (self.diagnostics) |d| {
|
||||
d.addFmt(.err, lam.body.span, "closure return type does not match the function-type slot", .{});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user