pub struct Subtyping { /* private fields */ }Implementations§
Source§impl Subtyping
impl Subtyping
pub fn bind_generic( &mut self, env: &mut SubtypingEnvironment, sub_ty: TypeId, super_ty: TypeId, ) -> bool
Source§impl Subtyping
impl Subtyping
pub fn cache( &mut self, _env: &mut SubtypingEnvironment, result: SubtypingResult, sub_ty: TypeId, super_ty: TypeId, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn subtyping_check_generic_bounds( &mut self, bounds: &GenericBounds, env: &mut SubtypingEnvironment, scope: *mut Scope, generic_name: &str, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn handle_type_function_reduction_result( &mut self, function_instance: &TypeFunctionInstanceType, scope: *mut Scope, ) -> (TypeId, ErrorVec)
Source§impl Subtyping
impl Subtyping
pub fn is_contravariant_with_subtyping_environment_sub_ty_super_ty_not_null_scope<SubTy, SuperTy>(
&mut self,
env: &mut SubtypingEnvironment,
sub_ty: SubTy,
super_ty: SuperTy,
scope: *mut Scope,
) -> SubtypingResultwhere
SubTy: IntoCovOperand,
SuperTy: IntoCovOperand,
Source§impl Subtyping
impl Subtyping
pub fn is_contravariant_with_subtyping_environment_try_pair_sub_ty_super_ty_not_null_scope<SubTy, SuperTy>( &mut self, env: &mut SubtypingEnvironment, pair: &TryPair<*const SubTy, *const SuperTy>, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_deprecated( &mut self, env: &mut SubtypingEnvironment, sub_table: &TableType, super_table: &TableType, force_covariant_test: bool, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_type_id_type_id_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_ty: TypeId, super_ty: TypeId, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_normalized_extern_type_type_ids_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_extern_type: &NormalizedExternType, super_tables: &TypeIds, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_normalized_string_type_normalized_string_type_not_null_scope( &mut self, _env: &mut SubtypingEnvironment, sub_string: &NormalizedStringType, super_string: &NormalizedStringType, _scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_normalized_string_type_type_ids_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_string: &NormalizedStringType, super_tables: &TypeIds, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_normalized_function_type_normalized_function_type_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_function: &NormalizedFunctionType, super_function: &NormalizedFunctionType, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_type_ids_type_ids_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_types: &TypeIds, super_types: &TypeIds, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_variadic_type_pack_variadic_type_pack_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_variadic: &VariadicTypePack, super_variadic: &VariadicTypePack, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_type_function_instance_type_type_id_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_function_instance: &TypeFunctionInstanceType, super_ty: TypeId, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_type_id_type_function_instance_type_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_ty: TypeId, super_function_instance: &TypeFunctionInstanceType, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_type_pack_id_type_pack_id_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_tp: TypePackId, super_tp: TypePackId, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_try_pair_sub_ty_super_ty_not_null_scope<SubTy, SuperTy>( &mut self, env: &mut SubtypingEnvironment, pair: &TryPair<*const SubTy, *const SuperTy>, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_type_id_union_type_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_ty: TypeId, super_union: &UnionType, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_union_type_type_id_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_union: &UnionType, super_ty: TypeId, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_type_id_intersection_type_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_ty: TypeId, super_intersection: &IntersectionType, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_intersection_type_type_id_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_intersection: &IntersectionType, super_ty: TypeId, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_negation_type_type_id_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_negation: &NegationType, super_ty: TypeId, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_type_id_negation_type_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_ty: TypeId, super_negation: &NegationType, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_primitive_type_primitive_type_not_null_scope( &mut self, _env: &mut SubtypingEnvironment, sub_prim: &PrimitiveType, super_prim: &PrimitiveType, _scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_singleton_type_primitive_type_not_null_scope( &mut self, _env: &mut SubtypingEnvironment, sub_singleton: &SingletonType, super_prim: &PrimitiveType, _scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_singleton_type_singleton_type_not_null_scope( &mut self, _env: &mut SubtypingEnvironment, sub_singleton: &SingletonType, super_singleton: &SingletonType, _scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_table_type_table_type_bool_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_table: &TableType, super_table: &TableType, force_covariant_test: bool, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_metatable_type_metatable_type_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_mt: &MetatableType, super_mt: &MetatableType, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_metatable_type_table_type_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_mt: &MetatableType, super_table: &TableType, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_metatable_type_primitive_type_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_mt: &MetatableType, super_prim: &PrimitiveType, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_extern_type_extern_type_not_null_scope( &mut self, _env: &mut SubtypingEnvironment, sub_extern_type: &ExternType, super_extern_type: &ExternType, _scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_type_id_extern_type_type_id_table_type_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_ty: TypeId, sub_extern_type: &ExternType, super_ty: TypeId, super_table: &TableType, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_function_type_function_type_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_function: &FunctionType, super_function: &FunctionType, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_table_type_primitive_type_not_null_scope( &mut self, _env: &mut SubtypingEnvironment, _sub_table: &TableType, super_prim: &PrimitiveType, _scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_primitive_type_table_type_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_prim: &PrimitiveType, super_table: &TableType, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_singleton_type_table_type_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_singleton: &SingletonType, super_table: &TableType, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_table_indexer_table_indexer_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_indexer: &TableIndexer, super_indexer: &TableIndexer, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_property_property_string_bool_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_prop: &Property, super_prop: &Property, name: &str, force_covariant_test: bool, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_subtyping_environment_normalized_extern_type_normalized_extern_type_not_null_scope( &mut self, env: &mut SubtypingEnvironment, sub_extern_type: &NormalizedExternType, super_extern_type: &NormalizedExternType, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_covariant_with_super_tail( &mut self, env: &mut SubtypingEnvironment, output_result: &mut SubtypingResult, sub_tp: TypePackId, sub_head_start_index: usize, sub_head: &Vec<TypeId>, sub_tail: Option<TypePackId>, super_tp: TypePackId, super_tail: TypePackId, scope: *mut Scope, ) -> EarlyExit
Source§impl Subtyping
impl Subtyping
pub fn is_invariant_with_subtyping_environment_sub_ty_super_ty_not_null_scope<SubTy, SuperTy>(
&mut self,
env: &mut SubtypingEnvironment,
sub_ty: SubTy,
super_ty: SuperTy,
scope: *mut Scope,
) -> SubtypingResultwhere
SubTy: IntoCovOperand,
SuperTy: IntoCovOperand,
Source§impl Subtyping
impl Subtyping
pub fn is_invariant_with_subtyping_environment_try_pair_sub_ty_super_ty_not_null_scope<SubTy, SuperTy>( &mut self, env: &mut SubtypingEnvironment, pair: &TryPair<*const SubTy, *const SuperTy>, _scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_sub_tail_covariant_with( &mut self, env: &mut SubtypingEnvironment, output_result: &mut SubtypingResult, sub_tp: TypePackId, sub_tail: TypePackId, super_tp: TypePackId, super_head_start_index: usize, super_head: &Vec<TypeId>, super_tail: Option<TypePackId>, scope: *mut Scope, ) -> EarlyExit
Source§impl Subtyping
impl Subtyping
pub fn is_subtype_type_id_type_id_not_null_scope( &mut self, sub_ty: TypeId, super_ty: TypeId, scope: *mut Scope, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
Sourcepub fn is_subtype_type_pack_id_type_pack_id_not_null_scope_vector_type_id(
&mut self,
sub_tp: TypePackId,
super_tp: TypePackId,
scope: *mut Scope,
bindable_generics: &Vec<TypeId>,
) -> SubtypingResult
pub fn is_subtype_type_pack_id_type_pack_id_not_null_scope_vector_type_id( &mut self, sub_tp: TypePackId, super_tp: TypePackId, scope: *mut Scope, bindable_generics: &Vec<TypeId>, ) -> SubtypingResult
C++:
SubtypingResult Subtyping::isSubtype(TypePackId subTp, TypePackId superTp, NotNull<Scope> scope,
const std::vector<TypeId>& bindableGenerics)
{
const std::vector<TypePackId> bindableGenericPacks;
return isSubtype(subTp, superTp, scope, bindableGenerics, bindableGenericPacks);
}Source§impl Subtyping
impl Subtyping
Sourcepub fn is_subtype_type_pack_id_type_pack_id_not_null_scope_vector_type_id_vector_type_pack_id(
&mut self,
sub_tp: TypePackId,
super_tp: TypePackId,
scope: *mut Scope,
bindable_generics: &Vec<TypeId>,
bindable_generic_packs: &Vec<TypePackId>,
) -> SubtypingResult
pub fn is_subtype_type_pack_id_type_pack_id_not_null_scope_vector_type_id_vector_type_pack_id( &mut self, sub_tp: TypePackId, super_tp: TypePackId, scope: *mut Scope, bindable_generics: &Vec<TypeId>, bindable_generic_packs: &Vec<TypePackId>, ) -> SubtypingResult
C++:
SubtypingResult Subtyping::isSubtype(
TypePackId subTp, TypePackId superTp, NotNull<Scope> scope,
const std::vector<TypeId>& bindableGenerics,
const std::vector<TypePackId>& bindableGenericPacks)
{
SubtypingEnvironment env;
for (TypeId g : bindableGenerics)
env.mappedGenerics[follow(g)] = {SubtypingEnvironment::GenericBounds{}};
env.mappedGenericPacks.pushFrame(bindableGenericPacks);
SubtypingResult result = isCovariantWith(env, subTp, superTp, scope);
for (TypeId bg : bindableGenerics) {
bg = follow(bg);
LUAU_ASSERT(env.mappedGenerics.contains(bg));
if (const std::vector<SubtypingEnvironment::GenericBounds>* bounds = env.mappedGenerics.find(bg)) {
LUAU_ASSERT(bounds->size() == 1);
if (bounds->empty()) continue;
if (const GenericType* gen = get<GenericType>(bg))
result.andAlso(checkGenericBounds(bounds->back(), env, scope, gen->name));
}
}
return result;
}Source§impl Subtyping
impl Subtyping
pub fn is_tail_covariant_with_tail_subtyping_environment_not_null_scope_type_pack_id_variadic_type_pack_type_pack_id_variadic_type_pack( &mut self, env: &mut SubtypingEnvironment, scope: *mut Scope, _sub_tp: TypePackId, sub: &VariadicTypePack, _super_tp: TypePackId, super_variadic: &VariadicTypePack, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_tail_covariant_with_tail_subtyping_environment_not_null_scope_type_pack_id_generic_type_pack_type_pack_id_generic_type_pack( &mut self, env: &mut SubtypingEnvironment, scope: *mut Scope, sub_tp: TypePackId, _sub: &GenericTypePack, super_tp: TypePackId, _super: &GenericTypePack, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_tail_covariant_with_tail_subtyping_environment_not_null_scope_type_pack_id_variadic_type_pack_type_pack_id_generic_type_pack( &mut self, env: &mut SubtypingEnvironment, scope: *mut Scope, sub_tp: TypePackId, _sub: &VariadicTypePack, super_tp: TypePackId, _super: &GenericTypePack, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_tail_covariant_with_tail_subtyping_environment_not_null_scope_type_pack_id_generic_type_pack_type_pack_id_variadic_type_pack( &mut self, env: &mut SubtypingEnvironment, scope: *mut Scope, sub_tp: TypePackId, _sub: &GenericTypePack, super_tp: TypePackId, super_variadic: &VariadicTypePack, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_tail_covariant_with_tail_subtyping_environment_not_null_scope_type_pack_id_generic_type_pack_nothing( &mut self, env: &mut SubtypingEnvironment, scope: *mut Scope, sub_tp: TypePackId, _sub: &GenericTypePack, _nothing: Nothing, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
pub fn is_tail_covariant_with_tail_subtyping_environment_not_null_scope_nothing_type_pack_id_generic_type_pack( &mut self, env: &mut SubtypingEnvironment, scope: *mut Scope, _nothing: Nothing, super_tp: TypePackId, _super: &GenericTypePack, ) -> SubtypingResult
Source§impl Subtyping
impl Subtyping
Sourcepub fn make_aggregate_type<T, Container>(
&mut self,
container: &Container,
or_else: TypeId,
) -> TypeId
pub fn make_aggregate_type<T, Container>( &mut self, container: &Container, or_else: TypeId, ) -> TypeId
C++:
template<typename T, typename Container>
TypeId Subtyping::makeAggregateType(const Container& container, TypeId orElse)
{
if (container.empty())
return orElse;
else if (container.size() == 1)
return *begin(container);
else
return arena->addType(T{std::vector<TypeId>(begin(container), end(container))});
}T is the aggregate type variant (e.g. UnionType / IntersectionType)
constructed from the gathered Vec<TypeId>; Container is any sequence
of TypeId (mirrors the C++ begin(container)/end(container) iteration).
Source§impl Subtyping
impl Subtyping
pub fn peek_cache( &self, ) -> &DenseHashMap<(TypeId, TypeId), SubtypingResult, TypePairHash>
Source§impl Subtyping
impl Subtyping
Sourcepub fn subtyping_subtyping(&mut self)
pub fn subtyping_subtyping(&mut self)
@delete
Source§impl Subtyping
impl Subtyping
pub fn subtyping_subtyping_mut(&mut self)
Source§impl Subtyping
impl Subtyping
pub fn subtyping_not_null_builtin_types_not_null_type_arena_not_null_normalizer_not_null_type_function_runtime_not_null_internal_error_reporter( &mut self, builtin_types: *mut BuiltinTypes, type_arena: *mut TypeArena, normalizer: *mut Normalizer, type_function_runtime: *mut TypeFunctionRuntime, ice_reporter: *mut InternalErrorReporter, )
Source§impl Subtyping
impl Subtyping
Sourcepub fn subtyping_owned(
builtin_types: *mut BuiltinTypes,
type_arena: *mut TypeArena,
normalizer: *mut Normalizer,
type_function_runtime: *mut TypeFunctionRuntime,
ice_reporter: *mut InternalErrorReporter,
) -> Self
pub fn subtyping_owned( builtin_types: *mut BuiltinTypes, type_arena: *mut TypeArena, normalizer: *mut Normalizer, type_function_runtime: *mut TypeFunctionRuntime, ice_reporter: *mut InternalErrorReporter, ) -> Self
C++ Subtyping::Subtyping(NotNull<BuiltinTypes>, NotNull<TypeArena>, NotNull<Normalizer>, NotNull<TypeFunctionRuntime>, NotNull<InternalErrorReporter>) — sets the five collaborators; every
other member is default-constructed.
Source§impl Subtyping
impl Subtyping
pub fn try_semantic_subtyping( &mut self, env: &mut SubtypingEnvironment, sub_ty: TypeId, super_ty: TypeId, scope: *mut Scope, original: &mut SubtypingResult, ) -> SubtypingResult
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Subtyping
impl !Send for Subtyping
impl !Sync for Subtyping
impl !UnwindSafe for Subtyping
impl Freeze for Subtyping
impl Unpin for Subtyping
impl UnsafeUnpin for Subtyping
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more