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

@@ -320,32 +320,6 @@ test "plan: protocol dispatch selects method index + prepends receiver" {
try std.testing.expect(p.prepends_receiver);
}
test "plan: struct (UFCS) method via #compiler dispatch + prepends receiver" {
var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena.deinit();
const alloc = arena.allocator();
var module = ir_mod.Module.init(alloc);
defer module.deinit();
var l = Lowering.init(&module);
const cr = CallResolver{ .l = &l };
// struct Point, with a `#compiler` method Point.scale(self) -> i64.
_ = module.types.intern(.{ .@"struct" = .{ .name = module.types.internString("Point"), .fields = &.{} } });
const self_param = ast.Param{ .name = "self", .name_span = .{ .start = 0, .end = 0 }, .type_expr = typeExpr(alloc, "Point") };
const params = [_]ast.Param{self_param};
const compiler_body = mk(alloc, .{ .compiler_expr = {} });
const method_fd = ast.FnDecl{ .name = "Point.scale", .params = &params, .return_type = typeExpr(alloc, "i64"), .body = compiler_body };
l.program_index.fn_ast_map.put("Point.scale", &method_fd) catch unreachable;
const recv = callNode(alloc, ident(alloc, "cast"), &[_]*Node{ typeExpr(alloc, "Point"), intLit(alloc, 0) });
const call = callNode(alloc, fieldAccess(alloc, recv, "scale"), &.{});
const p = cr.plan(&call.data.call);
try std.testing.expectEqual(CallPlan.Kind.struct_method, p.kind);
try std.testing.expectEqualStrings("Point.scale", p.target.named);
try std.testing.expectEqual(TypeId.i64, p.return_type);
try std.testing.expect(p.prepends_receiver);
}
test "plan: runtime-class instance vs static dispatch" {
var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena.deinit();