I’m trying to use dialyzer with an external package, however I’m not sure how to specify the external module.
I’ve tried the following:
defmodule Wrapper.FCM do
@moduledoc """
Wrapper for Firebase notifications
"""
use Pigeon.Dispatcher
@dialyzer {:nowarn_function, {:push, }}
@spec send_notification(any, any, any) :: any # temporarily ignoring this spec
def send_notification(token, title, body) do
n =
Pigeon.FCM.Notification.new(
{
:token,
token
},
%{
"title" => title,
"body" => body
}
)
push(n)
end
end
When I call push
(which comes from Pigeon), dialyzer prints the following error regardless of trying to ignore it:
The call 'Elixir.Wrapper.FCM':push
(_n@1 ::
#{'__meta__' :=
#{'__struct__' := 'Elixir.Pigeon.Metadata',
'on_response' := 'nil'},
'__struct__' := 'Elixir.Pigeon.FCM.Notification',
'android' := 'nil',
'apns' := 'nil',
'data' := _,
'error' := 'nil',
'fcm_options' := 'nil',
'name' := 'nil',
'notification' := _,
'response' := 'nil',
'target' :=
{'condition', _} | {'token', _} | {'topic', _},
'validate_only' := 'nil',
'webpush' := 'nil'}) will never return since it differs in the 1st argument from the success typing arguments:
([#{'__meta__' :=
#{'__struct__' := 'Elixir.Pigeon.Metadata',
'on_response' :=
'nil' | fun((_) -> any()) | {_, _} | {_, _, _}}},
...] |
#{'__meta__' :=
#{'__struct__' := 'Elixir.Pigeon.Metadata',
'on_response' :=
'nil' |
fun((map()) -> no_return()) |
{atom(), atom()} |
{atom(), atom(), [any()]}}})
This is using the correct struct, so is this just something wrong with the package? I can ignore the method that calls it, but I want to use dialyzer on it.