Qualified type name is not (always) picked up in specs
Qqwy opened this issue · comments
Qqwy / Marten commented
Given:
defmodule EmptyMix do
defstruct [:name]
use TypeCheck, enable_runtime_checks: Mix.env() != :prod
@type! t :: %__MODULE__{name: String.t()}
@spec! example(%{optional(String.t()) => any} | EmptyMix.t()) :: EmptyMix.t()
def example(%__MODULE__{} = struct), do: struct
end
one would expect this module to compile.
However, it fails with:
** (UndefinedFunctionError) function EmptyMix.t/0 is undefined (function not available)
Replacing EmptyMix.t()
with plain t()
circumvents the problem, but the library should be able to figure this out by itself.
Originated from #152
Qqwy / Marten commented
The fix is part of the now-published release v0.12.4.