diff --git a/src/extension/infer.rs b/src/extension/infer.rs index c12ca05bd..f9f2f1751 100644 --- a/src/extension/infer.rs +++ b/src/extension/infer.rs @@ -664,7 +664,13 @@ impl UnificationContext { let solution = ExtensionSet::from_iter(self.get_constraints(&m).unwrap().iter().filter_map( |c| match c { - Constraint::Plus(x, other_m) if &m == other_m => Some(x.clone()), + // If `m` has been merged, [`self.variables`] entry + // will have already been updated to the merged + // value by [`self.merge_equal_metas`] so we don't + // need to worry about resolving it. + Constraint::Plus(x, other_m) if m == self.resolve(*other_m) => { + Some(x.clone()) + } _ => None, }, ));