luaur_analysis/methods/
subtyping_unifier_can_be_unified.rs1use crate::enums::table_state::TableState;
4use crate::functions::follow_type::follow_type_id;
5use crate::functions::get_type_alt_j::get_type_id;
6use crate::functions::is_blocked_type_utils::is_blocked;
7use crate::records::free_type::FreeType;
8use crate::records::subtyping_unifier::SubtypingUnifier;
9use crate::records::table_type::TableType;
10use crate::type_aliases::type_id::TypeId;
11
12impl SubtypingUnifier {
13 pub fn can_be_unified(&self, ty: TypeId) -> bool {
14 let ty = unsafe { follow_type_id(ty) };
15 let tbl = unsafe { get_type_id::<TableType>(ty) };
16 if !tbl.is_null() {
17 return unsafe { (*tbl).state } != TableState::Sealed;
18 }
19
20 !unsafe { get_type_id::<FreeType>(ty) }.is_null() || is_blocked(ty)
21 }
22}