when adding document to private function by @doc, in vscode compiler gives the warning message.
I can’t find @docp for @doc.
defp check_subscript!/3 is private, @doc attribute is always discarded for private functions/macros/typesElixir
function is as follows:
@doc """
check subscript decreasing or increasing
"""
defp check_subscript!(x, x1, x2)
when x > x1 and x1 > x2 and
is_integer(x) and is_integer(x1) and is_integer(x2) do
:ok
end
>Solution :
Here is the excerpt from Writing Documentation
Because private functions cannot be accessed externally, elixir will warn if a private function has a
@docattribute and will discard its content. However, you can add code comments to private functions, as with any other piece of code, and we recommend developers to do so whenever they believe it will add relevant information to the readers and maintainers of such code.
That said, the comment for the private function would look like below.
# check subscript decreasing or increasing
defp check_subscript!(x, x1, x2) do
:ok
end