Resolving typespec warning for call to Elixir.Absinthe.Resolution.Helpers.batch/3

I’m trying to resolve a Dialyzer warning with a call to Elixir.Absinthe.Resolution.Helpers.batch/3 but I cannot determine the cause of the warning. The warning is:

The call 'Elixir.Absinthe.Resolution.Helpers':batch({'Elixir.Catalog.ProductResolver', 'by_id', 'Elixir.Catalog.Product'},1,fun((_) -> {'ok','testing'})) 
will never return since the success typing is ({_,'atom'} | {_,'atom',_},any(),fun((_) -> {'error',binary()} | {'ok',_} | {'plugin',atom(),_})) -> {'plugin','Elixir.Absinthe.Resolution.Plugin.Batch',{_,_,_,_}} 
and the contract is ('Elixir.Absinthe.Resolution.Plugin.Batch':batch_fun(),term(),'Elixir.Absinthe.Resolution.Plugin.Batch':post_batch_fun()) -> {'plugin','Elixir.Absinthe.Resolution.Plugin.Batch',term()}

The source code below. As you can see, I’ve created a simple version to determine the issue in my production code:

batch({__MODULE__, :by_id, Catalog.Product}, 1, fn batch_results ->
  {:ok, :testing}
end)

I’ve created a table to help compare the arguments and return types with the success typing and
type signature. Is there anything obvious I am missing here? Thank you.

This should be reduced to a minimal test-case and submitted to their issue tracker. It kind of sounds like a macro is not building up specs properly?

Thank you for the prompt, @OvermindDL1https://github.com/absinthe-graphql/absinthe/issues/245

1 Like