[erlang-questions] edoc: documenting "-type"

Magnus Henoch magnus@REDACTED
Mon Feb 18 15:12:30 CET 2013


Serge Aleynikov <serge@REDACTED> writes:

> I have a similar question. In the following test module the generated
> documentation for proto() type includes proper comment, but the
> options() doc doesn't include comment.  It seems to be immaterial if "%%
> Protocol options." appear on the same line as the ending "]." of the
> options() type or the next line. Why is the edoc generator doesn't
> include comment for the options() type?

I played with your example a bit, and found that the documentation does
get included if the closing square bracket is on the same line as the
second alternative:

-module(test).
-export([t/2]).

-type proto() :: tcp | ssl.
%% Protocol type.

-type options() :: [
          {server, Server::string()}
        | {port, Port::integer()}].
%% Protocol options.
%%     * Server - server to connect to (no MX lookup)
%%     * Relay  - domain to do MX lookup of list of servers

-spec t(Proto :: proto(), Options :: options()) -> ok.
t(_Proto, _Options) -> ok.

Tested with edoc from R15B03.  Hope this helps someone find the bug...

Regards,
Magnus



More information about the erlang-questions mailing list