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

Default defimpl to @moduledoc false #13295

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/elixir/lib/protocol.ex
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,7 @@ defmodule Protocol do
Protocol.__ensure_defimpl__(protocol, for, __ENV__)

defmodule name do
@moduledoc false
@behaviour protocol
@protocol protocol
@for for
Expand Down
4 changes: 4 additions & 0 deletions lib/elixir/scripts/elixir_docs.exs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ canonical = System.fetch_env!("CANONICAL")
skip_undefined_reference_warnings_on: [
"lib/elixir/pages/references/compatibility-and-deprecations.md"
],
skip_code_autolink_to: [
"Enumerable.List",
"Inspect.MapSet"
],
formatters: ["html", "epub"],
groups_for_modules: [
# [Kernel, Kernel.SpecialForms],
Expand Down
18 changes: 18 additions & 0 deletions lib/elixir/test/elixir/protocol_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,20 @@ defmodule ProtocolTest do
end
)

write_beam(
defimpl SampleDocsProto, for: List do
def ok(_), do: true
end
)

write_beam(
defimpl SampleDocsProto, for: Map do
@moduledoc "for map"

def ok(_), do: true
end
)

{:docs_v1, _, _, _, _, _, docs} = Code.fetch_docs(SampleDocsProto)

assert {{:type, :t, 0}, _, [], %{"en" => type_doc}, _} = List.keyfind(docs, {:type, :t, 0}, 0)
Expand All @@ -143,6 +157,10 @@ defmodule ProtocolTest do

deprecated = SampleDocsProto.__info__(:deprecated)
assert [{{:ok, 1}, "Reason"}] = deprecated

{:docs_v1, _, _, _, :hidden, _, _} = Code.fetch_docs(SampleDocsProto.List)
{:docs_v1, _, _, _, moduledoc, _, _} = Code.fetch_docs(SampleDocsProto.Map)
assert moduledoc == %{"en" => "for map"}
end

@compile {:no_warn_undefined, WithAll}
Expand Down
Loading