msz/hammox

"Cannot load module" error gets swallowed

msz opened this issue · 0 comments

msz commented

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"