[erlang-bugs] edoc mangles parameterized function specs

Ulf Wiger <>
Fri Dec 30 16:38:52 CET 2011


I was made aware that EDoc doesn't present parameterized types, so I started looking into that.

I first thought that it generalizes the types, but it actually truncates them! This will invariably result in a wrong type being documented.

For example:

-module(t).
-export([f/1]).

-spec f(a) -> 1;
       (b) -> 2.
f(a) -> 1;
f(b) -> 2.

If I document this with R15B Edoc, the rendered type signature will be:

f(X1::a) -> 1

…which is simply wrong.

I have traced it down to edoc_extract.erl

selected_specs([], Ts) ->
    Ts;
selected_specs([F], [_ | Ts]) ->
    [edoc_specs:spec(F, _Clause=1) | Ts].

Only the first clause is extracted. Is that deliberate?

BR,
Ulf W



More information about the erlang-bugs mailing list