Skip to content

Commit c46b012

Browse files
authored
Fix so that fun() in Erlang does not try to generate any link (#2079)
1 parent 344026c commit c46b012

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@ jobs:
8181
# Test Erlang without -doc attribute support
8282
- elixir: "1.16"
8383
otp: "26"
84-
# Test Erlang with -doc attribute support
84+
# Test with initial Erlang doc attribute support
8585
- elixir: "1.17"
8686
otp: "27"
87+
- elixir: "1.18"
88+
otp: "27"
8789
lint: true
8890
steps:
8991
- uses: actions/checkout@v3

lib/ex_doc/language/elixir.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ defmodule ExDoc.Language.Elixir do
289289
{:local, :..}
290290

291291
["//", "", ""] ->
292-
{:local, :"..//"}
292+
{:local, :..//}
293293

294294
["", ""] ->
295295
{:local, :.}

lib/ex_doc/language/erlang.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ defmodule ExDoc.Language.Erlang do
571571
name == :record and acc != [] ->
572572
{ast, acc}
573573

574-
name in [:"::", :when, :%{}, :{}, :|, :->, :...] ->
574+
name in [:"::", :when, :%{}, :{}, :|, :->, :..., :fun] ->
575575
{ast, acc}
576576

577577
# %{required(...) => ..., optional(...) => ...}

test/ex_doc/language/erlang_test.exs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,14 @@ defmodule ExDoc.Language.ErlangTest do
814814
end
815815
end
816816

817+
test "function - specific arity", c do
818+
assert autolink_spec(~s"-spec foo() -> fun((t()) -> t()) | erlang_bar:t().", c) ==
819+
~s[foo() -> fun((<a href="#t:t/0">t</a>()) -> <a href="#t:t/0">t</a>()) | <a href="erlang_bar.html#t:t/0">erlang_bar:t</a>().]
820+
821+
assert autolink_spec(~s"-spec foo() -> fun((t(), t()) -> t()) | erlang_bar:t().", c) ==
822+
~s[foo() -> fun((<a href="#t:t/0">t</a>(), <a href="#t:t/0">t</a>()) -> <a href="#t:t/0">t</a>()) | <a href="erlang_bar.html#t:t/0">erlang_bar:t</a>().]
823+
end
824+
817825
test "local type", c do
818826
assert autolink_spec(~S"-spec foo() -> t().", c) ==
819827
~s|foo() -> <a href="#t:t/0">t</a>().|

0 commit comments

Comments
 (0)