shithub: mc

Download patch

ref: 0eb2ad439e69e9576720badf1dca296c51db6e35
parent: 95a93936f420dd480454eb97c25b02874da7a966
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Sep 16 10:07:30 EDT 2017

Fix occurs check.

	Fixes bug #145.
	Thanks Milo (iitalics on github).

--- a/parse/infer.c
+++ b/parse/infer.c
@@ -353,6 +353,7 @@
 {
 	size_t i;
 
+	sub = tf(sub);
 	if (bshas(bs, sub->tid))
 		return 1;
 	bsput(bs, sub->tid);
@@ -390,8 +391,9 @@
 	int r;
 
 	bs = mkbs();
-	bsput(bs, b->tid);
-	r = occurs_rec(a, bs);
+	a = tf(a);
+	bsput(bs, a->tid);
+	r = occurs_rec(b, bs);
 	bsfree(bs);
 	return r;
 }