Dialyxir.Warnings.OpaqueMatch (Dialyxir v1.4.4) View Source

Attempted to pattern match against the internal structure of an opaque term.

Example

defmodule OpaqueStruct do
  defstruct [:opaque]

  @opaque t :: %__MODULE__{}

  @spec opaque() :: t
  def opaque() do
    %__MODULE__{}
  end
end

defmodule Example do
  @spec error() :: :error
  def error() do
    %{opaque: _} = OpaqueStruct.opaque()
    :error
  end
end