luaur_analysis/methods/
unifier_occurs_check_unifier_alt_c.rs1use crate::records::occurs_check_failed::OccursCheckFailed;
2use crate::records::type_pack_var::TypePackVar;
3use crate::records::unifier::Unifier;
4use crate::type_aliases::type_error_data::TypeErrorData;
5use crate::type_aliases::type_pack_id::TypePackId;
6use crate::type_aliases::type_pack_variant::TypePackVariant;
7
8impl Unifier {
9 pub fn occurs_check_type_pack_id_type_pack_id_bool(
10 &mut self,
11 needle: TypePackId,
12 haystack: TypePackId,
13 _reversed: bool,
14 ) -> bool {
15 let shared_state = unsafe { &mut *self.shared_state };
16 shared_state.temp_seen_tp.clear();
17
18 let occurs = self.occurs_check_dense_hash_set_type_pack_id_type_pack_id_type_pack_id(
19 &mut shared_state.temp_seen_tp,
20 needle,
21 haystack,
22 );
23
24 if occurs {
25 self.report_error_location_type_error_data(
26 self.location,
27 TypeErrorData::OccursCheckFailed(OccursCheckFailed::default()),
28 );
29 let error_tp = unsafe { (*self.builtin_types).errorTypePack };
32 let bound = TypePackVar {
33 ty: TypePackVariant::Bound(error_tp),
34 persistent: false,
35 owningArena: core::ptr::null_mut(),
36 };
37 self.log.replace_type_pack_id_type_pack_var(needle, bound);
38 }
39
40 occurs
41 }
42}