Open
Description
Describe the bug
This test module:
-module(t2a).
-compile([export_all, nowarn_export_all]).
test(L) when is_map(L) ->
maps:map(fun check/2, L).
check(atom, V) when is_atom(V) -> V;
check(list, V) when is_list(V) -> V;
check(map, V) ->
case is_map(V) of
true ->
lists:foreach(fun(_) -> ok end, maps:to_list(V)),
V;
_ ->
erlang:error(badarg, [set, V])
end;
check(K, V) ->
erlang:error(badarg, [K, V]).
Result in dialyzer warning that are IMHO invalid:
t2a.erl:8:1: Body yields the type
atom() which violates the opacity of the other clauses.
t2a.erl:9:1: Body yields the type
maybe_improper_list() which violates the opacity of the other clauses.
t2a.erl:10:1: Body yields the type
map() | maps:iterator(_, _) which violates the opacity of the other clauses.
done in 0m0.22s
done (warnings were emitted)
To Reproduce
- save to t2a.erl
- compile with debug and run dialyzer on it:
erlc +debug_info t2a.erl; dialyzer t2a.beam
Expected behavior
No warning should be produced by dialyzer
Affected versions
OTP-28.0-rc1
Activity