ref: b1a3d3df704e61aa55c34c623380967f06700b41
parent: f7141e2d8ed52e0fb493810ea71adf22fa57a49e
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Jan 30 20:18:59 EST 2016
Fix missing tysearch() We were erronously saying that two types were not equal, even though we'd already unified them.
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -948,8 +948,9 @@
}
r = NULL;
- if (a->type == Tyvar) {
+ if (a->type == Tyvar || tyeq(a, b))
tytab[a->tid] = b;
+ if (a->type == Tyvar) {
ea = basetype(st, a);
eb = basetype(st, b);
if (ea && eb)
--- a/parse/type.c
+++ b/parse/type.c
@@ -667,6 +667,8 @@
if (!a || !b)
return a == b;
+ a = tysearch(a);
+ b = tysearch(b);
if (a->type != b->type)
return 0;
if (a->narg != b->narg)
@@ -685,7 +687,9 @@
bsput(visited, b->tid);
switch (a->type) {
- case Typaram: return streq(a->pname, b->pname); break;
+ case Typaram:
+ return streq(a->pname, b->pname);
+ break;
case Tyvar:
if (a->tid != b->tid)
return 0;