Skip to content

Commit 04ecc05

Browse files
author
José Valim
committed
Remove warnings for docs in the same clause
Unfortunately this leads to false positives when trying to override the docs of an overridable definition. Signed-off-by: José Valim <[email protected]>
1 parent 8aab53b commit 04ecc05

File tree

2 files changed

+0
-38
lines changed

2 files changed

+0
-38
lines changed

lib/elixir/lib/module.ex

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,16 +1331,6 @@ defmodule Module do
13311331

13321332
[{_, current_line, current_sign, current_doc, current_doc_meta}] ->
13331333
signature = merge_signatures(current_sign, signature, 1)
1334-
1335-
if is_binary(doc) and is_binary(current_doc) and not is_nil(body) do
1336-
message =
1337-
"redefining @doc attribute previously set at line #{current_line}. " <>
1338-
"If you want to redefine a previously specified doc, " <>
1339-
"use a definition without a body after the original documentation"
1340-
1341-
:elixir_errors.warn(line, env.file, message)
1342-
end
1343-
13441334
doc = if is_nil(doc), do: current_doc, else: doc
13451335
doc = if is_nil(doc) && impl, do: false, else: doc
13461336
doc_meta = Map.merge(current_doc_meta, doc_meta)

lib/elixir/test/elixir/kernel/warning_test.exs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,34 +1109,6 @@ defmodule Kernel.WarningTest do
11091109
purge(Sample)
11101110
end
11111111

1112-
test "duplicated docs across multiple clauses" do
1113-
output =
1114-
capture_err(fn ->
1115-
Code.eval_string("""
1116-
defmodule Sample do
1117-
@doc "Something"
1118-
def foo(a)
1119-
1120-
@doc "Something"
1121-
def foo(1), do: :ok
1122-
1123-
@doc "Something"
1124-
def foo(2), do: :ok
1125-
1126-
@doc "Something"
1127-
def foo(a)
1128-
end
1129-
""")
1130-
end)
1131-
1132-
assert output =~ "redefining @doc attribute previously set at line 2"
1133-
assert output =~ "nofile:5"
1134-
assert output =~ "nofile:8"
1135-
refute output =~ "nofile:11"
1136-
after
1137-
purge(Sample)
1138-
end
1139-
11401112
test "reserved doc metadata keys" do
11411113
output =
11421114
capture_err(fn ->

0 commit comments

Comments
 (0)