pike.git / src / pike_types.c

version» Context lines:

pike.git/src/pike_types.c:6269:   #endif /* PIKE_DEBUG */    res = NULL;    if (tmp) free_type(tmp);    break;    }    }    /* Match. */    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)) {    /* There are more required arguments. */   #ifdef PIKE_DEBUG    if (l_flag>2) {    fprintf(stderr, "%*sMore arguments required.\n", indent*2+2, "");    }   #endif /* PIKE_DEBUG */    res = NULL;    if (tmp) free_type(tmp);    break;    } -  + #endif /* 0 */    }    type_stack_mark();    push_finished_type_with_markers(fun_type, b_markers, 0);    res = pop_unfinished_type();    if (tmp) free_type(tmp);       if ((Pike_compiler->compiler_pass == 2) && sval) {    while (tmp2->type == PIKE_T_NAME) {    tmp2 = tmp2->cdr;    }
pike.git/src/pike_types.c:7104:    if (tmp) free_type(tmp);    } else {    free_type(tmp);    }    }    free_type(fun_type);    return res;    }    }    -  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    if (l_flag>2) {    fprintf(stderr, " Bad argument.\n");    }   #endif /* PIKE_DEBUG */    yytype_report(REPORT_ERROR, NULL, 0, tmp, NULL, 0, args->type,    0, "Bad argument %d to %S.", *argno, fun_name);