ref: b3d69e8d1a3563e89028e41e0c3aba717bfc2555
parent: ea3ae1c8e5d7daf59061e0fc194b1f0ad5ba1609
author: Ori Bernstein <[email protected]>
date: Sun Nov 30 16:35:25 EST 2014
Don't try calling non-function types.
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -791,6 +791,8 @@
/* the first arg is the function itself, so it shouldn't be counted */
ft = mktyfunc(n->loc, &n->expr.args[1], n->expr.nargs - 1, mktyvar(n->loc));
unify(st, n, ft, type(st, n->expr.args[0]));
+ } else if (tybase(ft)->type != Tyfunc) {
+ fatal(n, "calling uncallable type %s", tystr(ft));
}
for (i = 1; i < n->expr.nargs; i++) {
if (i == ft->nsub)