Skip to main content

QueryCache

Struct QueryCache 

Source
pub struct QueryCache<'a> { /* private fields */ }
Expand description

Query database wrapper with basic caching.

Implementations§

Trait Implementations§

Source§

impl QueryDatabase for QueryCache<'_>

Source§

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

Convenience wrapper for is_subtype_of with default flags.

Source§

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

Convenience wrapper for is_assignable_to with default flags.

Source§

fn as_type_database(&self) -> &dyn TypeDatabase

Expose the underlying TypeDatabase view for legacy entry points.
Source§

fn register_array_base_type( &self, type_id: TypeId, type_params: Vec<TypeParamInfo>, )

Register the canonical Array<T> base type used by property access resolution. Read more
Source§

fn register_boxed_type(&self, kind: IntrinsicKind, type_id: TypeId)

Register a boxed interface type for a primitive intrinsic kind. Read more
Source§

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

Source§

fn evaluate_type_with_options( &self, type_id: TypeId, no_unchecked_indexed_access: bool, ) -> TypeId

Source§

fn lookup_application_eval_cache( &self, def_id: DefId, args: &[TypeId], no_unchecked_indexed_access: bool, ) -> Option<TypeId>

Look up a shared cache entry for evaluated generic applications.
Source§

fn insert_application_eval_cache( &self, def_id: DefId, args: &[TypeId], no_unchecked_indexed_access: bool, result: TypeId, )

Store an evaluated generic application result in the shared cache.
Source§

fn is_subtype_of_with_flags( &self, source: TypeId, target: TypeId, flags: u16, ) -> bool

Subtype check with explicit compiler flags. Read more
Source§

fn is_assignable_to_with_flags( &self, source: TypeId, target: TypeId, flags: u16, ) -> bool

Assignability check with explicit compiler flags. Read more
Source§

fn lookup_subtype_cache(&self, key: RelationCacheKey) -> Option<bool>

Look up a cached subtype result for the given key. Returns None if the result is not cached. Default implementation returns None (no caching).
Source§

fn insert_subtype_cache(&self, key: RelationCacheKey, result: bool)

Cache a subtype result for the given key. Default implementation is a no-op.
Source§

fn lookup_assignability_cache(&self, key: RelationCacheKey) -> Option<bool>

Look up a cached assignability result for the given key. Returns None if the result is not cached. Default implementation returns None (no caching).
Source§

fn insert_assignability_cache(&self, key: RelationCacheKey, result: bool)

Cache an assignability result for the given key. Default implementation is a no-op.
Source§

fn get_index_signatures(&self, type_id: TypeId) -> IndexInfo

Get index signatures for a type
Source§

fn is_nullish_type(&self, type_id: TypeId) -> bool

Check if a type contains null or undefined
Source§

fn remove_nullish(&self, type_id: TypeId) -> TypeId

Remove null and undefined from a type
Source§

fn resolve_property_access( &self, object_type: TypeId, prop_name: &str, ) -> PropertyAccessResult

Source§

fn resolve_property_access_with_options( &self, object_type: TypeId, prop_name: &str, no_unchecked_indexed_access: bool, ) -> PropertyAccessResult

Source§

fn resolve_element_access_type( &self, object_type: TypeId, index_type: TypeId, literal_index: Option<usize>, ) -> TypeId

Resolve element access type with cache-friendly error normalization.
Source§

fn collect_object_spread_properties( &self, spread_type: TypeId, ) -> Vec<PropertyInfo>

Collect properties that can be spread into object literals.
Source§

fn no_unchecked_indexed_access(&self) -> bool

Source§

fn set_no_unchecked_indexed_access(&self, enabled: bool)

Source§

fn get_type_param_variance(&self, def_id: DefId) -> Option<Arc<[Variance]>>

Task #41: Get the variance mask for a generic type definition. Read more
Source§

fn canonical_id(&self, type_id: TypeId) -> TypeId

Get the canonical TypeId for a type, achieving O(1) structural identity checks. Read more
Source§

