@@ -63,37 +63,30 @@ defmodule Module.Types do
6363
6464    stack  =  stack ( :infer ,  file ,  module ,  { :__info__ ,  1 } ,  :all ,  env ,  handler ) 
6565
66-     { types ,  % { local_sigs:  local_sigs } }  = 
67-       for  { fun_arity ,  kind ,  meta ,  clauses }  =  def  <-  defs ,  reduce:  { [ ] ,  context ( ) }  do 
66+     { types ,  % { local_sigs:  local_sigs }  =  context }  = 
67+       for  { fun_arity ,  kind ,  meta ,  _clauses }  =  def  <-  defs , 
68+           kind  in  [ :def ,  :defmacro ]  or  ( kind  ==  :defmacrop  and  is_map_key ( defmacrop ,  fun_arity ) ) , 
69+           reduce:  { [ ] ,  context ( ) }  do 
6870        { types ,  context }  -> 
69-           cond  do 
70-             kind  in  [ :def ,  :defmacro ]  -> 
71-               finder  =  fn  _  ->  { infer_mode ( kind ,  infer_signatures? ) ,  def }  end 
72-               { _kind ,  inferred ,  context }  =  local_handler ( meta ,  fun_arity ,  stack ,  context ,  finder ) 
73- 
74-               if  infer_signatures?  and  kind  ==  :def  and  fun_arity  not in  @ no_infer  do 
75-                 { [ { fun_arity ,  inferred }  |  types ] ,  context } 
76-               else 
77-                 { types ,  context } 
78-               end 
79- 
80-             kind  ==  :defmacrop  and  is_map_key ( defmacrop ,  fun_arity )  -> 
81-               # Bypass the caching structure for defmacrop, that's because 
82-               # we don't need them stored in the signatures when we perform 
83-               # unreachable checks. This may cause defmacrop to be traversed 
84-               # twice if it uses default arguments (which is the only way 
85-               # to refer to another defmacrop in definitions) but that should 
86-               # be cheap anyway. 
87-               { _kind ,  _inferred ,  context }  = 
88-                 local_handler ( fun_arity ,  kind ,  meta ,  clauses ,  :traversal ,  stack ,  context ) 
89- 
90-               { types ,  context } 
91- 
92-             true  -> 
93-               { types ,  context } 
71+           finder  =  fn  _  ->  { infer_mode ( kind ,  infer_signatures? ) ,  def }  end 
72+           { _kind ,  inferred ,  context }  =  local_handler ( meta ,  fun_arity ,  stack ,  context ,  finder ) 
73+ 
74+           if  infer_signatures?  and  kind  ==  :def  and  fun_arity  not in  @ no_infer  do 
75+             { [ { fun_arity ,  inferred }  |  types ] ,  context } 
76+           else 
77+             { types ,  context } 
9478          end 
9579      end 
9680
81+     for  { fun_arity ,  kind ,  meta ,  _clauses }  =  def  <-  defs , 
82+         kind  in  [ :defp ,  :defmacrop ] , 
83+         reduce:  context  do 
84+       context  -> 
85+         finder  =  fn  _  ->  { :traversal ,  def }  end 
86+         { _kind ,  _inferred ,  context }  =  local_handler ( meta ,  fun_arity ,  stack ,  context ,  finder ) 
87+         context 
88+     end 
89+ 
9790    unreachable  = 
9891      for  { fun_arity ,  _kind ,  _meta ,  _defaults }  =  info  <-  private , 
9992          warn_unused_def ( info ,  local_sigs ,  defmacrop ,  env ) , 
0 commit comments