When I use a tuple as the schema_or_source of Ecto.Multi.insert_all
, Sometimes the warning will appear, and sometimes not.
This is my code
Ecto.Multi.new()
|> Ecto.Multi.insert_all(:contents_golden, {"contents_golden", Content}, Map.get(grouped_contents, "golden", []))
the dialyzers warning always show:
The call 'Elixir.Ecto.Multi':insert_all
(_multi@1 ::
#{'__struct__' := 'Elixir.Ecto.Multi',
'names' := 'Elixir.MapSet':t(_),
'operations' := [{_, _}]},
'contents_golden',
{<<99,111,110,116,101,110,116,115,95,103,111,108,100,101,110>>,
'Elixir.AwBackend.Core.Content'},
any()) will never return since it differs in the 3rd argument from the success typing arguments:
(#{'__struct__' := 'Elixir.Ecto.Multi',
'names' := 'Elixir.MapSet':t(_),
'operations' := [{_, {_, _} | {_, _, _} | {_, _, _, _}}]},
any(),
atom() | binary() | {'nil' | binary(), binary()},
[[{atom(), _}] | map()])
but in another project,
this code
Ecto.Multi.new()
|> Ecto.Multi.insert_all(:insert_all, {"branched_cards", Card}, branched_cards_list)
|> Repo.transaction()
The dialyzer show nothing.
my deps is
* ecto 3.3.1 (Hex package) (mix)
locked at 3.3.1 (ecto) 82ab7429
* ecto_sql 3.3.2 (Hex package) (mix)
locked at 3.3.2 (ecto_sql) 92804e0d
I’ve checked the source code of Ecto, the spec of source_or_shema is @typep schema_or_source :: binary | {binary | nil, binary} | atom
, {binary|nil, binary}
is so wierd.