luaur_analysis/records/
constraint_solver.rs1use crate::records::builtin_types::BuiltinTypes;
4use crate::records::constraint::Constraint;
5use crate::records::constraint_graph::ConstraintGraph;
6use crate::records::constraint_set::ConstraintSet;
7use crate::records::data_flow_graph::DataFlowGraph;
8use crate::records::dcr_logger::DcrLogger;
9use crate::records::hash_blocked_constraint_id::HashBlockedConstraintId;
10use crate::records::hash_instantiation_signature::HashInstantiationSignature;
11use crate::records::hash_subtype_constraint_record::HashSubtypeConstraintRecord;
12use crate::records::instantiation_signature::InstantiationSignature;
13use crate::records::internal_error_reporter::InternalErrorReporter;
14use crate::records::module_resolver::ModuleResolver;
15use crate::records::normalizer::Normalizer;
16use crate::records::require_cycle::RequireCycle;
17use crate::records::scope::Scope;
18use crate::records::subtype_constraint_record::SubtypeConstraintRecord;
19use crate::records::subtyping::Subtyping;
20use crate::records::to_string_options::ToStringOptions;
21use crate::records::type_arena::TypeArena;
22use crate::records::type_check_limits::TypeCheckLimits;
23use crate::records::type_function_runtime::TypeFunctionRuntime;
24use crate::records::type_ids::TypeIds;
25use crate::type_aliases::blocked_constraint_id::BlockedConstraintId;
26use crate::type_aliases::error_vec::ErrorVec;
27use crate::type_aliases::module_ptr_module::ModulePtr;
28use crate::type_aliases::type_id::TypeId;
29use alloc::boxed::Box;
30use alloc::vec::Vec;
31use luaur_ast::records::location::Location;
32use luaur_common::records::dense_hash_map::DenseHashMap;
33use luaur_common::records::dense_hash_set::DenseHashSet;
34use std::collections::{HashMap, HashSet};
35
36#[derive(Debug)]
37pub struct ConstraintSolver {
38 pub arena: *mut TypeArena,
39 pub builtin_types: *mut BuiltinTypes,
40 pub ice_reporter: InternalErrorReporter,
41 pub normalizer: *mut Normalizer,
42 pub type_function_runtime: *mut TypeFunctionRuntime,
43 pub constraint_set: ConstraintSet,
44 pub constraints: Vec<*mut Constraint>,
45 pub scope_to_function: *mut DenseHashMap<*mut Scope, TypeId>,
46 pub root_scope: *mut Scope,
47 pub module: Option<ModulePtr>,
48 pub dfg: *const DataFlowGraph,
49
50 pub solver_constraints: Vec<Box<Constraint>>,
51 pub solver_constraint_limit: usize,
52
53 pub unsolved_constraints: Vec<*const Constraint>,
54
55 pub deprecated_blocked_constraints: HashMap<*const Constraint, usize>,
56 pub deprecated_blocked: HashMap<BlockedConstraintId, DenseHashSet<*const Constraint>>,
57
58 pub instantiated_aliases:
59 DenseHashMap<InstantiationSignature, TypeId, HashInstantiationSignature>,
60 pub upper_bound_contributors: DenseHashMap<TypeId, Vec<(Location, TypeId)>>,
61
62 pub deprecated_type_to_constraint_set: HashMap<TypeId, HashSet<*const Constraint>>,
63 pub deprecated_constraint_to_mutated_types: DenseHashMap<*const Constraint, TypeIds>,
64
65 pub uninhabited_type_functions: DenseHashSet<*const core::ffi::c_void>,
66 pub seen_constraints:
67 DenseHashMap<SubtypeConstraintRecord, *mut Constraint, HashSubtypeConstraintRecord>,
68
69 pub generalized_types_: DenseHashSet<TypeId>,
70 pub generalized_types: *const DenseHashSet<TypeId>,
71
72 pub errors: ErrorVec,
73 pub module_resolver: *mut ModuleResolver,
74 pub require_cycles: Vec<RequireCycle>,
75 pub logger: *mut DcrLogger,
76 pub limits: TypeCheckLimits,
77 pub type_functions_to_finalize: DenseHashMap<TypeId, *const Constraint>,
78
79 pub opts: ToStringOptions,
80 pub cgraph: *mut ConstraintGraph,
81 pub subtyping: *mut Subtyping,
82}