@@ -145,10 +145,10 @@ defmodule Mix.Tasks.Compile.Protocols do
145
145
146
146
case Protocol . consolidate ( protocol , impls ) do
147
147
{ :ok , binary } ->
148
- File . write! ( Path . join ( output , "#{ protocol } .beam" ) , binary )
148
+ File . write! ( Path . join ( output , "#{ Atom . to_string ( protocol ) } .beam" ) , binary )
149
149
150
150
if opts [ :verbose ] do
151
- Mix . shell ( ) . info ( "Consolidated #{ inspect ( protocol ) } " )
151
+ Mix . shell ( ) . info ( "Consolidated #{ inspect_protocol ( protocol ) } " )
152
152
end
153
153
154
154
# If we remove a dependency and we have implemented one of its
@@ -161,11 +161,17 @@ defmodule Mix.Tasks.Compile.Protocols do
161
161
remove_consolidated ( protocol , output )
162
162
163
163
if opts [ :verbose ] do
164
- Mix . shell ( ) . info ( "Unavailable #{ inspect ( protocol ) } " )
164
+ Mix . shell ( ) . info ( "Unavailable #{ inspect_protocol ( protocol ) } " )
165
165
end
166
166
end
167
167
end
168
168
169
+ # We cannot use the inspect protocol while consolidating
170
+ # since inspect may not be available.
171
+ defp inspect_protocol ( protocol ) do
172
+ Code.Identifier . inspect_as_atom ( protocol )
173
+ end
174
+
169
175
defp reload ( module ) do
170
176
:code . purge ( module )
171
177
:code . delete ( module )
@@ -227,6 +233,6 @@ defmodule Mix.Tasks.Compile.Protocols do
227
233
end
228
234
229
235
defp remove_consolidated ( protocol , output ) do
230
- File . rm ( Path . join ( output , "#{ protocol } .beam" ) )
236
+ File . rm ( Path . join ( output , "#{ Atom . to_string ( protocol ) } .beam" ) )
231
237
end
232
238
end
0 commit comments