@@ -573,7 +573,12 @@ defmodule Protocol do
573573 case :beam_lib . chunks ( beam_file ( protocol ) , chunk_ids , opts ) do
574574 { :ok , { ^ protocol , [ { :debug_info , debug_info } | chunks ] } } ->
575575 { :debug_info_v1 , _backend , { :elixir_v1 , module_map , specs } } = debug_info
576- % { attributes: attributes , definitions: definitions , signatures: signatures } = module_map
576+ % { attributes: attributes , definitions: definitions } = module_map
577+
578+ # Protocols in precompiled archives may not have signatures, so we default to an empty map.
579+ # TODO: Remove this on Elixir v1.23.
580+ signatures = Map . get ( module_map , :signatures , % { } )
581+
577582 chunks = :lists . filter ( fn { _name , value } -> value != :missing_chunk end , chunks )
578583 chunks = :lists . map ( fn { name , value } -> { List . to_string ( name ) , value } end , chunks )
579584
@@ -736,7 +741,9 @@ defmodule Protocol do
736741
737742 # Finally compile the module and emit its bytecode.
738743 defp compile ( definitions , signatures , { module_map , specs , docs_chunk } ) do
739- module_map = % { module_map | definitions: definitions , signatures: signatures }
744+ # Protocols in precompiled archives may not have signatures, so we default to an empty map.
745+ # TODO: Remove this on Elixir v1.23.
746+ module_map = % { module_map | definitions: definitions } |> Map . put ( :signatures , signatures )
740747 { :ok , :elixir_erl . consolidate ( module_map , specs , docs_chunk ) }
741748 end
742749
@@ -817,7 +824,7 @@ defmodule Protocol do
817824 callback_metas = callback_metas ( env . module , :callback )
818825 callbacks = :maps . keys ( callback_metas )
819826
820- # TODO: Convert the following warnings into errors in future Elixir versions
827+ # TODO: Make an error on Elixir v2.0
821828 :lists . foreach (
822829 fn { name , arity } = fa ->
823830 warn (
@@ -833,6 +840,7 @@ defmodule Protocol do
833840 macrocallback_metas = callback_metas ( env . module , :macrocallback )
834841 macrocallbacks = :maps . keys ( macrocallback_metas )
835842
843+ # TODO: Make an error on Elixir v2.0
836844 :lists . foreach (
837845 fn { name , arity } = fa ->
838846 warn (
0 commit comments