ref: 1492ad801631fe48accbf6f448f5113355413e2d
parent: bc6a44d5cc6fb0eab56e766bde325fa2a752c3a6
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Jan 6 11:21:43 EST 2015
Fix broken error reporting on Ovar.
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -92,11 +92,11 @@
free(t);
}
-static char *tystror(Inferstate *st, Type *t, char *s)
+static char *nodetystr(Inferstate *st, Node *n, char *s)
{
- if (!t)
+ if (n->type != Nexpr || !exprtype(n))
return strdup(s);
- return tystr(tf(st, t));
+ return tystr(tf(st, exprtype(n)));
}
/* Tries to give a good string describing the context
@@ -132,13 +132,13 @@
d = namestr(args[0]);
else
d = opstr[exprop(n)];
- t = tystror(st, exprtype(n), "unknown");
+ t = nodetystr(st, n, "unknown");
if (nargs >= 1)
- t1 = tystror(st, exprtype(args[0]), "unknown");
+ t1 = nodetystr(st, args[0], "unknown");
if (nargs >= 2)
- t2 = tystror(st, exprtype(args[1]), "unknown");
+ t2 = nodetystr(st, args[1], "unknown");
if (nargs >= 3)
- t3 = tystror(st, exprtype(args[2]), "unknown");
+ t3 = nodetystr(st, args[2], "unknown");
switch (opclass[exprop(n)]) {
case OTbin:
snprintf(buf, sizeof buf, "<e1:%s> %s <e2:%s>", t1, oppretty[exprop(n)], t2);