ref: 446f1577da01b4c8a25da882739050832f0698b1
parent: 65f7649caf6581f62d87e15bb74d72474f582a55
author: Ori Bernstein <orib@google.com>
date: Fri Jul 20 13:41:44 EDT 2012
Unify the type of the func var with the funct type. When we had an expression tree like this: Call f : @$a args We would generate a function type '(@$1,@$2, etc... -> @$n)', but we wouldn't unify the called object's '@$a' with it, so we could get spurious error messages. This patch fixes that.
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -412,6 +412,7 @@
if (ft->type == Tyvar) {
/* the first arg is the function itself, so it shouldn't be counted */
ft = mktyfunc(n->line, &n->expr.args[1], n->expr.nargs - 1, mktyvar(n->line));
+ unify(st, n, ft, type(st, n->expr.args[0]));
}
for (i = 1; i < n->expr.nargs; i++) {
if (ft->sub[i]->type == Tyvalist)