@@ -338,10 +338,12 @@ defmodule ExDoc.Retriever.ErlangTest do
338338 d = 1,
339339 e}).
340340
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{}.
342344 -callback callback() -> #a{}.
343345
344- -spec function() -> type () | #a{ a :: integer(), b :: integer() }.
346+ -spec function() -> union () | #a{ a :: integer(), b :: integer() }.
345347 function() -> ok.
346348 """ )
347349
@@ -351,15 +353,15 @@ defmodule ExDoc.Retriever.ErlangTest do
351353
352354 assert hd ( function . specs )
353355 |> 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>()}."
355357
356358 assert hd ( callback . specs )
357359 |> Erlang . autolink_spec ( current_module: :mod , current_kfa: { :callback , :callback , 0 } ) ==
358360 "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>()}."
359361
360362 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>()}."
363365 end
364366 end
365367
0 commit comments