enum DeclKindThe grammar form and children of a parsed declaration.
Nominal payloads retain names, spans, generics, constraints, and member bodies. Context-sensitive parser entry points decide whether a func, init, or property is a member; visibility and type validity are checked later.
Cases
case let_decl(Pattern, TypeAnnotation?, Expr?)
A let pattern with optional type annotation and initializer.
case import_decl(Import)
A module import declaration.
case func_decl(Func)
A function declaration with a body.
case func_signature(FuncSignature)
A bodyless function requirement.
case struct_decl(String, Int, Int, [GenericDecl], WhereClause?, Body, Bool, Bool)
name + its token span, generics, where, body, 'linear, 'heap.
case enum_decl(String, Int, Int, [GenericDecl], WhereClause?, Body, Bool, Bool)
name + its token span, generics, where, body, 'linear, 'heap.
case protocol_decl(String, Int, Int, [GenericDecl], WhereClause?, Body, [TypeAnnotation])
name + its token span, generics, where, body, conformances.
case enum_variant(String, Int, Int, [GenericDecl], [TypeAnnotation], [String?], TypeAnnotation?)
name + its token span, generics, payloads, per-payload labels, GADT result.
case extend_decl([GenericDecl], TypeApplication, [TypeAnnotation], WhereClause?, Body)
binders, head, conformances, where, body.
case init_decl([Parameter], Block)
An initializer's parameters and body.
case property(String, Int, Int, Bool, TypeAnnotation?, Expr?)
name + its token span, is_static, annotation, default value.
case method(Func, Bool, ReceiverMode)
A function member, whether it is static, and its receiver mode.
case method_requirement(FuncSignature, ReceiverMode)
A bodyless method requirement and its receiver mode.
case init_requirement(FuncSignature)
A bodyless initializer requirement.
case typealias_decl(String, Int, Int, TypeAnnotation)
A type alias name, name span, and target annotation.
case effect_decl(String, Int, Int, [GenericDecl], WhereClause?, [Parameter], TypeAnnotation)
name + its token span, generics, where, params, return type.
case associated_decl(GenericDecl, WhereClause?)
An associated type declaration and its optional constraints.
case macro_decl(String, Int, Int, [MacroParam], Int, Int, [MacroToken])
name + its token span, parameters, template body range + canonical tokens. The body is an unparsed token template: the invocation position's category decides how it parses (ADR 0026's unified template model).
case macro_call_decl(String, Int, Int, Int, Int, [MacroToken], [Expr])
An @macro invocation in declaration position: name + its token span, the input extent, canonical tokens (outer delimiters included), and the parsed arguments when the input is a parenthesized expression list (used by the compiler-provided @assert).
case wrapper_decl(String, Int, Int, Int, Int, [MacroToken], [MacroToken], [Decl])
A #[name] / #[name(tokens)] declaration wrapper marker attached to the following declaration (ADR 0026): name + its token span, the argument extent and canonical argument tokens (outer parentheses included; empty for the bare #[name] form), the target's canonical tokens, and the parsed target declaration. The single-element array supplies the indirection the recursive payload needs; adjacent markers nest, innermost closest to the declaration.