Skip to main content

TypeChecker

Struct TypeChecker 

Source
pub struct TypeChecker<'a> {
    pub store: &'a ScopeStore,
    pub diagnostics: Vec<SemanticDiagnostic>,
    pub type_map: HashMap<TypeMapKey, Type>,
    /* private fields */
}
Expand description

Tracks inferred types and runs arity checks. Runs after scope building and validation.

Fields§

§store: &'a ScopeStore§diagnostics: Vec<SemanticDiagnostic>§type_map: HashMap<TypeMapKey, Type>

Map from expression span (start, end) to inferred type (for formatter type annotations).

Implementations§

Source§

impl<'a> TypeChecker<'a>

Source

pub fn new(store: &'a ScopeStore, root: &'a SyntaxNode) -> Self

Trait Implementations§

Source§

impl Visitor for TypeChecker<'_>

Source§

fn enter_node(&mut self, node: &SyntaxNode) -> WalkResult

Called before visiting this node’s children (pre-order).
Source§

fn leave_node(&mut self, node: &SyntaxNode) -> WalkResult

Called after visiting this node’s children (post-order).
Source§

fn visit_token(&mut self, _token: &SyntaxToken) -> ControlFlow<()>

Called for each token when WalkOptions::visit_tokens is true. Trivia is included only when WalkOptions::visit_trivia is true.

Auto Trait Implementations§

§

impl<'a> Freeze for TypeChecker<'a>

§

impl<'a> RefUnwindSafe for TypeChecker<'a>

§

impl<'a> Send for TypeChecker<'a>

§

impl<'a> Sync for TypeChecker<'a>

§

impl<'a> Unpin for TypeChecker<'a>

§

impl<'a> UnsafeUnpin for TypeChecker<'a>

§

impl<'a> UnwindSafe for TypeChecker<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.