Skip to content

Commit 3c8a005

Browse files
authored
Default defimpl to @moduledoc false (#13295)
1 parent 811f3f0 commit 3c8a005

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

lib/elixir/lib/protocol.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,7 @@ defmodule Protocol do
972972
Protocol.__ensure_defimpl__(protocol, for, __ENV__)
973973

974974
defmodule name do
975+
@moduledoc false
975976
@behaviour protocol
976977
@protocol protocol
977978
@for for

lib/elixir/scripts/elixir_docs.exs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ canonical = System.fetch_env!("CANONICAL")
7979
skip_undefined_reference_warnings_on: [
8080
"lib/elixir/pages/references/compatibility-and-deprecations.md"
8181
],
82+
skip_code_autolink_to: [
83+
"Enumerable.List",
84+
"Inspect.MapSet"
85+
],
8286
formatters: ["html", "epub"],
8387
groups_for_modules: [
8488
# [Kernel, Kernel.SpecialForms],

lib/elixir/test/elixir/protocol_test.exs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,20 @@ defmodule ProtocolTest do
133133
end
134134
)
135135

136+
write_beam(
137+
defimpl SampleDocsProto, for: List do
138+
def ok(_), do: true
139+
end
140+
)
141+
142+
write_beam(
143+
defimpl SampleDocsProto, for: Map do
144+
@moduledoc "for map"
145+
146+
def ok(_), do: true
147+
end
148+
)
149+
136150
{:docs_v1, _, _, _, _, _, docs} = Code.fetch_docs(SampleDocsProto)
137151

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

144158
deprecated = SampleDocsProto.__info__(:deprecated)
145159
assert [{{:ok, 1}, "Reason"}] = deprecated
160+
161+
{:docs_v1, _, _, _, :hidden, _, _} = Code.fetch_docs(SampleDocsProto.List)
162+
{:docs_v1, _, _, _, moduledoc, _, _} = Code.fetch_docs(SampleDocsProto.Map)
163+
assert moduledoc == %{"en" => "for map"}
146164
end
147165

148166
@compile {:no_warn_undefined, WithAll}

0 commit comments

Comments
 (0)