diff options
Diffstat (limited to 'src/constrain.cpp')
-rw-r--r-- | src/constrain.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/constrain.cpp b/src/constrain.cpp index 2a3c8fe..3655396 100644 --- a/src/constrain.cpp +++ b/src/constrain.cpp @@ -164,8 +164,13 @@ constrain_fn(TEnv& tenv, Constraints& c, const ATuple* call) throw(Error) frame.push_back(make_pair(sym->sym(), tvar)); protT.push_back(tvar); } - protT.head->loc = call->loc; + if (!protT.head) { + protT.head = new ATuple(NULL, NULL, call->loc); + } else { + protT.head->loc = call->loc; + } + ATuple::const_iterator i = call->iter_at(1); c.constrain(tenv, *i, protT); @@ -352,7 +357,8 @@ constrain_call(TEnv& tenv, Constraints& c, const ATuple* call) throw(Error) List argsT; for (ATuple::const_iterator i = call->iter_at(1); i != call->end(); ++i) argsT.push_back(tenv.var(*i)); - argsT.head->loc = call->loc; + if (argsT.head) + argsT.head->loc = call->loc; c.constrain(tenv, head, tup(head->loc, tenv.Fn, argsT.head, retT, 0)); c.constrain(tenv, call, retT); } @@ -473,5 +479,7 @@ resp_constrain(TEnv& tenv, Constraints& c, const AST* ast) throw(Error) case T_TUPLE: constrain_list(tenv, c, ast->as_tuple()); break; + case T_ELLIPSIS: + throw Error(ast->loc, "ellipsis present after expand stage"); } } |