Phase 2: effects and capabilities (RFC 0006)

- air: cap<K> and built-in enums (cap_error) as types; enum.switch over
  built-in enums; cap.narrow terminator with ok/err targets; intrinsic
  syntax (registry still empty: E0004); registries for effects,
  capability kinds and built-in enums, synced with reference docs
- verifier: effect stage (E3101, flat, direct callees); cap.narrow form
  check (E3202) and ok/err parameter rules (E5002, E1001); capabilities
  are copyable, not zeroable, not comparable; sizes cap 8, built-in tag
- interp: host authority table; @main instantiation from grants by
  parameter name with not_instantiated reasons; capabilities render as
  opaque
- CLI: --grant P=KIND[:SCOPE], exit code 6; runner: grant: and
  not_instantiated: headers, pending only for unsupported features
- conformance: 18 Phase 2 tests; 4000 mutants without a crash
This commit is contained in:
dev committed 2026-10-04 13:42:35 +03:00
1 parent fb4338cea6
commit 9c29a80b72
41 files changed
+908 -58

No files matched your search

+3 -1
View File
@@ -16,6 +16,7 @@ pub const budget = @import("verifier/budget.zig");
pub const cfg = @import("verifier/cfg.zig");
pub const ssa = @import("verifier/ssa.zig");
pub const types = @import("verifier/types.zig");
pub const effects = @import("verifier/effects.zig");
pub const init = @import("verifier/init.zig");
pub const borrow = @import("verifier/borrow.zig");
pub const bounds = @import("verifier/bounds.zig");
@@ -60,7 +61,7 @@ pub const Context = struct {
/// stage, or an empty slice if the module verifies.
pub fn verify(arena: std.mem.Allocator, file: []const u8, module: air.Module) std.mem.Allocator.Error![]const diag.Diagnostic {
var c: Context = .{ .arena = arena, .file = file, .module = module };
const stages = .{ budget.check, cfg.check, ssa.check, types.check, init.check, borrow.check, bounds.check };
const stages = .{ budget.check, cfg.check, ssa.check, types.check, effects.check, init.check, borrow.check, bounds.check };
inline for (stages) |stage| {
try stage(&c);
if (c.diags.items.len != 0) {
@@ -84,6 +85,7 @@ test {
_ = cfg;
_ = ssa;
_ = types;
_ = effects;
_ = init;
_ = borrow;
_ = bounds;