@@ -338,10 +338,12 @@ defmodule ExDoc.Retriever.ErlangTest do
338
338
d = 1,
339
339
e}).
340
340
341
- -type type() :: #a{}.
341
+ % We explicitly name the type union because that's an internal type
342
+ % and we want to make sure we deal with conflicts properly.
343
+ -type union() :: #a{}.
342
344
-callback callback() -> #a{}.
343
345
344
- -spec function() -> type () | #a{ a :: integer(), b :: integer() }.
346
+ -spec function() -> union () | #a{ a :: integer(), b :: integer() }.
345
347
function() -> ok.
346
348
""" )
347
349
@@ -351,15 +353,15 @@ defmodule ExDoc.Retriever.ErlangTest do
351
353
352
354
assert hd ( function . specs )
353
355
|> Erlang . autolink_spec ( current_module: :mod , current_kfa: { :function , :function , 0 } ) ==
354
- "function() -> <a href=\" #t:type /0\" >type </a>() | #a{a :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:integer/0\" >integer</a>(), b :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:integer/0\" >integer</a>(), c :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:atom/0\" >atom</a>(), d :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:term/0\" >term</a>(), e :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:term/0\" >term</a>()}."
356
+ "function() -> <a href=\" #t:union /0\" >union </a>() | #a{a :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:integer/0\" >integer</a>(), b :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:integer/0\" >integer</a>(), c :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:atom/0\" >atom</a>(), d :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:term/0\" >term</a>(), e :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:term/0\" >term</a>()}."
355
357
356
358
assert hd ( callback . specs )
357
359
|> Erlang . autolink_spec ( current_module: :mod , current_kfa: { :callback , :callback , 0 } ) ==
358
360
"callback() ->\n #a{a :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:pos_integer/0\" >pos_integer</a>(), b :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:non_neg_integer/0\" >non_neg_integer</a>(), c :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:atom/0\" >atom</a>(), d :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:term/0\" >term</a>(), e :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:term/0\" >term</a>()}."
359
361
360
362
assert hd ( type . specs )
361
- |> Erlang . autolink_spec ( current_module: :mod , current_kfa: { :type , :type , 0 } ) ==
362
- "type () :: #a{a :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:pos_integer/0\" >pos_integer</a>(), b :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:non_neg_integer/0\" >non_neg_integer</a>(), c :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:atom/0\" >atom</a>(), d :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:term/0\" >term</a>(), e :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:term/0\" >term</a>()}."
363
+ |> Erlang . autolink_spec ( current_module: :mod , current_kfa: { :type , :union , 0 } ) ==
364
+ "union () :: #a{a :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:pos_integer/0\" >pos_integer</a>(), b :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:non_neg_integer/0\" >non_neg_integer</a>(), c :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:atom/0\" >atom</a>(), d :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:term/0\" >term</a>(), e :: <a href=\" https://www.erlang.org/doc/apps/erts/erlang.html#t:term/0\" >term</a>()}."
363
365
end
364
366
end
365
367
0 commit comments