Hide warning when calling with non-0 value arg
This commit is contained in:
parent
9ad8e26e88
commit
775b834ee5
@ -1718,10 +1718,14 @@ check_stateful(#env { current_function = Fun }, _Id, _Type) ->
|
|||||||
|
|
||||||
%% Hack: don't allow passing the 'value' named arg if not stateful. This only
|
%% Hack: don't allow passing the 'value' named arg if not stateful. This only
|
||||||
%% works since the user can't create functions with named arguments.
|
%% works since the user can't create functions with named arguments.
|
||||||
check_stateful_named_arg(#env{ stateful = false, current_function = Fun }, {id, _, "value"}, Default) ->
|
check_stateful_named_arg(#env{ stateful = Stateful, current_function = Fun }, {id, _, "value"}, Default) ->
|
||||||
case Default of
|
case Default of
|
||||||
{int, _, 0} -> ok;
|
{int, _, 0} -> ok;
|
||||||
_ -> type_error({value_arg_not_allowed, Default, Fun})
|
_ ->
|
||||||
|
case Stateful of
|
||||||
|
true -> when_warning(warn_unused_stateful, fun() -> used_stateful(Fun) end);
|
||||||
|
false -> type_error({value_arg_not_allowed, Default, Fun})
|
||||||
|
end
|
||||||
end;
|
end;
|
||||||
check_stateful_named_arg(_, _, _) -> ok.
|
check_stateful_named_arg(_, _, _) -> ok.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user