ref: 8e3b725def953776fbbaa03114c368ebb1f1372c
parent: 81084d9664f01ba943a958ba89c85a8dbe783d09
author: Ori Bernstein <[email protected]>
date: Fri Aug 9 11:16:40 EDT 2013
Fix generic unions.
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -183,7 +183,7 @@
break;
case Tyunion:
for (i = 0; i < t->nmemb; i++)
- if (isgeneric(st, t->udecls[i]->etype))
+ if (t->udecls[i]->etype && isgeneric(st, t->udecls[i]->etype))
return 1;
break;
default:
@@ -998,7 +998,7 @@
uc = uconresolve(st, n);
if (uc->etype)
unify(st, n, uc->etype, type(st, args[1]));
- settype(st, n, delayed(st, uc->utype));
+ settype(st, n, delayed(st, tyfreshen(st, uc->utype)));
break;
case Otup:
infertuple(st, n, &n->expr.isconst);