Named Capability Sets (capset)
6 sections
Overview
Implement capset — named transparent aliases for groups of capabilities. A capset declaration introduces a name that expands to its constituent capability list during name resolution, before type checking. Capsets are not traits, types, or runtime constructs.
Planned
6 sections
Lexer — capset keyword
Recognize the `capset` keyword and emit a dedicated TokenKind::Capset token. Pre-existing source uses `capset` as an identifier in some narrow contexts (e.g. comment text); reservation must not break existing valid programs.
Parser — capset_decl dispatch + AST node
Parse `capset Name = Cap1, Cap2, ...;` declarations into a CapsetDecl AST node attached to the module's declaration list. Reject malformed forms with structured E1xxx errors.
Typeck — capset expansion in uses clauses, cycle detection, visibility
Expand every capset reference in `uses` clauses to its transitive constituent capabilities, deduplicated. Reject cycles and visibility violations. Per proposal §Expansion + §Validation.
Diagnostics — E1221 / E1222 / E1223 / E1224 (capset errors)
Emit clear, actionable diagnostics for every capset-validation failure: empty member list, cycle, invalid member, visibility violation. Each error code is stable API per impl-hygiene.md §Error Handling.
Spec tests — capset declarations, expansion, validation
Author the Ori spec test corpus exercising every capset success path and every documented failure mode. Lands as the public-facing conformance surface for the proposal.
LSP support — capset expansion on hover, autocomplete in uses clauses
Surface capset expansion + autocomplete in the LSP integration so users see what capabilities a capset names without hand-grepping the source.