-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
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
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.