Skip to main content

check_state_initialiser

Function check_state_initialiser 

Source
pub fn check_state_initialiser(
    init: &Expr,
    field_type: &TypeRef,
    input: &ResolvedCommons,
    expr_types: &mut HashMap<Span, Ty>,
    errors: &mut Vec<CompileError>,
    refs: &mut RefSink,
    hints: &mut HintSink,
    locals: &mut LocalsSink,
)
Expand description

v0.11: type-check an agent state-field initialiser (field: T = init). The initialiser must be a static value of the field type — it is checked in an empty, pure scope (so self, parameters, capabilities, and effects are all out of reach) with the field type as the expected type, so refined literals admit (v0.9.4) and sum variants resolve. The init’s expression types are recorded into expr_types for emission; a single bynk.agents.bad_state_initialiser is pushed on any failure.