Skip to main content

check_const_decl

Function check_const_decl 

Source
pub fn check_const_decl(
    c: &ConstDecl,
    input: &ResolvedCommons,
    tys: &Types,
    expr_types: &mut HashMap<ExprId, TypedExpr>,
    callees: &mut HashMap<ExprId, Callee>,
    errors: &mut Vec<CompileError>,
    refs: &mut RefSink,
    hints: &mut HintSink,
    locals: &mut LocalsSink,
)
Expand description

#2617: check a const declaration declared in this file. Its name is upper-camel (bynk.resolve.const_name_case) and is no variant of a sum type in scope (bynk.resolve.name_conflict); its initialiser is inside the closed static set (bynk.resolve.bad_const_initialiser, decision A) and, typed against the annotation in an empty, pure scope (the check_static_initialiser discipline), a value of that type. A diagnostic the typing raises (a literal its refined type rejects, .unsafe outside the defining commons) is reported as it stands; a value of another type is bynk.resolve.bad_const_initialiser. The initialiser’s expression types are recorded for the emitter.