P5.7 Step B2: remove the #compiler attribute + compiler_expr AST node

The #compiler struct attribute + #compiler-suffixed bodyless methods were
fully superseded by abi(.compiler) (P5.5) — no sx code uses them.

Remove the hash_compiler token (token/lexer/lsp), the is_compiler_struct /
struct_default_compiler parser machinery + the two compiler_expr body-
synthesis branches, the compiler_expr AST variant, and every
.builtin_expr/.compiler_expr switch arm + == .compiler_expr check across
sema/resolver/semantic_diagnostics/generic/decl/call/calls (kept .builtin_expr).
abi(.compiler) is untouched. Delete the obsolete calls.test.zig dispatch test.

500/500 unit + 706/0 corpus.
This commit is contained in:
agra
2026-06-19 17:18:45 +03:00
parent e2971f272c
commit 64eb01918a
14 changed files with 31 additions and 101 deletions

View File

@@ -523,7 +523,7 @@ pub fn funcWantsImplicitCtx(self: *const Lowering, fd: *const ast.FnDecl) bool {
// C ABI, no sx context (Phase 2, gap iv).
if (fd.extern_export != .none) return false;
return switch (fd.body.data) {
.builtin_expr, .compiler_expr => false,
.builtin_expr => false,
else => !isExportedEntryName(fd.name),
};
}
@@ -2402,10 +2402,10 @@ pub fn registerQualifiedFn(self: *Lowering, ns_name: []const u8, fd: *const ast.
// collision assert; registering a qualified alias for them
// would divert that machinery and strand a per-call type binding.
if (fd.type_params.len > 0 or hasComptimeParams(fd) or isPackFn(fd)) return;
// Extern / builtin / #compiler bodies keep their literal name; a
// qualified alias has no distinct symbol to resolve to.
// Extern / builtin bodies keep their literal name; a qualified alias has
// no distinct symbol to resolve to.
switch (fd.body.data) {
.builtin_expr, .compiler_expr => return,
.builtin_expr => return,
else => {},
}
const qualified = std.fmt.allocPrint(self.alloc, "{s}.{s}", .{ ns_name, short }) catch return;
@@ -2521,8 +2521,8 @@ pub fn lazyLowerFunction(self: *Lowering, name: []const u8) void {
}
return;
}
// Builtins / #compiler bodies stay as compiler-handled — no extern stub needed.
if (fd.body.data == .builtin_expr or fd.body.data == .compiler_expr) return;
// Builtin bodies stay as compiler-handled — no extern stub needed.
if (fd.body.data == .builtin_expr) return;
if (fd.type_params.len > 0) return; // generics handled by monomorphization (Step 3.13)
// Defer functions with type-category matches until all types are registered.
@@ -2728,7 +2728,7 @@ pub fn lowerFunction(self: *Lowering, fd: *const ast.FnDecl, name: []const u8, i
// declare-only — its Zig/VM handler is the impl. A BODIED `abi(.compiler)`
// function DOES need its body lowered for VM eval (emit-skipped later via
// `is_compiler_domain`), so it falls through to normal lowering below.
if (fd.body.data == .builtin_expr or fd.body.data == .compiler_expr or
if (fd.body.data == .builtin_expr or
fd.extern_export == .extern_ or fnIsBodilessCompiler(fd))
{
// Already declared by scanDecls/declareFunction (which handles #extern renames)