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

@@ -366,8 +366,8 @@ pub const ResolvedModule = struct {
/// types/aliases and supports same-name value consts (step E5). Everything
/// else keeps the first-wins name-merge: FUNCTIONS (the shadowed
/// author stays reachable via its qualified name / SelectedFunc), and crucially
/// `var_decl`s, including a `#foreign` extern global declared in two files
/// (e.g. `__stdinp : *void #foreign;`) that MUST resolve to the ONE libSystem
/// `var_decl`s, including a `extern` extern global declared in two files
/// (e.g. `__stdinp : *void extern;`) that MUST resolve to the ONE libSystem
/// symbol, not split into a duplicate `__stdinp.1`.
fn isPerSourceDecl(decl: *const Node) bool {
return switch (decl.data) {
@@ -852,7 +852,7 @@ fn stampStructMethodSources(sd: ast.StructDecl, file_path: []const u8) void {
}
/// Stamp the defining module path onto every bodied method of an sx-defined
/// foreign class, so the method's sx body lowers in the class's own module.
/// runtime class, so the method's sx body lowers in the class's own module.
fn stampRuntimeClassMethodSources(fcd: ast.RuntimeClassDecl, file_path: []const u8) void {
for (fcd.members) |m| {
if (m == .method) {