Skip to content

Unknown error occurred: %FunctionClauseError{module: Dialyxir.Warnings.InvalidContract, function: :format_long, arity: 1, kind: nil, args: nil, clauses: nil} #525

@juise

Description

@juise

Environment

  • Elixir & Erlang/OTP versions (elixir --version):
% elixir --version
Erlang/OTP 26 [erts-14.1.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]

Elixir 1.15.7 (compiled with Erlang/OTP 26)
  • Which version of Dialyxir are you using? (cat mix.lock | grep dialyxir):
% cat mix.lock | grep dialyxir
  "dialyxir": {:hex, :dialyxir, "1.4.1", "a22ed1e7bd3a3e3f197b68d806ef66acb61ee8f57b3ac85fc5d57354c5482a93", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "84b795d6d7796297cca5a3118444b80c7d94f7ce247d49886e7c291e1ae49801"}

Current behavior

  @spec abc(Q.t(), R.t()) :: {:ok, X.Adapter.result()} | {:error, String.t()}
  def abc(terminal, tx) do
    {:error, {:a, :b}}
  end
Unknown error occurred: %FunctionClauseError{module: Dialyxir.Warnings.InvalidContract, function: :format_long, arity: 1, kind: nil, args: nil, clauses: nil}

Legacy warning:
lib/x/adapters/y/payments.ex:52: Invalid type specification for function 'Elixir.X.Adapters.Y.Payments':abc/2.
 The success typing is 'Elixir.X.Adapters.Y.Payments':abc(_,_) -> {'error',{'a','b'}}
 But the spec is 'Elixir.X.Adapters.Y.Payments':abc('Elixir.X.Z.Q':t(),'Elixir.X.Z.R':t()) -> {'ok','Elixir.X.Adapter':result()} | {'error','Elixir.String':t()}
 The return types do not overlap

This function was intentionally implemented as-is, to test/verify dialyzer/dialyxir works, because there is another function that violates the spec, but dialyzer/dialyxir doesn't catch it at all for some reason.

Expected behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions