pub struct TypeInterner {
pub string_interner: ShardedInterner,
/* private fields */
}Expand description
Type interning table with lock-free concurrent access.
Uses sharded DashMap structures for all internal storage, enabling
true parallel type checking without lock contention.
All internal structures use lazy initialization via OnceLock to minimize
startup overhead - DashMaps are only allocated when first accessed.
Fields§
§string_interner: ShardedInternerString interner for property names and string literals (already lock-free)
Implementations§
Source§impl TypeInterner
impl TypeInterner
Sourcepub fn template_literal(&self, spans: Vec<TemplateSpan>) -> TypeId
pub fn template_literal(&self, spans: Vec<TemplateSpan>) -> TypeId
Intern a template literal type
Sourcepub fn template_literal_interpolation_positions(
&self,
type_id: TypeId,
) -> Vec<usize>
pub fn template_literal_interpolation_positions( &self, type_id: TypeId, ) -> Vec<usize>
Get the interpolation positions from a template literal type Returns indices of type interpolation spans
Sourcepub fn template_literal_get_span(
&self,
type_id: TypeId,
index: usize,
) -> Option<TemplateSpan>
pub fn template_literal_get_span( &self, type_id: TypeId, index: usize, ) -> Option<TemplateSpan>
Get the span at a given position from a template literal type
Sourcepub fn template_literal_span_count(&self, type_id: TypeId) -> usize
pub fn template_literal_span_count(&self, type_id: TypeId) -> usize
Get the number of spans in a template literal type
Sourcepub fn template_literal_is_text_only(&self, type_id: TypeId) -> bool
pub fn template_literal_is_text_only(&self, type_id: TypeId) -> bool
Check if a template literal contains only text (no interpolations) Also returns true for string literals (which are the result of text-only template expansion)
Source§impl TypeInterner
impl TypeInterner
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new type interner with pre-registered intrinsics.
Uses lazy initialization for all DashMap structures to minimize
startup overhead. DashMaps are only allocated when first accessed.
Sourcepub fn set_array_base_type(&self, type_id: TypeId, params: Vec<TypeParamInfo>)
pub fn set_array_base_type(&self, type_id: TypeId, params: Vec<TypeParamInfo>)
Set the global Array base type (e.g., Array
This should be called once during primordial type setup when lib.d.ts is processed.
Once set, the value cannot be changed (OnceLock enforces this).
Sourcepub fn get_array_base_type(&self) -> Option<TypeId>
pub fn get_array_base_type(&self) -> Option<TypeId>
Get the global Array base type, if it has been set.
Sourcepub fn get_array_base_type_params(&self) -> &[TypeParamInfo]
pub fn get_array_base_type_params(&self) -> &[TypeParamInfo]
Get the type parameters for the global Array base type, if it has been set.
Sourcepub fn set_boxed_type(&self, kind: IntrinsicKind, type_id: TypeId)
pub fn set_boxed_type(&self, kind: IntrinsicKind, type_id: TypeId)
Set a boxed interface type for a primitive intrinsic kind.
Called during primordial type setup when lib.d.ts is processed.
For example, set_boxed_type(IntrinsicKind::String, type_id_of_String_interface)
enables property access on string values to resolve through the String interface.
Sourcepub fn get_boxed_type(&self, kind: IntrinsicKind) -> Option<TypeId>
pub fn get_boxed_type(&self, kind: IntrinsicKind) -> Option<TypeId>
Get the boxed interface type for a primitive intrinsic kind.
Sourcepub fn is_identity_comparable_type(&self, type_id: TypeId) -> bool
pub fn is_identity_comparable_type(&self, type_id: TypeId) -> bool
Check if a type can be compared by TypeId identity alone (O(1) equality).
Results are cached for O(1) lookup after first computation.
This is used for optimization in BCT and subtype checking.
Sourcepub fn intern_string(&self, s: &str) -> Atom
pub fn intern_string(&self, s: &str) -> Atom
Intern a string into an Atom. This is used when constructing types with property names or string literals.
Sourcepub fn resolve_atom(&self, atom: Atom) -> String
pub fn resolve_atom(&self, atom: Atom) -> String
Resolve an Atom back to its string value. This is used when formatting types for error messages.
Sourcepub fn resolve_atom_ref(&self, atom: Atom) -> Arc<str>
pub fn resolve_atom_ref(&self, atom: Atom) -> Arc<str>
Resolve an Atom without allocating a new String.
pub fn type_list(&self, id: TypeListId) -> Arc<[TypeId]>
pub fn tuple_list(&self, id: TupleListId) -> Arc<[TupleElement]>
pub fn template_list(&self, id: TemplateLiteralId) -> Arc<[TemplateSpan]>
pub fn object_shape(&self, id: ObjectShapeId) -> Arc<ObjectShape>
pub fn object_property_index( &self, shape_id: ObjectShapeId, name: Atom, ) -> PropertyLookup
pub fn function_shape(&self, id: FunctionShapeId) -> Arc<FunctionShape>
pub fn callable_shape(&self, id: CallableShapeId) -> Arc<CallableShape>
pub fn conditional_type(&self, id: ConditionalTypeId) -> Arc<ConditionalType>
pub fn mapped_type(&self, id: MappedTypeId) -> Arc<MappedType>
pub fn type_application(&self, id: TypeApplicationId) -> Arc<TypeApplication>
Sourcepub fn intern(&self, key: TypeData) -> TypeId
pub fn intern(&self, key: TypeData) -> TypeId
Intern a type key and return its TypeId.
If the key already exists, returns the existing TypeId.
Otherwise, creates a new TypeId and stores the key.
This uses a lock-free pattern with DashMap for concurrent access.
Sourcepub fn lookup(&self, id: TypeId) -> Option<TypeData>
pub fn lookup(&self, id: TypeId) -> Option<TypeData>
Look up the TypeData for a given TypeId.
This uses lock-free DashMap access with lazy shard initialization.
pub fn intern_object_shape(&self, shape: ObjectShape) -> ObjectShapeId
Sourcepub const fn intrinsic(&self, kind: IntrinsicKind) -> TypeId
pub const fn intrinsic(&self, kind: IntrinsicKind) -> TypeId
Intern an intrinsic type
Sourcepub fn literal_string(&self, value: &str) -> TypeId
pub fn literal_string(&self, value: &str) -> TypeId
Intern a literal string type
Sourcepub fn literal_string_atom(&self, atom: Atom) -> TypeId
pub fn literal_string_atom(&self, atom: Atom) -> TypeId
Intern a literal string type from an already-interned Atom
Sourcepub fn literal_number(&self, value: f64) -> TypeId
pub fn literal_number(&self, value: f64) -> TypeId
Intern a literal number type
Sourcepub fn literal_boolean(&self, value: bool) -> TypeId
pub fn literal_boolean(&self, value: bool) -> TypeId
Intern a literal boolean type
Sourcepub fn literal_bigint(&self, value: &str) -> TypeId
pub fn literal_bigint(&self, value: &str) -> TypeId
Intern a literal bigint type
Sourcepub fn literal_bigint_with_sign(&self, negative: bool, digits: &str) -> TypeId
pub fn literal_bigint_with_sign(&self, negative: bool, digits: &str) -> TypeId
Intern a literal bigint type, allowing a sign prefix without extra clones.
Sourcepub fn union(&self, members: Vec<TypeId>) -> TypeId
pub fn union(&self, members: Vec<TypeId>) -> TypeId
Intern a union type, normalizing and deduplicating members
Sourcepub fn union_from_sorted_vec(&self, flat: Vec<TypeId>) -> TypeId
pub fn union_from_sorted_vec(&self, flat: Vec<TypeId>) -> TypeId
Intern a union type from a vector that is already sorted and deduped. This is an O(N) operation that avoids redundant sorting.
Sourcepub fn union_preserve_members(&self, members: Vec<TypeId>) -> TypeId
pub fn union_preserve_members(&self, members: Vec<TypeId>) -> TypeId
Intern a union type while preserving member structure.
This keeps unknown/literal members intact for property access checks.
Sourcepub fn union2(&self, left: TypeId, right: TypeId) -> TypeId
pub fn union2(&self, left: TypeId, right: TypeId) -> TypeId
Fast path for unions that already fit in registers.
Sourcepub fn union3(&self, first: TypeId, second: TypeId, third: TypeId) -> TypeId
pub fn union3(&self, first: TypeId, second: TypeId, third: TypeId) -> TypeId
Fast path for three-member unions without heap allocations.
Sourcepub fn intersection(&self, members: Vec<TypeId>) -> TypeId
pub fn intersection(&self, members: Vec<TypeId>) -> TypeId
Intern an intersection type, normalizing and deduplicating members
Sourcepub fn intersection2(&self, left: TypeId, right: TypeId) -> TypeId
pub fn intersection2(&self, left: TypeId, right: TypeId) -> TypeId
Fast path for two-member intersections.
Sourcepub fn intersect_types_raw(&self, members: Vec<TypeId>) -> TypeId
pub fn intersect_types_raw(&self, members: Vec<TypeId>) -> TypeId
Create an intersection type WITHOUT triggering normalize_intersection
This is a low-level operation used by the SubtypeChecker to merge
properties from intersection members without causing infinite recursion.
§Safety
Only use this when you need to synthesize a type for intermediate checking. Do NOT use for final compiler output (like .d.ts generation) as the resulting type will be “unsimplified”.
Sourcepub fn intersect_types_raw2(&self, a: TypeId, b: TypeId) -> TypeId
pub fn intersect_types_raw2(&self, a: TypeId, b: TypeId) -> TypeId
Convenience wrapper for raw intersection of two types
Sourcepub fn readonly_array(&self, element: TypeId) -> TypeId
pub fn readonly_array(&self, element: TypeId) -> TypeId
Intern a readonly array type Returns a distinct type from mutable arrays to enforce readonly semantics
Sourcepub fn tuple(&self, elements: Vec<TupleElement>) -> TypeId
pub fn tuple(&self, elements: Vec<TupleElement>) -> TypeId
Intern a tuple type
Sourcepub fn readonly_tuple(&self, elements: Vec<TupleElement>) -> TypeId
pub fn readonly_tuple(&self, elements: Vec<TupleElement>) -> TypeId
Intern a readonly tuple type Returns a distinct type from mutable tuples to enforce readonly semantics
Sourcepub fn readonly_type(&self, inner: TypeId) -> TypeId
pub fn readonly_type(&self, inner: TypeId) -> TypeId
Wrap any type in a ReadonlyType marker
This is used for the readonly type operator
Sourcepub fn unique_symbol(&self, symbol: SymbolRef) -> TypeId
pub fn unique_symbol(&self, symbol: SymbolRef) -> TypeId
Create a unique symbol type for a symbol declaration.
Sourcepub fn infer(&self, info: TypeParamInfo) -> TypeId
pub fn infer(&self, info: TypeParamInfo) -> TypeId
Create an infer binder with the provided info.
pub fn bound_parameter(&self, index: u32) -> TypeId
pub fn recursive(&self, depth: u32) -> TypeId
Sourcepub fn index_access(&self, object_type: TypeId, index_type: TypeId) -> TypeId
pub fn index_access(&self, object_type: TypeId, index_type: TypeId) -> TypeId
Build an indexed access type (T[K]).
Sourcepub fn enum_type(&self, def_id: DefId, structural_type: TypeId) -> TypeId
pub fn enum_type(&self, def_id: DefId, structural_type: TypeId) -> TypeId
Build a nominal enum type that preserves DefId identity and carries
structural member information for compatibility with primitive relations.
Sourcepub fn object(&self, properties: Vec<PropertyInfo>) -> TypeId
pub fn object(&self, properties: Vec<PropertyInfo>) -> TypeId
Intern an object type with properties.
Sourcepub fn object_fresh(&self, properties: Vec<PropertyInfo>) -> TypeId
pub fn object_fresh(&self, properties: Vec<PropertyInfo>) -> TypeId
Intern a fresh object type with properties.
Sourcepub fn object_with_flags(
&self,
properties: Vec<PropertyInfo>,
flags: ObjectFlags,
) -> TypeId
pub fn object_with_flags( &self, properties: Vec<PropertyInfo>, flags: ObjectFlags, ) -> TypeId
Intern an object type with properties and custom flags.
Sourcepub fn object_with_flags_and_symbol(
&self,
properties: Vec<PropertyInfo>,
flags: ObjectFlags,
symbol: Option<SymbolId>,
) -> TypeId
pub fn object_with_flags_and_symbol( &self, properties: Vec<PropertyInfo>, flags: ObjectFlags, symbol: Option<SymbolId>, ) -> TypeId
Intern an object type with properties, custom flags, and optional symbol. This is used for interfaces that need symbol tracking but no index signatures.
Sourcepub fn object_with_index(&self, shape: ObjectShape) -> TypeId
pub fn object_with_index(&self, shape: ObjectShape) -> TypeId
Intern an object type with index signatures.
Sourcepub fn function(&self, shape: FunctionShape) -> TypeId
pub fn function(&self, shape: FunctionShape) -> TypeId
Intern a function type
Sourcepub fn callable(&self, shape: CallableShape) -> TypeId
pub fn callable(&self, shape: CallableShape) -> TypeId
Intern a callable type with overloaded signatures
Sourcepub fn conditional(&self, conditional: ConditionalType) -> TypeId
pub fn conditional(&self, conditional: ConditionalType) -> TypeId
Intern a conditional type
Sourcepub fn mapped(&self, mapped: MappedType) -> TypeId
pub fn mapped(&self, mapped: MappedType) -> TypeId
Intern a mapped type
Sourcepub fn string_intrinsic(
&self,
kind: StringIntrinsicKind,
type_arg: TypeId,
) -> TypeId
pub fn string_intrinsic( &self, kind: StringIntrinsicKind, type_arg: TypeId, ) -> TypeId
Build a string intrinsic (Uppercase, Lowercase, etc.) marker.
Sourcepub fn reference(&self, symbol: SymbolRef) -> TypeId
pub fn reference(&self, symbol: SymbolRef) -> TypeId
Intern a type reference (deprecated - use lazy() with DefId instead).
This method is kept for backward compatibility with tests and legacy code.
It converts SymbolRef to DefId and creates TypeData::Lazy.
Deprecated: new code should use lazy(def_id) instead.
Sourcepub fn lazy(&self, def_id: DefId) -> TypeId
pub fn lazy(&self, def_id: DefId) -> TypeId
Intern a lazy type reference (DefId-based).
This is the replacement for reference() that uses Solver-owned
DefIds instead of Binder-owned SymbolRefs.
Use this method for all new type references to enable O(1) type equality across Binder and Solver boundaries.
Sourcepub fn type_param(&self, info: TypeParamInfo) -> TypeId
pub fn type_param(&self, info: TypeParamInfo) -> TypeId
Intern a type parameter.
Sourcepub fn type_query(&self, symbol: SymbolRef) -> TypeId
pub fn type_query(&self, symbol: SymbolRef) -> TypeId
Intern a type query (typeof value) marker.
Trait Implementations§
Source§impl Debug for TypeInterner
impl Debug for TypeInterner
Source§impl Default for TypeInterner
impl Default for TypeInterner
Source§impl QueryDatabase for TypeInterner
impl QueryDatabase for TypeInterner
Source§fn as_type_database(&self) -> &dyn TypeDatabase
fn as_type_database(&self) -> &dyn TypeDatabase
TypeDatabase view for legacy entry points.Source§fn register_array_base_type(
&self,
type_id: TypeId,
type_params: Vec<TypeParamInfo>,
)
fn register_array_base_type( &self, type_id: TypeId, type_params: Vec<TypeParamInfo>, )
Array<T> base type used by property access resolution. Read moreSource§fn register_boxed_type(&self, kind: IntrinsicKind, type_id: TypeId)
fn register_boxed_type(&self, kind: IntrinsicKind, type_id: TypeId)
Source§fn get_index_signatures(&self, type_id: TypeId) -> IndexInfo
fn get_index_signatures(&self, type_id: TypeId) -> IndexInfo
Source§fn is_nullish_type(&self, type_id: TypeId) -> bool
fn is_nullish_type(&self, type_id: TypeId) -> bool
Source§fn remove_nullish(&self, type_id: TypeId) -> TypeId
fn remove_nullish(&self, type_id: TypeId) -> TypeId
Source§fn is_assignable_to(&self, source: TypeId, target: TypeId) -> bool
fn is_assignable_to(&self, source: TypeId, target: TypeId) -> bool
Source§fn is_assignable_to_with_flags(
&self,
source: TypeId,
target: TypeId,
flags: u16,
) -> bool
fn is_assignable_to_with_flags( &self, source: TypeId, target: TypeId, flags: u16, ) -> bool
fn resolve_property_access( &self, object_type: TypeId, prop_name: &str, ) -> PropertyAccessResult
fn resolve_property_access_with_options( &self, object_type: TypeId, prop_name: &str, no_unchecked_indexed_access: bool, ) -> PropertyAccessResult
Source§fn get_type_param_variance(&self, _def_id: DefId) -> Option<Arc<[Variance]>>
fn get_type_param_variance(&self, _def_id: DefId) -> Option<Arc<[Variance]>>
Source§fn canonical_id(&self, type_id: TypeId) -> TypeId
fn canonical_id(&self, type_id: TypeId) -> TypeId
TypeId for a type, achieving O(1) structural identity checks. Read moreSource§fn factory(&self) -> TypeFactory<'_>
fn factory(&self) -> TypeFactory<'_>
fn evaluate_conditional(&self, cond: &ConditionalType) -> TypeId
fn evaluate_index_access( &self, object_type: TypeId, index_type: TypeId, ) -> TypeId
fn evaluate_index_access_with_options( &self, object_type: TypeId, index_type: TypeId, no_unchecked_indexed_access: bool, ) -> TypeId
fn evaluate_type(&self, type_id: TypeId) -> TypeId
fn evaluate_type_with_options( &self, type_id: TypeId, no_unchecked_indexed_access: bool, ) -> TypeId
fn evaluate_mapped(&self, mapped: &MappedType) -> TypeId
Source§fn lookup_application_eval_cache(
&self,
_def_id: DefId,
_args: &[TypeId],
_no_unchecked_indexed_access: bool,
) -> Option<TypeId>
fn lookup_application_eval_cache( &self, _def_id: DefId, _args: &[TypeId], _no_unchecked_indexed_access: bool, ) -> Option<TypeId>
Source§fn insert_application_eval_cache(
&self,
_def_id: DefId,
_args: &[TypeId],
_no_unchecked_indexed_access: bool,
_result: TypeId,
)
fn insert_application_eval_cache( &self, _def_id: DefId, _args: &[TypeId], _no_unchecked_indexed_access: bool, _result: TypeId, )
fn evaluate_keyof(&self, operand: TypeId) -> TypeId
fn narrow(&self, type_id: TypeId, narrower: TypeId) -> TypeIdwhere
Self: Sized,
fn property_access_type( &self, object_type: TypeId, prop_name: &str, ) -> PropertyAccessResult
fn no_unchecked_indexed_access(&self) -> bool
fn set_no_unchecked_indexed_access(&self, _enabled: bool)
fn contextual_property_type( &self, expected: TypeId, prop_name: &str, ) -> Option<TypeId>
fn is_property_readonly(&self, object_type: TypeId, prop_name: &str) -> bool
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
fn resolve_element_access( &self, object_type: TypeId, index_type: TypeId, literal_index: Option<usize>, ) -> ElementAccessResult
Source§fn resolve_element_access_type(
&self,
object_type: TypeId,
index_type: TypeId,
literal_index: Option<usize>,
) -> TypeId
fn resolve_element_access_type( &self, object_type: TypeId, index_type: TypeId, literal_index: Option<usize>, ) -> TypeId
Source§fn collect_object_spread_properties(
&self,
spread_type: TypeId,
) -> Vec<PropertyInfo>
fn collect_object_spread_properties( &self, spread_type: TypeId, ) -> Vec<PropertyInfo>
Source§fn is_subtype_of(&self, source: TypeId, target: TypeId) -> bool
fn is_subtype_of(&self, source: TypeId, target: TypeId) -> bool
Source§fn is_subtype_of_with_flags(
&self,
source: TypeId,
target: TypeId,
flags: u16,
) -> bool
fn is_subtype_of_with_flags( &self, source: TypeId, target: TypeId, flags: u16, ) -> bool
Source§fn lookup_subtype_cache(&self, _key: RelationCacheKey) -> Option<bool>
fn lookup_subtype_cache(&self, _key: RelationCacheKey) -> Option<bool>
None if the result is not cached.
Default implementation returns None (no caching).Source§fn insert_subtype_cache(&self, _key: RelationCacheKey, _result: bool)
fn insert_subtype_cache(&self, _key: RelationCacheKey, _result: bool)
Source§fn lookup_assignability_cache(&self, _key: RelationCacheKey) -> Option<bool>
fn lookup_assignability_cache(&self, _key: RelationCacheKey) -> Option<bool>
None if the result is not cached.
Default implementation returns None (no caching).Source§fn insert_assignability_cache(&self, _key: RelationCacheKey, _result: bool)
fn insert_assignability_cache(&self, _key: RelationCacheKey, _result: bool)
fn new_inference_context(&self) -> InferenceContext<'_>
Source§impl TypeDatabase for TypeInterner
impl TypeDatabase for TypeInterner
fn intern(&self, key: TypeData) -> TypeId
fn lookup(&self, id: TypeId) -> Option<TypeData>
fn intern_string(&self, s: &str) -> Atom
fn resolve_atom(&self, atom: Atom) -> String
fn resolve_atom_ref(&self, atom: Atom) -> Arc<str>
fn type_list(&self, id: TypeListId) -> Arc<[TypeId]>
fn tuple_list(&self, id: TupleListId) -> Arc<[TupleElement]>
fn template_list(&self, id: TemplateLiteralId) -> Arc<[TemplateSpan]>
fn object_shape(&self, id: ObjectShapeId) -> Arc<ObjectShape>
fn object_property_index( &self, shape_id: ObjectShapeId, name: Atom, ) -> PropertyLookup
fn function_shape(&self, id: FunctionShapeId) -> Arc<FunctionShape>
fn callable_shape(&self, id: CallableShapeId) -> Arc<CallableShape>
fn conditional_type(&self, id: ConditionalTypeId) -> Arc<ConditionalType>
fn mapped_type(&self, id: MappedTypeId) -> Arc<MappedType>
fn type_application(&self, id: TypeApplicationId) -> Arc<TypeApplication>
fn literal_string(&self, value: &str) -> TypeId
fn literal_number(&self, value: f64) -> TypeId
fn literal_boolean(&self, value: bool) -> TypeId
fn literal_bigint(&self, value: &str) -> TypeId
fn literal_bigint_with_sign(&self, negative: bool, digits: &str) -> TypeId
fn union(&self, members: Vec<TypeId>) -> TypeId
fn union_from_sorted_vec(&self, flat: Vec<TypeId>) -> TypeId
fn union2(&self, left: TypeId, right: TypeId) -> TypeId
fn union3(&self, first: TypeId, second: TypeId, third: TypeId) -> TypeId
fn intersection(&self, members: Vec<TypeId>) -> TypeId
fn intersection2(&self, left: TypeId, right: TypeId) -> TypeId
Source§fn intersect_types_raw2(&self, left: TypeId, right: TypeId) -> TypeId
fn intersect_types_raw2(&self, left: TypeId, right: TypeId) -> TypeId
fn array(&self, element: TypeId) -> TypeId
fn tuple(&self, elements: Vec<TupleElement>) -> TypeId
fn object(&self, properties: Vec<PropertyInfo>) -> TypeId
fn object_with_flags( &self, properties: Vec<PropertyInfo>, flags: ObjectFlags, ) -> TypeId
fn object_with_flags_and_symbol( &self, properties: Vec<PropertyInfo>, flags: ObjectFlags, symbol: Option<SymbolId>, ) -> TypeId
fn object_with_index(&self, shape: ObjectShape) -> TypeId
fn function(&self, shape: FunctionShape) -> TypeId
fn callable(&self, shape: CallableShape) -> TypeId
fn template_literal(&self, spans: Vec<TemplateSpan>) -> TypeId
fn conditional(&self, conditional: ConditionalType) -> TypeId
fn mapped(&self, mapped: MappedType) -> TypeId
fn reference(&self, symbol: SymbolRef) -> TypeId
fn lazy(&self, def_id: DefId) -> TypeId
fn bound_parameter(&self, index: u32) -> TypeId
fn recursive(&self, depth: u32) -> TypeId
fn type_param(&self, info: TypeParamInfo) -> TypeId
fn type_query(&self, symbol: SymbolRef) -> TypeId
fn enum_type(&self, def_id: DefId, structural_type: TypeId) -> TypeId
fn application(&self, base: TypeId, args: Vec<TypeId>) -> TypeId
fn literal_string_atom(&self, atom: Atom) -> TypeId
fn union_preserve_members(&self, members: Vec<TypeId>) -> TypeId
fn readonly_type(&self, inner: TypeId) -> TypeId
fn keyof(&self, inner: TypeId) -> TypeId
fn index_access(&self, object_type: TypeId, index_type: TypeId) -> TypeId
fn this_type(&self) -> TypeId
fn no_infer(&self, inner: TypeId) -> TypeId
fn unique_symbol(&self, symbol: SymbolRef) -> TypeId
fn infer(&self, info: TypeParamInfo) -> TypeId
fn string_intrinsic( &self, kind: StringIntrinsicKind, type_arg: TypeId, ) -> TypeId
Source§fn get_class_base_type(&self, _symbol_id: SymbolId) -> Option<TypeId>
fn get_class_base_type(&self, _symbol_id: SymbolId) -> Option<TypeId>
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
fn is_identity_comparable_type(&self, type_id: TypeId) -> bool
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.fn object_fresh(&self, properties: Vec<PropertyInfo>) -> TypeId
Source§impl TypeResolver for TypeInterner
Implement TypeResolver for TypeInterner with noop resolution.
impl TypeResolver for TypeInterner
Implement TypeResolver for TypeInterner with noop resolution.
TypeInterner 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 TypeInterner’s own inherent methods.
Source§fn resolve_ref(
&self,
_symbol: SymbolRef,
_interner: &dyn TypeDatabase,
) -> Option<TypeId>
fn resolve_ref( &self, _symbol: SymbolRef, _interner: &dyn TypeDatabase, ) -> Option<TypeId>
Source§fn get_boxed_type(&self, kind: IntrinsicKind) -> Option<TypeId>
fn get_boxed_type(&self, kind: IntrinsicKind) -> Option<TypeId>
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>
fn get_array_base_type(&self) -> Option<TypeId>
Source§fn get_array_base_type_params(&self) -> &[TypeParamInfo]
fn get_array_base_type_params(&self) -> &[TypeParamInfo]
Source§fn resolve_symbol_ref(
&self,
symbol: SymbolRef,
interner: &dyn TypeDatabase,
) -> Option<TypeId>
fn resolve_symbol_ref( &self, symbol: SymbolRef, interner: &dyn TypeDatabase, ) -> Option<TypeId>
Source§fn resolve_lazy(
&self,
_def_id: DefId,
_interner: &dyn TypeDatabase,
) -> Option<TypeId>
fn resolve_lazy( &self, _def_id: DefId, _interner: &dyn TypeDatabase, ) -> Option<TypeId>
DefId reference to its structural type. Read moreSource§fn get_type_params(&self, _symbol: SymbolRef) -> Option<Vec<TypeParamInfo>>
fn get_type_params(&self, _symbol: SymbolRef) -> Option<Vec<TypeParamInfo>>
Source§fn get_lazy_type_params(&self, _def_id: DefId) -> Option<Vec<TypeParamInfo>>
fn get_lazy_type_params(&self, _def_id: DefId) -> Option<Vec<TypeParamInfo>>
DefId (for generic type aliases/interfaces). Read moreSource§fn is_boxed_def_id(&self, _def_id: DefId, _kind: IntrinsicKind) -> bool
fn is_boxed_def_id(&self, _def_id: DefId, _kind: IntrinsicKind) -> bool
DefId corresponds to a boxed type for the given intrinsic kind.Source§fn is_boxed_type_id(&self, _type_id: TypeId, _kind: IntrinsicKind) -> bool
fn is_boxed_type_id(&self, _type_id: TypeId, _kind: IntrinsicKind) -> bool
TypeId is any known resolved form of a boxed type. Read moreSource§fn get_lazy_export(&self, _def_id: DefId, _name: Atom) -> Option<TypeId>
fn get_lazy_export(&self, _def_id: DefId, _name: Atom) -> Option<TypeId>
Source§fn get_lazy_enum_member(&self, _def_id: DefId, _name: Atom) -> Option<TypeId>
fn get_lazy_enum_member(&self, _def_id: DefId, _name: Atom) -> Option<TypeId>
DefId. Read moreSource§fn is_numeric_enum(&self, _def_id: DefId) -> bool
fn is_numeric_enum(&self, _def_id: DefId) -> bool
DefId corresponds to a numeric enum (not a string enum). Read moreSource§fn is_enum_type(&self, _type_id: TypeId, _interner: &dyn TypeDatabase) -> bool
fn is_enum_type(&self, _type_id: TypeId, _interner: &dyn TypeDatabase) -> bool
TypeId represents a full Enum type (not a specific member).Source§fn is_user_enum_def(&self, _def_id: DefId) -> bool
fn is_user_enum_def(&self, _def_id: DefId) -> bool
DefId represents a user-defined enum (not an intrinsic type).