+static bool ast_call_check_vararg(ast_call *self, ast_expression *va_type, ast_expression *exp_type)
+{
+ char texp[1024];
+ char tgot[1024];
+ if (!exp_type)
+ return true;
+ if (!va_type || !ast_compare_type(va_type, exp_type))
+ {
+ if (va_type && exp_type)
+ {
+ ast_type_to_string(va_type, tgot, sizeof(tgot));
+ ast_type_to_string(exp_type, texp, sizeof(texp));
+ if (OPTS_FLAG(UNSAFE_VARARGS)) {
+ if (compile_warning(ast_ctx(self), WARN_UNSAFE_TYPES,
+ "piped variadic argument differs in type: constrained to type %s, expected type %s",
+ tgot, texp))
+ return false;
+ } else {
+ compile_error(ast_ctx(self),
+ "piped variadic argument differs in type: constrained to type %s, expected type %s",
+ tgot, texp);
+ return false;
+ }
+ }
+ else
+ {
+ ast_type_to_string(exp_type, texp, sizeof(texp));
+ if (OPTS_FLAG(UNSAFE_VARARGS)) {
+ if (compile_warning(ast_ctx(self), WARN_UNSAFE_TYPES,
+ "piped variadic argument may differ in type: expected type %s",
+ texp))
+ return false;
+ } else {
+ compile_error(ast_ctx(self),
+ "piped variadic argument may differ in type: expected type %s",
+ texp);
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+bool ast_call_check_types(ast_call *self, ast_expression *va_type)