-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementation of EEP-59 - Documentation Attributes - Documentation attributes are added to the binary beam file, following format of [EEP-48](https://www.erlang.org/eeps/eep-0048), via `+beam_docs` compiler flag - Warnings related to documentation attributes are dealt with in the `beam_docs.erl` instead of adding them to `erl_lint.erl` *Example 1* ```erlang -module(warn_missing_doc). -export([test/0, test/1, test/2]). -export_type([test/0, test/1]). -type test() :: ok. -type test(N) :: N. -callback test() -> ok. -include("warn_missing_doc.hrl"). test() -> ok. test(N) -> N. ``` Using the compiler flag `warn_missing_doc` will raise a warning when doc. attributes are missing in exported functions, types, and callbacks. *Example 2* ```erlang -module(doc_with_file). -export([main/1]). -moduledoc {file, "README"}. -doc {file, "FUN"}. -spec main(Var) -> foo(Var). main(X) -> X. ``` `moduledoc`s and `doc`s may refer to external files to be embedded. *Example 3 - Warnings and Types* ```erlang -export([uses_public/0]). -export_type([public/0]). -doc false. -type hidden_type() :: integer(). -type intermediate() :: hidden_type(). -type public() :: intermediate(). -spec uses_public() -> public(). uses_public() -> ok. ``` Compiler warns about exported functions whose specs refer to hidden types. In the example above, the `hidden_type()` is set as `hidden` either via `-doc false` or `-doc hidden` and `public() :> intermediate() :> hidden_type()`. When documentation attributes mark a type as hidden, they won't be part of the documentation. Thus, the warning that the `hidden_type()` is not part of the documentation, yet used in an exported function.
- Loading branch information
1 parent
dc539b2
commit f2f48e3
Showing
79 changed files
with
3,460 additions
and
83 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.