Skip to main content

AssignabilityChecker

Trait AssignabilityChecker 

Source
pub trait AssignabilityChecker {
    // Required method
    fn is_assignable_to(&mut self, source: TypeId, target: TypeId) -> bool;

    // Provided methods
    fn is_assignable_to_strict(
        &mut self,
        source: TypeId,
        target: TypeId,
    ) -> bool { ... }
    fn is_assignable_to_bivariant_callback(
        &mut self,
        source: TypeId,
        target: TypeId,
    ) -> bool { ... }
    fn evaluate_type(&mut self, type_id: TypeId) -> TypeId { ... }
}

Required Methods§

Source

fn is_assignable_to(&mut self, source: TypeId, target: TypeId) -> bool

Provided Methods§

Source

fn is_assignable_to_strict(&mut self, source: TypeId, target: TypeId) -> bool

Source

fn is_assignable_to_bivariant_callback( &mut self, source: TypeId, target: TypeId, ) -> bool

Assignability check for bivariant callback parameters.

This is used for method parameter positions where TypeScript allows bivariant checking for function-typed callbacks.

Source

fn evaluate_type(&mut self, type_id: TypeId) -> TypeId

Evaluate/expand a type using the checker’s resolver context. This is needed during inference constraint collection, where Application types like Func<T> must be expanded to their structural form (e.g., a Callable). The default implementation returns the type unchanged (no resolver available).

Implementors§