Why does this code type check with dialyzer?

Can some one explain why the code below type checks okay with mix dialyzer .

defmodule CHECK do
  @type state :: {%{integer => integer},%{}}

  @spec a_fun(state) :: state
  
  def a_fun(state) do
    {names,other}=state
    {Map.put(names,"Hello",4),other}
  end
end
2 Likes

As of Erlang 18 dialyzer has only a limited support for maps, that means
there’s only an opaque map type. It can’t see “inside” the maps.

Erlang 19 will contain full support for maps in dialyzer.

3 Likes