ref: d5b01a9692531e3c30ca659022574bdd5be0ac77
parent: 647346ba80b366580d53733a14d05baffe0dfa3b
author: Ori Bernstein <[email protected]>
date: Sat Jul 28 12:27:54 EDT 2012
Formatting chagnes.
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -389,19 +389,24 @@
}
if (a->type == Tyvar && b->type != Tyvar)
if (occurs(a, b))
- fatal(ctx->line, "Infinite type %s in %s near %s", tystr(a), tystr(b), ctxstr(st, ctx));
+ fatal(ctx->line, "Infinite type %s in %s near %s",
+ tystr(a), tystr(b), ctxstr(st, ctx));
+ /* if the tyrank of a is 0 (ie, a raw tyvar), we just unify, and don't
+ * try to match up the nonexistent subtypes */
if ((a->type == b->type || idxhacked(a, b)) && tyrank(a) != 0) {
for (i = 0; i < b->nsub; i++) {
/* types must have same arity */
if (i >= a->nsub)
- fatal(ctx->line, "%s has wrong subtypes for %s near %s", tystr(a), tystr(b), ctxstr(st, ctx));
+ fatal(ctx->line, "%s has wrong subtypes for %s near %s",
+ tystr(a), tystr(b), ctxstr(st, ctx));
unify(st, ctx, a->sub[i], b->sub[i]);
}
r = b;
} else if (a->type != Tyvar) {
- fatal(ctx->line, "%s incompatible with %s near %s", tystr(a), tystr(b), ctxstr(st, ctx));
+ fatal(ctx->line, "%s incompatible with %s near %s",
+ tystr(a), tystr(b), ctxstr(st, ctx));
}
return r;
}