Skip to main content

luaur_analysis/methods/
quantifier_visit_quantify.rs

1use crate::records::free_type::FreeType;
2use crate::records::quantifier::Quantifier;
3use crate::type_aliases::type_id::TypeId;
4
5use crate::functions::as_mutable_type_id::as_mutable_type_id;
6use crate::records::generic_type::GenericType;
7use crate::records::r#type::Type;
8
9impl Quantifier {
10    pub fn visit_type_id_free_type(&mut self, ty: TypeId, ftv: &FreeType) -> bool {
11        self.seen_mutable_type = true;
12
13        if !self.level.subsumes(&ftv.level) {
14            return false;
15        }
16
17        unsafe {
18            *as_mutable_type_id(ty) = Type::from(GenericType::generic_type_type_level(self.level));
19        }
20
21        self.generics.push(ty);
22
23        false
24    }
25}