ref: eab4ea29aeb0fc9939a4d229da658d9693089dc5
parent: ddf0bd7ed1851d8c06ed327dd3b20b9895d0b0dd
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Jun 7 16:34:35 EDT 2012
Fix swapped condiiton in cstr check. We had swapped a and b in the test for type constraint satisfaction.
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -79,10 +79,10 @@
/* b satisfies no cstrs; only valid if a requires none */
if (!b->cstrs)
return bscount(a->cstrs) == 0;
- /* if b->cstrs \ a->cstrs == 0, then all of
+ /* if a->cstrs \ b->cstrs == 0, then all of
* a's constraints are satisfied. */
- s = dupbs(b->cstrs);
- bsdiff(s, a->cstrs);
+ s = dupbs(a->cstrs);
+ bsdiff(s, b->cstrs);
n = bscount(s);
delbs(s);
@@ -122,9 +122,7 @@
case Lint: return tylike(mktyvar(n->line), Tyint); break;
case Lflt: return tylike(mktyvar(n->line), Tyfloat32); break;
case Lstr: return mktyslice(n->line, mkty(n->line, Tychar)); break;
- case Lfunc:
- return n->lit.fnval->func.type;
- break;
+ case Lfunc: return n->lit.fnval->func.type; break;
case Larray: return NULL; break;
};
return NULL;