Skip to content

Commit 8dd06cd

Browse files
committed
Do not skip autolink of record/N types, only for #record{} types.
1 parent 3880fd1 commit 8dd06cd

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

lib/ex_doc/language/erlang.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ defmodule ExDoc.Language.Erlang do
570570
arity = length(args)
571571

572572
cond do
573-
name == :record and acc != [] ->
573+
name == :record and args != [] and acc != [] ->
574574
{ast, acc}
575575

576576
name in [:"::", :when, :%{}, :{}, :|, :->, :..., :fun] ->

test/ex_doc/language/erlang_test.exs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,13 @@ defmodule ExDoc.Language.ErlangTest do
708708
~s| <a href="https://www.erlang.org/doc/apps/erts/erlang.html#t:atom/0">atom</a>()}]].|
709709
end
710710

711+
if System.otp_release() >= "29" do
712+
test "spec referencing builtin record/0 type", c do
713+
assert autolink_spec("-spec foo() -> record().", c) ==
714+
~s|foo() -> <a href="https://www.erlang.org/doc/apps/erts/erlang.html#t:record/0">record</a>().|
715+
end
716+
end
717+
711718
test "callback", c do
712719
assert autolink_spec("-callback foo() -> t().", c) ==
713720
~s|foo() -> <a href="#t:t/0">t</a>().|

0 commit comments

Comments
 (0)