shithub: mc

Download patch

ref: 1499a3610e424af329f9e236bc9eefe181512322
parent: 6d9376e3a72f12648f465e28885f09e258694e8a
author: Ori Bernstein <[email protected]>
date: Mon Jan 9 18:33:18 EST 2012

Fix constraint checking

--- a/parse/infer.c
+++ b/parse/infer.c
@@ -137,10 +137,10 @@
     if (b->type == Tyvar) {
         if (!b->cstrs)
             b->cstrs = dupbs(a->cstrs);
-        else
+        else if (a->cstrs)
             bsunion(b->cstrs, a->cstrs);
     } else {
-        if (!cstrcheck(b, a))
+        if (!cstrcheck(a, b))
             fatal(ctx->line, "%s incompatible with %s near %s", tystr(a), tystr(b), ctxstr(ctx));
     }
 }