Skip to main content

luaur_analysis/methods/
constraint_solver_try_dispatch_constraint_solver_alt_u.rs

1use crate::records::constraint::Constraint;
2use crate::records::constraint_solver::ConstraintSolver;
3use crate::records::type_instantiation_constraint::TypeInstantiationConstraint;
4use luaur_common::macros::luau_assert::LUAU_ASSERT;
5use luaur_common::FFlag::LuauExplicitTypeInstantiationSupport;
6
7impl ConstraintSolver {
8    pub fn try_dispatch_type_instantiation_constraint_not_null_constraint(
9        &mut self,
10        c: &TypeInstantiationConstraint,
11        constraint: *const Constraint,
12    ) -> bool {
13        LUAU_ASSERT!(LuauExplicitTypeInstantiationSupport.get());
14
15        if self.is_blocked_type_id(c.function_type) {
16            return self.block_type_id_not_null_constraint(c.function_type, constraint);
17        }
18
19        let bound_to = self.instantiate_function_type(
20            c.function_type,
21            &c.type_arguments,
22            &c.type_pack_arguments,
23            unsafe { (*constraint).scope },
24            unsafe { &(*constraint).location },
25        );
26        self.bind_not_null_constraint_type_id_type_id(constraint, c.placeholder_type, bound_to);
27
28        true
29    }
30}