fn factory(&self) -> TypeFactory<'_>

Expose the checked construction surface for type constructors.
Source§

fn evaluate_conditional(&self, cond: &ConditionalType) -> TypeId

Source§

fn evaluate_index_access( &self, object_type: TypeId, index_type: TypeId, ) -> TypeId

Source§

fn evaluate_index_access_with_options( &self, object_type: TypeId, index_type: TypeId, no_unchecked_indexed_access: bool, ) -> TypeId

Source§

fn evaluate_mapped(&self, mapped: &MappedType) -> TypeId

Source§

fn evaluate_keyof(&self, operand: TypeId) -> TypeId

Source§

fn narrow(&self, type_id: TypeId, narrower: TypeId) -> TypeId
where Self: Sized,

Source§

fn property_access_type( &self, object_type: TypeId, prop_name: &str, ) -> PropertyAccessResult

Source§

fn contextual_property_type( &self, expected: TypeId, prop_name: &str, ) -> Option<TypeId>

Source§

fn is_property_readonly(&self, object_type: TypeId, prop_name: &str) -> bool

Source§

fn is_readonly_index_signature( &self, object_type: TypeId, wants_string: bool, wants_number: bool, ) -> bool

Source§

fn resolve_element_access( &self, object_type: TypeId, index_type: TypeId, literal_index: Option<usize>, ) -> ElementAccessResult

Resolve element access (array/tuple indexing) with detailed error reporting
Source§

fn new_inference_context(&self) -> InferenceContext<'_>

Source§

impl TypeDatabase for QueryCache<'_>

Source§

fn intern(&self, key: TypeData) -> TypeId

Source§

fn lookup(&self, id: TypeId) -> Option<TypeData>

Source§

fn intern_string(&self, s: &str) -> Atom

Source§

fn resolve_atom(&self, atom: Atom) -> String

Source§

fn resolve_atom_ref(&self, atom: Atom) -> Arc<str>

Source§

fn type_list(&self, id: TypeListId) -> Arc<[TypeId]>

Source§

fn tuple_list(&self, id: TupleListId) -> Arc<[TupleElement]>

Source§

fn template_list(&self, id: TemplateLiteralId) -> Arc<[TemplateSpan]>

Source§

fn object_shape(&self, id: ObjectShapeId) -> Arc<ObjectShape>

Source§

fn object_property_index( &self, shape_id: ObjectShapeId, name: Atom, ) -> PropertyLookup

Source§

fn function_shape(&self, id: FunctionShapeId) -> Arc<FunctionShape>

Source§

fn callable_shape(&self, id: CallableShapeId) -> Arc<CallableShape>

Source§

fn conditional_type(&self, id: ConditionalTypeId) -> Arc<ConditionalType>

Source§

fn mapped_type(&self, id: MappedTypeId) -> Arc<MappedType>

Source§

fn type_application(&self, id: TypeApplicationId) -> Arc<TypeApplication>

Source§

fn literal_string(&self, value: &str) -> TypeId

Source§

fn literal_number(&self, value: f64) -> TypeId

Source§

fn literal_boolean(&self, value: bool) -> TypeId

Source§

fn literal_bigint(&self, value: &str) -> TypeId

Source§

fn literal_bigint_with_sign(&self, negative: bool, digits: &str) -> TypeId

Source§

fn union(&self, members: Vec<TypeId>) -> TypeId

Source§

fn union_from_sorted_vec(&self, flat: Vec<TypeId>) -> TypeId

Source§

fn union2(&self, left: TypeId, right: TypeId) -> TypeId

Source§

fn union3(&self, first: TypeId, second: TypeId, third: TypeId) -> TypeId

Source§

fn intersection(&self, members: Vec<TypeId>) -> TypeId

Source§

fn intersection2(&self, left: TypeId, right: TypeId) -> TypeId

Source§

fn intersect_types_raw2(&self, left: TypeId, right: TypeId) -> TypeId

