Branch: Tag:

2012-05-23

2012-05-23 21:08:03 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Type-checker: Fix excessive strictness in function call checker.

This fixes an issue where too few arguments to a function was reported
as too many arguments.

6276:    if (fun_type->type == PIKE_T_FUNCTION) {    /* Advance to the next argument. */    fun_type = fun_type->cdr; + #if 0 +  /* This test is too strict, and causes the type checker +  * to complain about the last argument (even if correct) +  * when there are too few arguments to the function. +  */    if (!(flags & CALL_NOT_LAST_ARG) &&    (fun_type->type == PIKE_T_FUNCTION) &&    !low_match_types(fun_type->car, void_type_string, 0)) {
6289:    if (tmp) free_type(tmp);    break;    } + #endif /* 0 */    }    type_stack_mark();    push_finished_type_with_markers(fun_type, b_markers, 0);
7111:    }    }    -  if ((tmp = get_first_arg_type(fun_type, flags))) { +  if ((tmp = get_first_arg_type(fun_type, flags|CALL_NOT_LAST_ARG))) {    struct pike_type *tmp2;      #ifdef PIKE_DEBUG