pub struct TypeEnv { /* private fields */ }Expand description
What the checker inferred, for the one call being expanded.
Keyed by [Span], which is what a Node carries and therefore the only identity an argument
has once it has been substituted into a template. Where several nodes share one position —
code an earlier macro expansion generated borrows the call site’s — the outermost wins,
because the checker records a parent after its children.
Implementations§
Source§impl TypeEnv
impl TypeEnv
pub fn new() -> TypeEnv
Sourcepub fn clear_nodes(&mut self)
pub fn clear_nodes(&mut self)
Forget the last call’s expressions, keeping the module’s declarations.
The declarations are the whole module’s and are collected once; what a body may ask about belongs to one call site and must not outlive it.
pub fn record(&mut self, span: Span, ty: TyRepr)
pub fn declare(&mut self, name: Arc<str>, decl: DeclInfo)
pub fn of(&self, span: Span) -> Option<&TyRepr>
Sourcepub fn fields(&self, t: &TyRepr) -> Fields
pub fn fields(&self, t: &TyRepr) -> Fields
A model’s fields, or a newtype’s one field, with the mention’s arguments substituted in.
Sourcepub fn variants(&self, t: &TyRepr) -> Variants
pub fn variants(&self, t: &TyRepr) -> Variants
A union’s variants, each with its own fields, substituted the same way.
Sourcepub fn inner(&self, t: &TyRepr) -> TyRepr
pub fn inner(&self, t: &TyRepr) -> TyRepr
What a newtype wraps, or TyRepr::Unknown for anything else.