Raw intersection without normalization (used to avoid infinite recursion)
Source§

fn array(&self, element: TypeId) -> TypeId

Source§

fn tuple(&self, elements: Vec<TupleElement>) -> TypeId

Source§

fn object(&self, properties: Vec<PropertyInfo>) -> TypeId

Source§

fn object_with_flags( &self, properties: Vec<PropertyInfo>, flags: ObjectFlags, ) -> TypeId

Source§

fn object_with_flags_and_symbol( &self, properties: Vec<PropertyInfo>, flags: ObjectFlags, symbol: Option<SymbolId>, ) -> TypeId

Source§

fn object_with_index(&self, shape: ObjectShape) -> TypeId

Source§

fn function(&self, shape: FunctionShape) -> TypeId

Source§

fn callable(&self, shape: CallableShape) -> TypeId

Source§

fn template_literal(&self, spans: Vec<TemplateSpan>) -> TypeId

Source§

fn conditional(&self, conditional: ConditionalType) -> TypeId

Source§

fn mapped(&self, mapped: MappedType) -> TypeId

Source§

fn reference(&self, symbol: SymbolRef) -> TypeId

Source§

fn lazy(&self, def_id: DefId) -> TypeId

Source§

fn bound_parameter(&self, index: u32) -> TypeId

Source§

fn recursive(&self, depth: u32) -> TypeId

Source§

fn type_param(&self, info: TypeParamInfo) -> TypeId

Source§

fn type_query(&self, symbol: SymbolRef) -> TypeId

Source§

fn enum_type(&self, def_id: DefId, structural_type: TypeId) -> TypeId

Source§

fn application(&self, base: TypeId, args: Vec<TypeId>) -> TypeId

Source§

fn literal_string_atom(&self, atom: Atom) -> TypeId

Source§

fn union_preserve_members(&self, members: Vec<TypeId>) -> TypeId

Source§

fn readonly_type(&self, inner: TypeId) -> TypeId

Source§

fn keyof(&self, inner: TypeId) -> TypeId

Source§

fn index_access(&self, object_type: TypeId, index_type: TypeId) -> TypeId

Source§

fn this_type(&self) -> TypeId

Source§

fn no_infer(&self, inner: TypeId) -> TypeId

Source§

fn unique_symbol(&self, symbol: SymbolRef) -> TypeId

Source§

fn infer(&self, info: TypeParamInfo) -> TypeId

Source§

fn string_intrinsic( &self, kind: StringIntrinsicKind, type_arg: TypeId, ) -> TypeId

Source§

fn get_class_base_type(&self, symbol_id: SymbolId) -> Option<TypeId>

Get the base class type for a symbol (class/interface). Returns the TypeId of the extends clause, or None if the symbol doesn’t extend anything. This is used by the BCT algorithm to find common base classes.
Source§

fn is_identity_comparable_type(&self, type_id: TypeId) -> bool

Check if a type can be compared by TypeId identity alone (O(1) equality). Identity-comparable types include literals, enum members, unique symbols, null, undefined, void, never, and tuples composed entirely of identity-comparable types. Results are cached for O(1) lookup after first computation.
Source§

fn object_fresh(&self, properties: Vec<PropertyInfo>) -> TypeId

Source§

impl TypeResolver for QueryCache<'_>

Implement TypeResolver for QueryCache with noop resolution.

QueryCache doesn’t have access to the Binder or type environment, so it cannot resolve symbol references or DefIds. Only resolve_ref (required) is explicitly implemented; all other resolution methods inherit the trait’s default None/false behavior. The three boxed/array methods delegate to the underlying interner.

Source§

fn resolve_ref( &self, _symbol: SymbolRef, _interner: &dyn TypeDatabase, ) -> Option<TypeId>

Resolve a symbol reference to its structural type. Returns None if the symbol cannot be resolved. Read more
Source§

fn get_boxed_type(&self, kind: IntrinsicKind) -> Option<TypeId>

