Skip to content

EDoc EEP-48 chunk includes private type when used by private function spec #10377

@g-andrade

Description

@g-andrade

Describe the bug
When a module defines a private type and a private function spec uses it, that type will be included in the EDoc chunk. As a result, the type will show up in documents generated with ExDoc.

To Reproduce
Using this demo app: rebar_edoc_test.zip.

make show-chunk | grep -C5 private_type
Image

Alternatively, here's the demo module:

-module(rebar_edoc_test).

-moduledoc "--".

%% ------------------------------------------------------------------
%% API Function Exports
%% ------------------------------------------------------------------

-export([exported_function/1]).

%% ------------------------------------------------------------------
%% Type Definitions
%% ------------------------------------------------------------------

-type exported_type() :: term().
-export_type([exported_type/0]).

-type private_type() :: term().

%% ------------------------------------------------------------------
%% API Function Definitions
%% ------------------------------------------------------------------

-spec exported_function(exported_type()) -> ok.
exported_function(V) -> private_function(V).

%% ------------------------------------------------------------------
%% private Function Definitions
%% ------------------------------------------------------------------

-spec private_function(private_type()) -> ok.
private_function(_) -> ok.

Expected behavior
I expected the internal type to not show up in the generated ExDoc documents. Since EEP-59 mentions that "private types are handled just as private functions", and that "private function should not end up in the EEP 48 doc chunk", it follows that the private type - used only by a private function - should not be included in the chunk, unless this definition has since been updated.

Affected versions

  • OTP 27.4.5 using rebar3 3.25.1

Additional context
Issue in rebar3_ex_doc, where I first thought the root cause might be.

Metadata

Metadata

Assignees

Labels

bugIssue is reported as a bugteam:VMAssigned to OTP team VM

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions