Skip to content

Commit c02dbde

Browse files
committed
unify_with_occurs_check/2, re issue #897
1 parent 2796b56 commit c02dbde

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

src/unify.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ static bool unify_structs(query *q, cell *p1, pl_ctx p1_ctx, cell *p2, pl_ctx p2
497497
static bool unify_var(query *q, cell *p1, pl_ctx p1_ctx, cell *p2, pl_ctx p2_ctx, unsigned depth)
498498
{
499499
bool was_cyclic = false;
500-
bool check = is_global(p1) || (p1_ctx == 0);
500+
bool check = !is_local(p1);
501501

502502
if (q->flags.occurs_check == OCCURS_CHECK_TRUE) {
503503
if (check && is_cyclic_term(q, p2, p2_ctx))

tests/issues/test897.expected

Whitespace-only changes.

tests/issues/test897.pl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
:- initialization(main).
2+
3+
main :-
4+
S = s(s(A,s(B,A)),1), T = s(s(C,C),1), \+ unify_with_occurs_check(S,T).

0 commit comments

Comments
 (0)