- 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
24 lines
514 B
LLVM
24 lines
514 B
LLVM
; Capabilities are copyable values: passed, copied and stored in a struct.
|
|
; expect: accept
|
|
; phase: 2
|
|
; spec: docs/spec/05-effects-and-capabilities.md
|
|
module test.capability_values
|
|
air 0
|
|
lang 0.1
|
|
features [capabilities, effects, ownership]
|
|
|
|
type @Logger = struct { out: cap<io.write> }
|
|
|
|
fn @make(%out: cap<io.write>) -> @Logger
|
|
effects []
|
|
entry:
|
|
%c = copy %out
|
|
%l = struct.make @Logger(%c)
|
|
ret %l
|
|
|
|
fn @use(%l: @Logger) -> cap<io.write>
|
|
effects []
|
|
entry:
|
|
%o = struct.get @Logger.out, %l
|
|
ret %o
|