Forgot to check that function parameters are not reserved names.

This commit is contained in:
Christian Rinderknecht 2020-02-05 18:09:45 +01:00
parent 71474e1b0d
commit 26059c281a

View File

@ -158,10 +158,12 @@ let check_variants variants =
let check_parameters params = let check_parameters params =
let add acc = function let add acc = function
ParamConst {value; _} -> ParamConst {value; _} ->
check_reserved_name value.var;
if VarSet.mem value.var acc then if VarSet.mem value.var acc then
raise (Error (Duplicate_parameter value.var)) raise (Error (Duplicate_parameter value.var))
else VarSet.add value.var acc else VarSet.add value.var acc
| ParamVar {value; _} -> | ParamVar {value; _} ->
check_reserved_name value.var;
if VarSet.mem value.var acc then if VarSet.mem value.var acc then
raise (Error (Duplicate_parameter value.var)) raise (Error (Duplicate_parameter value.var))
else VarSet.add value.var acc in else VarSet.add value.var acc in