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

@@ -92,13 +92,13 @@ pub const CallPlan = struct {
/// `Lowering.inferExprType`'s call arm. Discovers the IR type a call
/// expression evaluates to — across builtins / reflection builtins, generic
/// and plain free functions (lowered or lazy via `fn_ast_map`), closure /
/// function-typed locals, protocol dispatch, foreign-class instance/static
/// function-typed locals, protocol dispatch, runtime-class instance/static
/// methods, struct (UFCS) methods, qualified namespace calls, and
/// enum/tagged-union construction.
///
/// A `*Lowering` facade (Principle 5, like `ExprTyper` / `PackResolver`): call
/// typing reads live lexical-scope / target-type state and the function /
/// foreign-class / protocol resolver helpers, so it borrows `*Lowering` rather
/// runtime-class / protocol resolver helpers, so it borrows `*Lowering` rather
/// than re-threading every field.
pub const CallResolver = struct {
l: *Lowering,
@@ -159,7 +159,7 @@ pub const CallResolver = struct {
// Plain bare same-name flat collision (R5 §C): route through the ONE
// author producer `selectedFreeAuthor` so `plan` types the call as the
// SAME author the lowering call-path binds — they can no longer
// disagree. A generic / foreign / builtin author is not
// disagree. A generic / extern / builtin author is not
// plain-free so the producer returns `.none`; `.ambiguous` / `.none`
// fall through to the first-wins path below, byte-for-byte.
switch (self.selectedFreeAuthor(c)) {
@@ -386,7 +386,7 @@ pub const CallResolver = struct {
};
}
}
// Type.variant(args) — qualified construction; foreign static; or a
// Type.variant(args) — qualified construction; runtime static; or a
// qualified namespace function. Reached for namespace / type
// prefixes (and inert for value receivers handled above).
const type_name = switch (cfa.object.data) {
@@ -506,7 +506,7 @@ pub const CallResolver = struct {
/// name is never a same-name free-fn collision → `.none`.
/// - field-access callee with a VALUE receiver: a free-function UFCS
/// (`recv.fn(args)`). A namespace / type prefix receiver → `.none`. The
/// verdict over-selects a struct-method / protocol / foreign call whose
/// verdict over-selects a struct-method / protocol / extern call whose
/// field happens to name a free fn, but those dispatch BEFORE the free-fn
/// UFCS path in both `plan` and `lowerCall`, so the verdict is consumed only
/// when the call truly is a free-fn UFCS.