Skip to content

Commit

Permalink
Problem: 0-sized protocols still emit warning
Browse files Browse the repository at this point in the history
Solution:
 - Remove the warning that breaks generality.
  • Loading branch information
cognivore committed Feb 28, 2023
1 parent 29bcdde commit c998007
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
8 changes: 0 additions & 8 deletions lib/elixir/lib/protocol.ex
Original file line number Diff line number Diff line change
Expand Up @@ -768,14 +768,6 @@ defmodule Protocol do
callbacks = :maps.keys(callback_metas)
functions = Module.get_attribute(env.module, :__functions__)

if functions == [] do
warn(
"protocols must define at least one function, but none was defined",
env,
nil
)
end

# TODO: Convert the following warnings into errors in future Elixir versions
:lists.map(
fn {name, arity} = fa ->
Expand Down
7 changes: 0 additions & 7 deletions lib/elixir/test/elixir/protocol_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,6 @@ defmodule ProtocolTest do
describe "warnings" do
import ExUnit.CaptureIO

test "with no definitions" do
assert capture_io(:stderr, fn ->
defprotocol SampleWithNoDefinitions do
end
end) =~ "protocols must define at least one function, but none was defined"
end

test "when @callbacks and friends are defined inside a protocol" do
message =
capture_io(:stderr, fn ->
Expand Down

0 comments on commit c998007

Please sign in to comment.