Dialyzer throwing un necessary warnings

I am using the vs-code extension https://marketplace.visualstudio.com/items?itemName=JakeBecker.elixir-ls

Environment details

Erlang/OTP 21 [erts-10.2.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe] [dtrace]

Elixir 1.7.4 (compiled with Erlang/OTP 21)

My Guardian module code is as

defmodule Epos.Guardian do
  use Guardian,
    otp_app: :epos

  use Guardian.Permissions.Bitwise

  def subject_for_token(%{} = user, _claims) do
    # You can use any value for the subject of your token but
    # it should be useful in retrieving the resource later, see
    # how it being used on `resource_from_claims/1` function.
    # A unique `id` is a good subject, a non-unique email address
    # is a poor subject.
    sub = to_string(user.users_id)
    {:ok, sub}

  def subject_for_token(_, _) do
    {:error, :reason_for_error}

  def resource_from_claims(%{} = claims) do
    # Here we'll look up our resource from the claims, the subject can be
    # found in the `"sub"` key. In `above subject_for_token/2` we returned
    # the resource id so here we'll rely on that to look it up.

    id = claims["sub"]
    resource = Epos.Accounts.get_user!(id)
    {:ok, resource}

  def resource_from_claims(_claims) do
    {:error, :reason_for_error}

  def build_claims(claims, _resource, opts) do
    claims =
      |> encode_permissions_into_claims!(Keyword.get(opts, :permissions))

    {:ok, claims}

The moment I include this use Guardian.Permissions.Bitwise i get the following warnings in vscode

The attempt to match a term of type ‘Elixir.MapSet’:t(_) against the pattern #{‘struct’:=‘Elixir.MapSet’} breaks the opacity of the term

Function ‘do_any_permissions?’/2 has no local return

The created fun has no local return

Invalid type specification for function ‘Elixir.Epos.Guardian’:available_permissions/0. The success typing is () -> #{‘admin’:=[‘expense_write’ | ‘products’ | ‘receivings_write’ | ‘sales’ | ‘stock’,…], ‘basic_user’:=[‘sales’ | ‘stock’,…], ‘super_admin’:=[‘all_access’,…]}

I am very new to elixir in hello world level. I tried googling but I am failed to figure the reason for this. Could somebody please help me on this?

Those warnings are all valid, the do occur because use … injects code into your module, and this code has exactly the mentioned problems.

You can’t do anything about it, but filing an issue with guardian.


Thanks for the reply. I will do that!