Skip to main content

luaur_analysis/methods/
subtyping_environment_contains_mapped_pack.rs

1use crate::records::subtyping_environment::SubtypingEnvironment;
2use crate::type_aliases::lookup_result::LookupResult;
3use crate::type_aliases::type_pack_id::TypePackId;
4
5impl SubtypingEnvironment {
6    pub fn contains_mapped_pack(&self, tp: TypePackId) -> bool {
7        let lookup_result: LookupResult = self.lookup_generic_pack(tp);
8        match lookup_result {
9            LookupResult::V0(_) => true,
10            _ => {
11                if !self.parent.is_null() {
12                    unsafe { (*self.parent).contains_mapped_pack(tp) }
13                } else {
14                    false
15                }
16            }
17        }
18    }
19}