pub struct Program {
pub declarations: Vec<Decl>,
pub source: Option<String>,
pub parse_failed_fns: HashMap<String, ParseFailRef>,
pub glued_eq_binding_sites: HashSet<String>,
pub h_keyword_simple_ref_sites: Vec<(Span, String)>,
}Expand description
A complete program is a list of declarations
Fields§
§declarations: Vec<Decl>§source: Option<String>§parse_failed_fns: HashMap<String, ParseFailRef>Function names whose declaration was started but failed to parse to
completion (header recognised, then header/body/return-type errored).
Populated by parser::parse and consumed by verify::verify to skip
cascading type errors against these functions: their bodies are
suppressed from type-checking, and undefined function diagnostics
at call sites collapse to one cross-reference rather than firing
per call. Maps name -> (code, line, col) of the originating parse
error so cross-reference hints can point back at the root cause.
glued_eq_binding_sites: HashSet<String>Callee names whose call site sits as the RHS of a binding whose =
was actually the two-character == token glued to the binding-LHS
identifier (e.g. wc==q "", which parses as wc = (q "") — see
ILO-469). When a later ILO-T005 fires for one of these callees,
verify swaps in a targeted hint that recommends the spaced form
name = =expr instead of the bare call-vs-binop nudge. Detection is
pure adjacency: lexer joins =/== into a single Token::Eq, so we
inspect the token span length at parse time. Diagnostic-only — we do
not accept == as a fused bind-then-equality form (anti-P2).
h_keyword_simple_ref_sites: Vec<(Span, String)>Spans where the parser saw the ?h cond a b general prefix-ternary
keyword form with a simple bool-Ref condition — i.e. a shape that
the cheaper bare-bool prefix ternary ?cond a b would express
identically. Surfaced by verify as an ILO-W003 advisory so an
agent reaching for the keyword form when the bool was already a
bare ref learns the shorter shape (ILO-463). Empty when the
keyword form was used legitimately (comparison-led first operand,
nested call, etc.).