diff --git a/quint/src/effects/base.ts b/quint/src/effects/base.ts index 3d0167283..1399b68bc 100644 --- a/quint/src/effects/base.ts +++ b/quint/src/effects/base.ts @@ -333,9 +333,10 @@ export function unifyEntities(va: Entity, vb: Entity): Either 0) { - const s1 = { ...v1, entities: differenceWith(v1.entities, v2.entities, isEqual) } - const s2 = { ...v2, entities: differenceWith(v2.entities, v1.entities, isEqual) } + const intersection = intersectionWith(v1.entities, v2.entities, isEqual) + if (intersection.length > 0) { + const s1 = { ...v1, entities: differenceWith(v1.entities, intersection, isEqual) } + const s2 = { ...v2, entities: differenceWith(v2.entities, intersection, isEqual) } // There was an intersection, try to unify the remaining entities return unifyEntities(s1, s2)