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:
@@ -718,7 +718,7 @@ pub fn lowerCall(self: *Lowering, c_in: *const ast.Call) Ref {
|
||||
// literal global symbol — the existing bare-name
|
||||
// machinery below resolves them.
|
||||
switch (fd.body.data) {
|
||||
.builtin_expr, .compiler_expr => break :gate,
|
||||
.builtin_expr => break :gate,
|
||||
else => {},
|
||||
}
|
||||
if (hasComptimeParams(fd)) return self.lowerComptimeCall(fd, c);
|
||||
@@ -919,7 +919,7 @@ pub fn lowerCall(self: *Lowering, c_in: *const ast.Call) Ref {
|
||||
// Generic method on a non-template struct: `obj.method($T, ...)`
|
||||
// or inferred form `obj.method(val)` where val's type pins $T.
|
||||
if (self.program_index.fn_ast_map.get(qualified)) |gen_fd| {
|
||||
if (gen_fd.type_params.len > 0 and gen_fd.body.data != .compiler_expr) {
|
||||
if (gen_fd.type_params.len > 0) {
|
||||
// Effective AST args: prepend receiver so positions
|
||||
// line up with fd.params (which has self at index 0).
|
||||
var eff_args = std.ArrayList(*const Node).empty;
|
||||
@@ -2090,7 +2090,7 @@ pub fn checkCallArity(self: *Lowering, fd: *const ast.FnDecl, callee_name: []con
|
||||
|
||||
if (fd.type_params.len > 0 or hasComptimeParams(fd) or isPackFn(fd)) return false;
|
||||
switch (fd.body.data) {
|
||||
.compiler_expr, .builtin_expr => return false,
|
||||
.builtin_expr => return false,
|
||||
else => {},
|
||||
}
|
||||
var min: usize = 0;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -822,7 +822,7 @@ pub fn isPlainFreeFn(fd: *const ast.FnDecl) bool {
|
||||
// fn. `export` DEFINES a real body, so it stays plain-free.
|
||||
if (fd.extern_export == .extern_) return false;
|
||||
return switch (fd.body.data) {
|
||||
.builtin_expr, .compiler_expr => false,
|
||||
.builtin_expr => false,
|
||||
else => true,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user