Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The call does not have an opaque term of type 'Elixir.Ecto.Multi':t() #2693

Closed
wojtekmach opened this issue Sep 20, 2018 · 0 comments
Closed

Comments

@wojtekmach
Copy link
Member

wojtekmach commented Sep 20, 2018

Environment

  • Elixir version (elixir -v): 1.8.0-dev
  • Ecto version (mix deps): master

Current behavior

This code:

defmodule Dummy do
  def foo(%Ecto.Multi{} = multi) do
    Ecto.Multi.to_list(multi)
  end
end

raises following dialyzer error:

$ mix dialyzer --format=dialyxir
Finding suitable PLTs
Checking PLT...
[:compiler, :connection, :crypto, :db_connection, :decimal, :ecto, :elixir, :kernel, :logger, :poison, :poolboy, :postgrex, :stdlib]
PLT is up to date!
Starting Dialyzer
[
  check_plt: false,
  init_plt: '/Users/wojtek/src/elixir-ecto/dummy/_build/dev/dialyxir_erlang-21.0.9_elixir-1.8.0-dev_deps-dev.plt',
  files_rec: ['/Users/wojtek/src/elixir-ecto/dummy/_build/dev/lib/dummy/ebin'],
  warnings: [:unknown]
]
Total errors: 2, Skipped: 0
done in 0m0.9s
lib/dummy.ex:27:no_return
Function foo/1 has no local return.
________________________________________________________________________________
lib/dummy.ex:28:call_without_opaque
The call Ecto.Multi.to_list(_multi@1::#{'__struct__':='Elixir.Ecto.Multi', _=>_}) does not have an opaque term of type 'Elixir.Ecto.Multi':t() in 1.
________________________________________________________________________________

Since it's pretty common to pattern match on Multi struct, but not internals, should we change:

@opaque t :: %__MODULE__{operations: [{name, operation}], names: MapSet.t}

to:

@typep operations :: [{name, operation}]
@typep names :: MapSet.t
@type t :: %__MODULE__{operations: operations, names: names}

?

Expected behavior

no error.

cc @AndrewDryga

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant