Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix so that fun() in Erlang does not try to generate any link #2079

Merged
merged 3 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ jobs:
# Test Erlang without -doc attribute support
- elixir: "1.16"
otp: "26"
# Test Erlang with -doc attribute support
# Test with initial Erlang doc attribute support
- elixir: "1.17"
otp: "27"
- elixir: "1.18"
otp: "27"
lint: true
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion lib/ex_doc/language/elixir.ex
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ defmodule ExDoc.Language.Elixir do
{:local, :..}

["//", "", ""] ->
{:local, :"..//"}
{:local, :..//}

["", ""] ->
{:local, :.}
Expand Down
2 changes: 1 addition & 1 deletion lib/ex_doc/language/erlang.ex
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ defmodule ExDoc.Language.Erlang do
name == :record and acc != [] ->
{ast, acc}

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

# %{required(...) => ..., optional(...) => ...}
Expand Down
8 changes: 8 additions & 0 deletions test/ex_doc/language/erlang_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,14 @@ defmodule ExDoc.Language.ErlangTest do
end
end

test "function - specific arity", c do
assert autolink_spec(~s"-spec foo() -> fun((t()) -> t()) | erlang_bar:t().", c) ==
~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>().]

assert autolink_spec(~s"-spec foo() -> fun((t(), t()) -> t()) | erlang_bar:t().", c) ==
~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>().]
end

test "local type", c do
assert autolink_spec(~S"-spec foo() -> t().", c) ==
~s|foo() -> <a href="#t:t/0">t</a>().|
Expand Down