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

Docs for system_info/1 have duplicate entries #7501

Closed
sabiwara opened this issue Jul 16, 2023 · 2 comments · Fixed by #7502
Closed

Docs for system_info/1 have duplicate entries #7501

sabiwara opened this issue Jul 16, 2023 · 2 comments · Fixed by #7502
Assignees
Labels
bug Issue is reported as a bug

Comments

@sabiwara
Copy link
Contributor

Describe the bug
There are duplicate entries in the chunk file docs for system_info/1.
This seems due to the fact that the doc is broken in several sections.

To Reproduce

{ok, Binary} = file:read_file(ErlPath ++ "/lib/erts-14.0.1/doc/chunks/erlang.chunk"),
Docs = element(7, binary_to_term(Binary)),
9 = length([X || {{function, system_info, 1}, X, _, _, _} <- Docs]).

Expected behavior

Docs should all be grouped in a single entry.

1 = length([X || {{function, system_info, 1}, X, _, _, _} <- Docs]).

Affected versions
26.0.1

Additional context
Originally reported in Elixir: elixir-lang/elixir#12796.

@sabiwara sabiwara added the bug Issue is reported as a bug label Jul 16, 2023
@garazdawi garazdawi self-assigned this Jul 17, 2023
@garazdawi
Copy link
Contributor

Hello, thanks for the report!

The erlang:system_info/1 documentation has been fixed in #7472 which will be part of the next patch (which will also update the website docs).

Regarding multiple entries in the chunk, that works as intended. In Erlang we can document separate clauses of the same MFA using different docs. In the doc chunks this is handles by having multiple entries with the same FA in the list of docs. When a renderer encounters this they can either treat them as separate entries (which is what ExDoc does) or just as one entry (which is what the h in the erlang shell does*). For example here is how the text for erlang:halt/1 looks like:

1> h(erlang,halt,1).

  -spec halt(Status :: non_neg_integer()) -> no_return().

  The same as calling halt(Status, []). Example:

    > halt(17).
    os_prompt% echo $?
    17
    os_prompt%

  -spec halt(Abort :: abort) -> no_return().

Since:
  OTP R15B01

  The same as calling halt(abort, []).

  -spec halt(CrashDumpSlogan :: string()) -> no_return().

  The same as calling halt(CrashDumpSlogan, []).

Note that there are three entries just as in the html docs.

* or rather should do, when I checked to verify the behavior I found that a bug had sneaked in while fixing an issue with the @equiv metadata. The bug is fixed in #7502.

@garazdawi garazdawi linked a pull request Jul 17, 2023 that will close this issue
@sabiwara
Copy link
Contributor Author

Thank you so much for the answer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants