print " in:\n";
output (p_typ t))
+fun will_be_action (t, _) =
+ case t of
+ TArrow (_, t') => will_be_action t'
+ | TAction _ => true
+ | TNested _ => true
+ | TUnif (_, ref (SOME t')) => will_be_action t'
+ | _ => false
+
+fun get_first_arg (t, _) =
+ case t of
+ TArrow (t', _) => t'
+ | TUnif (_, ref (SOME t')) => get_first_arg t'
+ | _ => raise Fail "get_first_arg failed!"
+
fun describe_type_error loc te =
case te of
WrongType (place, e, t1, t2, ueo) =>
preface ("Needed type:", p_typ t2);
Option.app (describe_unification_error t1) ueo)
| WrongForm (place, form, e, t, ueo) =>
- (ErrorMsg.error (SOME loc) (place ^ " has a non-" ^ form ^ " type.");
- preface ("Expression:", p_exp e);
- preface (" Type:", p_typ t);
- Option.app (describe_unification_error t) ueo)
+ if form = "action" andalso will_be_action t then
+ (ErrorMsg.error (SOME loc) "Not enough arguments passed to configuration function.";
+ preface (" Expression so far:", p_exp e);
+ preface ("Next argument type:", p_typ (get_first_arg t)))
+ else
+ (ErrorMsg.error (SOME loc) (place ^ " has a non-" ^ form ^ " type.");
+ preface ("Expression:", p_exp e);
+ preface (" Type:", p_typ t);
+ Option.app (describe_unification_error t) ueo)
| UnboundVariable name =>
ErrorMsg.error (SOME loc) ("Unbound variable " ^ name ^ ".\n")
| WrongPred (place, p1, p2) =>