Get the boxed interface type for a primitive intrinsic (Rule #33). For example, IntrinsicKind::Number -> TypeId of the Number interface. This enables primitives to be subtypes of their boxed interfaces.
Source§

fn get_array_base_type(&self) -> Option<TypeId>

Get the Array interface type from lib.d.ts.
Source§

fn get_array_base_type_params(&self) -> &[TypeParamInfo]

Get the type parameters for the Array interface.
Source§

fn resolve_symbol_ref( &self, symbol: SymbolRef, interner: &dyn TypeDatabase, ) -> Option<TypeId>

Resolve a symbol reference to a structural type, preferring DefId-based lazy paths. Read more
Source§

fn resolve_lazy( &self, _def_id: DefId, _interner: &dyn TypeDatabase, ) -> Option<TypeId>

Resolve a DefId reference to its structural type. Read more
Source§

fn get_type_params(&self, _symbol: SymbolRef) -> Option<Vec<TypeParamInfo>>

Get type parameters for a symbol (for generic type aliases/interfaces). Returns None by default; implementations can override to support Application type expansion.
Source§

fn get_lazy_type_params(&self, _def_id: DefId) -> Option<Vec<TypeParamInfo>>

Get type parameters for a DefId (for generic type aliases/interfaces). Read more
Source§

fn def_to_symbol_id(&self, _def_id: DefId) -> Option<SymbolId>

Get the SymbolId for a DefId (bridge for InheritanceGraph). Read more
Source§

fn symbol_to_def_id(&self, _symbol: SymbolRef) -> Option<DefId>

Get the DefId for a SymbolRef (Ref -> Lazy migration). Read more
Source§

fn get_def_kind(&self, _def_id: DefId) -> Option<DefKind>

Get the DefKind for a DefId (Task #32: Graph Isomorphism). Read more
Source§

fn is_boxed_def_id(&self, _def_id: DefId, _kind: IntrinsicKind) -> bool

Check if a DefId corresponds to a boxed type for the given intrinsic kind.
Source§

fn is_boxed_type_id(&self, _type_id: TypeId, _kind: IntrinsicKind) -> bool

Check if a TypeId is any known resolved form of a boxed type. Read more
Source§

fn get_lazy_export(&self, _def_id: DefId, _name: Atom) -> Option<TypeId>

Get an export from a namespace/module by name. Read more
Source§

fn get_lazy_enum_member(&self, _def_id: DefId, _name: Atom) -> Option<TypeId>

Get enum member type by name from an enum DefId. Read more
Source§

fn is_numeric_enum(&self, _def_id: DefId) -> bool

Check if a DefId corresponds to a numeric enum (not a string enum). Read more
Source§

fn is_enum_type(&self, _type_id: TypeId, _interner: &dyn TypeDatabase) -> bool

Check if a TypeId represents a full Enum type (not a specific member).
Source§

fn get_enum_parent_def_id(&self, _member_def_id: DefId) -> Option<DefId>

Get the parent Enum’s DefId for an Enum Member’s DefId. Read more
Source§

fn is_user_enum_def(&self, _def_id: DefId) -> bool

Check if a DefId represents a user-defined enum (not an intrinsic type).
Source§

fn get_base_type( &self, _type_id: TypeId, _interner: &dyn TypeDatabase, ) -> Option<TypeId>

Get the base class type for a class/interface type. Read more
Source§

fn get_type_param_variance(&self, _def_id: DefId) -> Option<Arc<[Variance]>>

Get the variance mask for type parameters of a generic type (Task #41). Read more

Auto Trait Implementations§

§

impl<'a> !Freeze for QueryCache<'a>

§

impl<'a> !RefUnwindSafe for QueryCache<'a>

§

impl<'a> Send for QueryCache<'a>

§

impl<'a> Sync for QueryCache<'a>

§

impl<'a> Unpin for QueryCache<'a>

§

impl<'a> UnsafeUnpin for QueryCache<'a>

§

impl<'a> !UnwindSafe for QueryCache<'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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more