luaur_analysis/methods/
constraint_solver_unblock_constraint_solver.rs1use crate::records::constraint_solver::ConstraintSolver;
2use crate::type_aliases::blocked_constraint_id::BlockedConstraintId;
3use crate::type_aliases::bound_type::BoundType;
4use crate::type_aliases::type_id::TypeId;
5use luaur_ast::records::location::Location;
6use luaur_common::records::dense_hash_set::DenseHashSet;
7use luaur_common::FFlag;
8
9impl ConstraintSolver {
10 pub fn unblock_type_id_location(&mut self, ty: TypeId, location: Location) {
11 let mut seen: DenseHashSet<TypeId> = DenseHashSet::new(core::ptr::null());
12 let mut progressed = ty;
13
14 loop {
15 if seen.contains(&progressed) {
16 self.ice_reporter.ice_string_location(
17 "ConstraintSolver::unblock encountered a self-bound type!",
18 &location,
19 );
20 }
21 seen.insert(progressed);
22
23 if let Some(logger) = unsafe { self.logger.as_mut() } {
24 logger.pop_block_type_id(progressed);
25 }
26
27 if !FFlag::LuauConstraintGraph.get() {
28 self.deprecate_d_unblock_(BlockedConstraintId::V0(progressed));
29 }
30
31 let bound =
32 unsafe { crate::functions::get_type_alt_j::get_type_id::<BoundType>(progressed) };
33 if bound.is_null() {
34 break;
35 }
36
37 progressed = unsafe { (*bound).boundTo };
38 }
39
40 if FFlag::LuauConstraintGraph.get() {
41 unsafe {
42 (*self.cgraph).unblock_type_or_pack_type_id(ty);
43 }
44 }
45 }
46}