Skip to content

Commit

Permalink
Fix false residuals, re issue #350
Browse files Browse the repository at this point in the history
  • Loading branch information
infradig committed Sep 28, 2023
1 parent 940107f commit 137be97
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/unify.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,16 @@ static int compare_structs(query *q, cell *p1, pl_idx p1_ctx, cell *p2, pl_idx p
DEREF_SLOT(both, save_vgen2, e2, e2->vgen2, c2, c2_ctx, q->vgen);
bool cycle2 = both ? true : false;

if (cycle1 && !cycle2)
return 1;

if (!cycle1 && cycle2)
return -1;

if (!cycle1 && !cycle2) {
int val = compare_internal(q, c1, c1_ctx, c2, c2_ctx, depth+1);
if (val) return val;
} else if (cycle1 != cycle2) {
c1 = deref(q, p1, p1_ctx);
c1_ctx = q->latest_ctx;
c2 = deref(q, p2, p2_ctx);
c2_ctx = q->latest_ctx;
int val = compare_internal(q, c1, c1_ctx, c2, c2_ctx, depth+1);
if (val) return val;
}

if (e1) e1->vgen = save_vgen1;
Expand Down

0 comments on commit 137be97

Please sign in to comment.