Skip to main content

Module expr_types

Module expr_types 

Source
Expand description

v0.30.2 (ADR 0063): the expression-type sink.

The checker computes expr_types: HashMap<ExprId, TypedExpr> per file as it types each expression (T3.4, R2.4 — keyed by node identity, not position). On the Ok path that map rides inside the TypedCommons; on the error path inside RecordCheck::typed_despite_errors, the program as checked so far. This sink carries it out to the analysis so completion can ask “what is the type of the expression at this offset?” (the receiver before a .), mirroring HintSink.

Capture is at every per-file exit of the check, clean or not (ADR 0094, via record_analyse_types): a mid-edit file with an error still yields the best-effort types of its other expressions. ADR 0094 lifted the slice-3 “clean-file ceiling” of ADR 0063, under which a file with errors yielded nothing. Unlike hints, test/integration files are not muted (completion runs in them); only synthetic toolchain-injected files are.

Structs§

ExprTypeSink
Records per-file expression types. A fresh sink records nothing until enter_file attributes it.

Functions§

type_at_offset
The type of the innermost expression whose span contains offset, if any — the receiver-typing query for .-member completion.
type_at_span
The type recorded for the expression at exactly span’s position, or None if nothing is recorded there or the entries there disagree.

Type Aliases§

FileExprTypes
Project-relative source path → that file’s (expr span, type) entries, ordered by span (innermost-last within a start, so a containment search can prefer the tightest match).