defmodule Foo do
@spec x() :: integer()
def x(), do: 5
def spec(), do: @spec
end
iex> Foo.spec() #=> nil
iex> Foo.spec() #=>
[
{:spec, {:::, [line: 2], [{:x, [line: 2], nil}, {:integer, [line: 2], []}]},
{Foo, {2, 1}}}
]
I was accessing @spec via Module.get_attribute(__MODULE__, :spec) in defmacro __before_compile__(_). Same observations.
also would love a fix for this, my precious behaves_like is broken 馃槶
Same here - type-checking of foreign function interface to Elixir in Elchemy relies on it
Most helpful comment
I was accessing
@specviaModule.get_attribute(__MODULE__, :spec)indefmacro __before_compile__(_). Same observations.