ref: 1c91b60dd309df7579a781e9ef3888cc6bd3484c
parent: bf3f933ccc20a959ec0b29e6517e19db88bfc641
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)