hammox icon indicating copy to clipboard operation
hammox copied to clipboard

"Cannot load module" error gets swallowed

Open msz opened this issue 3 years ago • 0 comments

In a complex type, when there is a module that cannot be loaded, and the types are similar (the type match stacks are the same height) the error is instead that it couldn't match the last element of the union. Possible working example:

defmodule Module1 do
  @type t :: :module1
end

defmodule Module3 do
  @type t :: :module3
end

defmodule Foo do
  @callback foo() :: {:ok, Module1.t()} | {:ok, Module2.t()} | {:ok, Module3.t()}
  def foo, do: {:ok, :nothing}
end

Expected kind of error from calling protected Foo.foo/0: "Could not load Module2" Actual kind of error from calling protected Foo.foo/0: "Could not match Module3"

msz avatar Nov 18 '21 12:11 msz