feifan
4
From that post you linked:
It turns out I can pass the bytecode to Code.Typespec.fetch_specs
directly. So from the original example, this should work:
_compiled_module, bytecode = Code.compile_string(
"""
defmodule UserDefinedGreeter do
@spec call(name :: String.t()) :: {:return, String.t()}
def call(name) do
{:return, "Hey " <> name}
end
end
"""
)
Code.Typespec.fetch_specs(bytecode)
1 Like