@@ -333,13 +333,6 @@ defmodule Application do
333333 end
334334 end
335335
336- @ type app :: atom
337- @ type key :: atom
338- @ type value :: term
339- @ type state :: term
340- @ type start_type :: :normal | { :takeover , node } | { :failover , node }
341- @ type restart_type :: :permanent | :transient | :temporary
342-
343336 @ application_keys [
344337 :description ,
345338 :id ,
@@ -354,6 +347,16 @@ defmodule Application do
354347 :start_phases
355348 ]
356349
350+ application_key_specs = Enum . reduce ( @ application_keys , & { :| , [ ] , [ & 1 , & 2 ] } )
351+
352+ @ type app :: atom
353+ @ type key :: atom
354+ @ type application_key :: unquote ( application_key_specs )
355+ @ type value :: term
356+ @ type state :: term
357+ @ type start_type :: :normal | { :takeover , node } | { :failover , node }
358+ @ type restart_type :: :permanent | :transient | :temporary
359+
357360 @ doc """
358361 Returns the spec for `app`.
359362
@@ -364,7 +367,7 @@ defmodule Application do
364367 Note the environment is not returned as it can be accessed via
365368 `fetch_env/2`. Returns `nil` if the application is not loaded.
366369 """
367- @ spec spec ( app ) :: [ { key , value } ] | nil
370+ @ spec spec ( app ) :: [ { application_key , value } ] | nil
368371 def spec ( app ) when is_atom ( app ) do
369372 case :application . get_all_key ( app ) do
370373 { :ok , info } -> :lists . keydelete ( :env , 1 , info )
@@ -379,7 +382,7 @@ defmodule Application do
379382 specification parameter does not exist, this function
380383 will raise. Returns `nil` if the application is not loaded.
381384 """
382- @ spec spec ( app , key ) :: value | nil
385+ @ spec spec ( app , application_key ) :: value | nil
383386 def spec ( app , key ) when is_atom ( app ) and key in @ application_keys do
384387 case :application . get_key ( app , key ) do
385388 { :ok , value } -> value
0 commit comments