Qqwy / elixir-type_check

TypeCheck: Fast and flexible runtime type-checking for your Elixir projects.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Qualified type name is not (always) picked up in specs

Qqwy opened this issue · comments

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

The fix is part of the now-published release v0.12.4.