Skip to main content

Subtyping

Struct Subtyping 

Source
pub struct Subtyping { /* private fields */ }

Implementations§

Source§

impl Subtyping

Source

pub fn bind_generic( &mut self, env: &mut SubtypingEnvironment, sub_ty: TypeId, super_ty: TypeId, ) -> bool

Source§

impl Subtyping

Source

pub fn cache( &mut self, _env: &mut SubtypingEnvironment, result: SubtypingResult, sub_ty: TypeId, super_ty: TypeId, ) -> SubtypingResult

Source§

impl Subtyping

Source

pub fn subtyping_check_generic_bounds( &mut self, bounds: &GenericBounds, env: &mut SubtypingEnvironment, scope: *mut Scope, generic_name: &str, ) -> SubtypingResult

Source§

impl Subtyping

Source§

impl Subtyping

Source

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, ) -> SubtypingResult
where SubTy: IntoCovOperand, SuperTy: IntoCovOperand,

Source§

impl Subtyping

Source§

impl Subtyping

Source

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

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source

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

Source§

impl Subtyping

Source§

impl Subtyping

Source

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

Source

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, ) -> SubtypingResult
where SubTy: IntoCovOperand, SuperTy: IntoCovOperand,

Source§

impl Subtyping

Source§

impl Subtyping

Source

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

Source

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

Source

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

Source

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

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source

pub fn make_aggregate_type<T, Container>( &mut self, container: &Container, or_else: TypeId, ) -> TypeId
where Container: AsRef<[TypeId]>, T: From<Vec<TypeId>> + Into<Type> + 'static,

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

Source

pub fn maybe_update_bounds( &mut self, here: TypeId, there: TypeId, bounds_to_update: &mut TypeIds, first_bounds_to_check: &TypeIds, second_bounds_to_check: &TypeIds, )

Source§

impl Subtyping

Source

pub fn operator_assign(&mut self, _other: &Subtyping)

Source§

impl Subtyping

Source

pub fn operator_assign_mut(&mut self, other: Subtyping)

Source§

impl Subtyping

Source§

impl Subtyping

Source

pub fn subtyping_subtyping(&mut self)

@delete

Source§

impl Subtyping

Source§

impl Subtyping

Source§

impl Subtyping

Source

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

Source

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§

Source§

impl Clone for Subtyping

Source§

fn clone(&self) -> Subtyping

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Subtyping

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.