Merge remote-tracking branch 'origin/topic/zeke/expire-func'

* origin/topic/zeke/expire-func:
  Ignore abs-path in test.
  Report argument # type check failed on.
  Update test baseline.
  Improve func arg type checking.
  &expire_func(table, arg1, arg2, ...) + type checking.
This commit is contained in:
Johanna Amann 2019-07-22 11:28:30 -07:00
commit 3159577821
8 changed files with 119 additions and 25 deletions

View file

@ -587,13 +587,23 @@ int FuncType::CheckArgs(const type_list* args, bool is_init) const
const type_list* my_args = arg_types->Types();
if ( my_args->length() != args->length() )
{
Warn(fmt("Wrong number of arguments for function. Expected %d, got %d.",
args->length(), my_args->length()));
return 0;
}
int success = 1;
for ( int i = 0; i < my_args->length(); ++i )
if ( ! same_type((*args)[i], (*my_args)[i], is_init) )
return 0;
{
Warn(fmt("Type mismatch in function argument #%d. Expected %s, got %s.",
i, type_name((*args)[i]->Tag()), type_name((*my_args)[i]->Tag())));
success = 0;
}
return 1;
return success;
}
void FuncType::Describe(ODesc* d) const