Cleared code after function arguments expansion
@@ -841,20 +841,18 @@ function FunChecker:check_exp_synthesize(exp)
if f_type._tag == "types.T.Function" then
self:expand_function_returns(f_type.arg_types, exp.args)
- for i = 1, #exp.args do
- if f_type.arg_types[i] then
- exp.args[i] = self:check_exp_verify(exp.args[i],
- f_type.arg_types[i],
- "argument %d of call to function", i)
- end
- end
-
if #f_type.arg_types ~= #exp.args then
type_error(exp.loc,
"function expects %d argument(s) but received %d",
#f_type.arg_types, #exp.args)
end
+ for i = 1, #exp.args do
+ exp.args[i] = self:check_exp_verify(exp.args[i],
+ f_type.arg_types[i],
+ "argument %d of call to function", i)
+ end
+
if #f_type.ret_types > 0 then
exp._type = f_type.ret_types[1]
exp._types = f_type.ret_types
