@@ -85,15 +85,11 @@ capture_require({{'.', DotMeta, [Left, Right]}, RequireMeta, Args}, S, E, ArgsTy
8585 {ELeft , SE , EE } = elixir_expand :expand (EscLeft , S , E ),
8686
8787 case ELeft of
88- _ when ArgsType /= arity ->
89- ok ;
90- Atom when is_atom (Atom ) ->
91- ok ;
92- {Var , _ , Ctx } when is_atom (Var ), is_atom (Ctx ) ->
93- ok ;
94- _ ->
95- elixir_errors :file_warn (RequireMeta , E , ? MODULE ,
96- {complex_module_capture , Left , Right , length (Args )})
88+ _ when ArgsType /= arity -> ok ;
89+ Atom when is_atom (Atom ) -> ok ;
90+ {Var , _ , Ctx } when is_atom (Var ), is_atom (Ctx ) -> ok ;
91+ % % TODO: Raise on Elixir v2.0
92+ _ -> elixir_errors :file_warn (RequireMeta , E , ? MODULE , {complex_module_capture , Left })
9793 end ,
9894
9995 Res = ArgsType /= non_sequential andalso case ELeft of
@@ -124,7 +120,7 @@ capture_expr(Meta, Expr, S, E, Escaped, ArgsType) ->
124120 case escape (Expr , E , Escaped ) of
125121 {_ , []} when ArgsType == non_sequential ->
126122 invalid_capture (Meta , Expr , E );
127- % TODO remove this clause once we raise on complex module captures like &get_mod().fun/0
123+ % % TODO: Remove this clause once we raise on complex module captures like &get_mod().fun/0
128124 {{{'.' , _ , [_ , _ ]} = Dot , _ , Args }, []} ->
129125 Meta2 = lists :keydelete (no_parens , 1 , Meta ),
130126 Fn = {fn , Meta2 , [{'->' , Meta2 , [[], {Dot , Meta2 , Args }]}]},
@@ -199,13 +195,10 @@ format_error({parens_remote_capture, Mod, Fun}) ->
199195 io_lib :format (" extra parentheses on a remote function capture &~ts .~ts ()/0 have been "
200196 " deprecated. Please remove the parentheses: &~ts .~ts /0" ,
201197 ['Elixir.Macro' :to_string (Mod ), Fun , 'Elixir.Macro' :to_string (Mod ), Fun ]);
202- format_error ({complex_module_capture , Mod , Fun , Arity }) ->
203- io_lib :format (" using complex expressions for modules in &module.function/arity capture syntax has been deprecated:\n "
204- " &~ts .~ts /~B \n\n "
205- " You can either:\n "
206- " * use the fn syntax\n "
207- " * assign the module to a variable if it can be evaluated outside of the capture" ,
208- ['Elixir.Macro' :to_string (Mod ), Fun , Arity ]);
198+ format_error ({complex_module_capture , Mod }) ->
199+ io_lib :format (" expected the module in &module.fun/arity to expand to a variable or an atom, got: ~ts \n "
200+ " You can either compute the module name outside of & or convert it to a regular anonymous function." ,
201+ ['Elixir.Macro' :to_string (Mod )]);
209202format_error (clauses_with_different_arities ) ->
210203 " cannot mix clauses with different arities in anonymous functions" ;
211204format_error (defaults_in_args ) ->
0 commit comments