1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-28 17:19:31 +00:00

Ignore defaults values in parameter type check

This commit is contained in:
Étienne Fildadut 2023-12-28 18:51:40 +01:00
parent 9acde377c2
commit 7abb116876
3 changed files with 48 additions and 2 deletions

View file

@ -150,8 +150,8 @@ ArgumentTuple = ast.abstract.Node {
end
-- not found
if not arg then return false, ("missing parameter %s"):format(param.identifier:format(state)) end
-- type check
if param.type_check then
-- type check (assume ok for default values)
if param.type_check and arg ~= param.default then
local r = param.type_check:call(state, ArgumentTuple:new(arg))
if not r:truthy() then return false, ("type check failure for parameter %s in function %s"):format(param.identifier:format(state), params:format(state)) end
if Number:is(r) then