Disable some warnings for toplevel constants
Since variables and functions cannot be used in the definition of a compile time constants, the following warnings are not going to be reported: * Used/Unused variable * Used/Unused function
This commit is contained in:
parent
719dfdf240
commit
a9548e77d8
@ -1735,9 +1735,17 @@ lookup_name(Env = #env{ namespace = NS, current_function = CurFn }, As, Id, Opti
|
|||||||
type_error({unbound_variable, Id}),
|
type_error({unbound_variable, Id}),
|
||||||
{Id, fresh_uvar(As)};
|
{Id, fresh_uvar(As)};
|
||||||
{QId, {_, Ty}} ->
|
{QId, {_, Ty}} ->
|
||||||
when_warning(warn_unused_variables, fun() -> used_variable(NS, name(CurFn), QId) end),
|
%% Variables and functions cannot be used when CurFn is `none`.
|
||||||
when_warning(warn_unused_functions,
|
%% i.e. they cannot be used in toplevel constants
|
||||||
fun() -> register_function_call(NS ++ qname(CurFn), QId) end),
|
[ begin
|
||||||
|
when_warning(
|
||||||
|
warn_unused_variables,
|
||||||
|
fun() -> used_variable(NS, name(CurFn), QId) end),
|
||||||
|
when_warning(
|
||||||
|
warn_unused_functions,
|
||||||
|
fun() -> register_function_call(NS ++ qname(CurFn), QId) end)
|
||||||
|
end || CurFn =/= none ],
|
||||||
|
|
||||||
Freshen = proplists:get_value(freshen, Options, false),
|
Freshen = proplists:get_value(freshen, Options, false),
|
||||||
check_stateful(Env, Id, Ty),
|
check_stateful(Env, Id, Ty),
|
||||||
Ty1 = case Ty of
|
Ty1 = case Ty of
|
||||||
|
Loading…
x
Reference in New Issue
Block a user