Skip to content

Commit 99ce925

Browse files
author
José Valim
committed
Add @doc false to each gen* callback by default
1 parent adf4075 commit 99ce925

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

lib/elixir/lib/application/behaviour.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ defmodule Application.Behaviour do
4848
4949
"""
5050

51-
5251
# Starts the given application and all of its dependencies that
5352
# have not been started yet recursively.
5453
#
@@ -95,6 +94,7 @@ defmodule Application.Behaviour do
9594
quote location: :keep do
9695
@behavior :application
9796

97+
@doc false
9898
def stop(_state) do
9999
:ok
100100
end

lib/elixir/lib/gen_event/behaviour.ex

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,28 +55,34 @@ defmodule GenEvent.Behaviour do
5555
@doc false
5656
defmacro __using__(_) do
5757
quote location: :keep do
58-
@behavior :gen_event
58+
@behaviour :gen_event
5959

60+
@doc false
6061
def init(args) do
6162
{ :ok, args }
6263
end
6364

65+
@doc false
6466
def handle_event(_event, state) do
6567
{ :ok, state }
6668
end
6769

70+
@doc false
6871
def handle_call(_request, state) do
6972
{ :ok, :ok, state }
7073
end
7174

75+
@doc false
7276
def handle_info(_msg, state) do
7377
{ :ok, state }
7478
end
7579

80+
@doc false
7681
def terminate(reason, state) do
7782
:ok
7883
end
7984

85+
@doc false
8086
def code_change(_old, state, _extra) do
8187
{ :ok, state }
8288
end

lib/elixir/lib/gen_server/behaviour.ex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,26 +88,32 @@ defmodule GenServer.Behaviour do
8888
quote location: :keep do
8989
@behavior :gen_server
9090

91+
@doc false
9192
def init(args) do
9293
{ :ok, args }
9394
end
9495

96+
@doc false
9597
def handle_call(_request, _from, state) do
9698
{ :noreply, state }
9799
end
98100

101+
@doc false
99102
def handle_info(_msg, state) do
100103
{ :noreply, state }
101104
end
102105

106+
@doc false
103107
def handle_cast(_msg, state) do
104108
{ :noreply, state }
105109
end
106110

111+
@doc false
107112
def terminate(_reason, _state) do
108113
:ok
109114
end
110115

116+
@doc false
111117
def code_change(_old, state, _extra) do
112118
{ :ok, state }
113119
end

lib/elixir/lib/module.ex

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,17 +216,15 @@ defmodule Module do
216216
[] ->
217217
ETS.insert(table, { tuple, line, kind, signature, doc })
218218
:ok
219-
[{ tuple, line, _old_kind, old_sign, old_doc }] when old_doc == nil or doc == nil or old_doc == doc ->
219+
[{ tuple, line, _old_kind, old_sign, old_doc }] ->
220220
ETS.insert(table, {
221221
tuple,
222222
line,
223223
kind,
224224
merge_signatures(old_sign, signature, 1),
225-
doc || old_doc
225+
if(nil?(doc), do: old_doc, else: doc)
226226
})
227227
:ok
228-
_ ->
229-
{ :error, :existing_doc }
230228
end
231229
end
232230

@@ -556,8 +554,6 @@ defmodule Module do
556554
:ok
557555
{ :error, :private_doc } ->
558556
IO.puts "#{env.file}:#{line} function #{name}/#{arity} is private, @doc's are always discarded for private functions"
559-
{ :error, :existing_doc } ->
560-
IO.puts "#{env.file}:#{line} @doc's for function #{name}/#{arity} have been given more than once, the first version is being kept"
561557
end
562558

563559
delete_attribute(module, :doc)

0 commit comments

Comments
 (0)