Skip to content

Commit 4f0b0d9

Browse files
committed
Use ensure_compiled for verifying protocol implementations
1 parent 6c7f6e7 commit 4f0b0d9

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/elixir/lib/protocol.ex

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,8 +1104,7 @@ defmodule Protocol do
11041104

11051105
# TODO: Make this an error on Elixir v2.0
11061106
if for != Any and not Keyword.has_key?(built_in(), for) and for != env.module and
1107-
for not in env.context_modules and
1108-
not Code.ensure_loaded?(for) do
1107+
for not in env.context_modules and Code.ensure_compiled(for) != {:module, for} do
11091108
IO.warn(
11101109
"you are implementing a protocol for #{inspect(for)} but said module is not available. " <>
11111110
"Make sure the module name is correct. If #{inspect(for)} is an optional dependency, " <>

0 commit comments

Comments
 (0)