@@ -211,6 +211,8 @@ expand({'&', Meta, [Arg]}, E) ->
211211 is_atom (Remote ) andalso
212212 elixir_lexical :record_remote (Remote , Fun , Arity , ? key (E , function ), ? line (Meta ), ? key (E , lexical_tracker )),
213213 {{'&' , Meta , [{'/' , [], [{{'.' , [], [Remote , Fun ]}, [], []}, Arity ]}]}, EE };
214+ {{local , Fun , Arity }, #{function := nil }} ->
215+ form_error (Meta , ? key (E , file ), ? MODULE , {undefined_local_capture , Fun , Arity });
214216 {{local , Fun , Arity }, EE } ->
215217 {{'&' , Meta , [{'/' , [], [{Fun , [], nil }, Arity ]}]}, EE };
216218 {expand , Expr , EE } ->
@@ -1179,7 +1181,8 @@ format_error({nested_comparison, CompExpr}) ->
11791181 " Instead, consider joining together each comparison segment with an \" and\" , e.g.\n\n "
11801182 " x < y and y < z\n\n "
11811183 " You wrote: ~ts " , [String ]);
1182-
1184+ format_error ({undefined_local_capture , Fun , Arity }) ->
1185+ io_lib :format (" undefined function ~ts /~B " , [Fun , Arity ]);
11831186format_error (caller_not_allowed ) ->
11841187 " __CALLER__ is available only inside defmacro and defmacrop" ;
11851188format_error (stacktrace_not_allowed ) ->
0 commit comments