Skip to content

Dialyzer error FCM Notification #211

Open

Description

@rlopzc

Environment

  • Elixir & Erlang/OTP versions (elixir --version):
Erlang/OTP 24 [erts-12.0.3] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]

Elixir 1.12.2 (compiled with Erlang/OTP 22)
  • Operating system: Arch Linux

Current behavior

I'm implementing a module to use Pigeon FCM Notification but dialyzer complains. I'm using the example provided in the readme (2.0.0-rc.0)

Expected behavior

Dialyzer not complaining

Code

  @spec send_push_notification(String.t(), %{String.t() => String.t()}) :: :ok
  def send_push_notification(token, payload) do
    Pigeon.FCM.Notification.new({:token, token}, payload)
    |> Okani.FCM.push()

    :ok
  end

Dialyzer error

The function call will not succeed.

Okani.FCM.push(%Pigeon.FCM.Notification{
  :__meta__ => %Pigeon.Metadata{:on_response => nil},
  :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 the 1st arguments differ
from the success typing arguments:

(
  [
    %{
      :__meta__ => %Pigeon.Metadata{:on_response => nil | (_ -> any()) | {_, _} | {_, _, _}}
    },
    ...
  ]
  | %{
      :__meta__ => %Pigeon.Metadata{
        :on_response =>
          nil | (map() -> no_return()) | {atom(), atom()} | {atom(), atom(), [any()]}
      }
    }
)

Activity

  1. madurangae commented on Nov 1, 2021

    @madurangae

    I'm seeing the same error with "2.0.0-rc.0".
    Btw, thank you for the amazing library! 🙏

  2. zaphod534 commented on Nov 4, 2021

    @zaphod534
    Contributor

    I'm seeing the same error with 2.0.0-rc.0 using Pigeon.push

  3. icecapp commented on Jan 9, 2022

    @icecapp

    Seeing same issue on "2.0.0-rc.0".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions