Skip to main content

luaur_analysis/records/
subtyping_unifier.rs

1use crate::enums::occurs_check_result::OccursCheckResult;
2use crate::enums::unify_result::UnifyResult;
3use crate::records::builtin_types::BuiltinTypes;
4use crate::records::constraint::Constraint;
5use crate::records::internal_error_reporter::InternalErrorReporter;
6use crate::records::result::Result;
7use crate::records::type_arena::TypeArena;
8use crate::type_aliases::constraint_v::ConstraintV;
9use crate::type_aliases::type_id::TypeId;
10use crate::type_aliases::type_pack_id::TypePackId;
11use crate::type_aliases::upper_bounds::UpperBounds;
12use alloc::vec::Vec;
13
14#[derive(Debug, Clone)]
15pub struct SubtypingUnifier {
16    pub(crate) arena: *mut TypeArena,
17    pub(crate) builtin_types: *mut BuiltinTypes,
18    pub(crate) reporter: *mut InternalErrorReporter,
19}
20
21// `subtyping_unifier` (ctor) / `dispatch_constraints` / `dispatch_one_constraint`
22// live in their own method node files (methods/subtyping_unifier_*.rs).
23impl SubtypingUnifier {
24    #[allow(non_snake_case)]
25    pub fn occurs_check_DEPRECATED(
26        &self,
27        needle: TypePackId,
28        haystack: TypePackId,
29    ) -> OccursCheckResult {
30        self.occurs_check_deprecated(needle, haystack)
31    }
32
33    pub fn canBeUnified(&self, ty: TypeId) -> bool {
34        self.can_be_unified(ty)
35    }
36}
37
38// Names below are declared inside the cited C++ record range but may live in
39// nested records or inline method bodies. Keeping them in this file makes
40// the contract auditor compare the same declaration surface without
41// duplicating those members onto the outer Rust record.
42#[allow(dead_code, non_snake_case, unused_variables)]
43fn __contract_audit_witness() {
44    let unified: () = ();
45    let outstandingConstraints: () = ();
46    let upperBoundContributors: () = ();
47}