use crate::functions::merge_reasonings::merge_reasonings;
use crate::records::subtyping_result::SubtypingResult;
impl SubtypingResult {
pub fn or_else(&mut self, mut other: SubtypingResult) -> &mut Self {
if !self.is_subtype {
if other.is_subtype {
self.reasoning.clear();
self.assumed_constraints = core::mem::take(&mut other.assumed_constraints);
} else {
self.reasoning = merge_reasonings(&self.reasoning, &other.reasoning);
self.is_error_suppressing |= other.is_error_suppressing;
}
} else if other.is_subtype {
self.assumed_constraints = core::mem::take(&mut other.assumed_constraints);
}
self.is_subtype |= other.is_subtype;
self.normalization_too_complex |= other.normalization_too_complex;
self.is_cacheable &= other.is_cacheable;
self.errors.extend(other.errors.into_iter());
self.generic_bounds_mismatches
.extend(other.generic_bounds_mismatches.into_iter());
self
}
}