@@ -70,7 +70,8 @@ translate({ function, MetaFA, [{ '/', _, [{F, Meta, C}, A]}] }, S) when is_atom(
7070 end ,
7171
7272 case elixir_dispatch :import_function (WrappedMeta , F , A , S ) of
73- false -> syntax_error (WrappedMeta , S # elixir_scope .file , " expected ~ts /~B to be a function, but it is a macro" , [F , A ]);
73+ false -> syntax_error (WrappedMeta , S # elixir_scope .file ,
74+ " expected ~ts /~B to be a function, but it is a macro" , [F , A ]);
7475 Else -> Else
7576 end ;
7677
@@ -132,7 +133,7 @@ translate({'@', Meta, [{ Name, _, Args }]}, S) ->
132133
133134% % Case
134135
135- translate ({'case' , Meta , [Expr , KV ]}, S ) ->
136+ translate ({'case' , Meta , [Expr , KV ]}, S ) when is_list ( KV ) ->
136137 assert_no_match_or_guard_scope (Meta , 'case' , S ),
137138 Clauses = elixir_clauses :get_pairs (Meta , do , KV , S ),
138139 { TExpr , NS } = translate_each (Expr , S ),
@@ -147,7 +148,7 @@ translate({'case', Meta, [Expr, KV]}, S) ->
147148
148149% % Try
149150
150- translate ({'try' , Meta , [Clauses ]}, S ) ->
151+ translate ({'try' , Meta , [Clauses ]}, S ) when is_list ( Clauses ) ->
151152 assert_no_match_or_guard_scope (Meta , 'try' , S ),
152153
153154 Do = proplists :get_value ('do' , Clauses , nil ),
@@ -167,7 +168,7 @@ translate({'try', Meta, [Clauses]}, S) ->
167168
168169% % Receive
169170
170- translate ({'receive' , Meta , [KV ] }, S ) ->
171+ translate ({'receive' , Meta , [KV ] }, S ) when is_list ( KV ) ->
171172 assert_no_match_or_guard_scope (Meta , 'receive' , S ),
172173 Do = elixir_clauses :get_pairs (Meta , do , KV , S , true ),
173174
@@ -185,7 +186,7 @@ translate({'receive', Meta, [KV] }, S) ->
185186
186187% % Definitions
187188
188- translate ({defmodule , Meta , [Ref , KV ]}, S ) ->
189+ translate ({defmodule , Meta , [Ref , KV ]}, S ) when is_list ( KV ) ->
189190 { TRef , _ } = translate_each (Ref , S ),
190191
191192 Block = case lists :keyfind (do , 1 , KV ) of
@@ -243,7 +244,11 @@ translate({ apply, Meta, [Left, Right, Args] }, S) when is_list(Args) ->
243244
244245translate ({ apply , Meta , Args }, S ) ->
245246 { TArgs , NS } = translate_args (Args , S ),
246- { ? wrap_call (? line (Meta ), erlang , apply , TArgs ), NS }.
247+ { ? wrap_call (? line (Meta ), erlang , apply , TArgs ), NS };
248+
249+ translate ({ Name , Meta , Args }, S ) ->
250+ syntax_error (Meta , S # elixir_scope .file ,
251+ " invalid arguments for macro ~ts /~B " , [Name , length (Args )]).
247252
248253% % Helpers
249254
@@ -302,7 +307,8 @@ translate_in(Meta, Left, Right, S) ->
302307 true ->
303308 { false , ? wrap_call (Line , 'Elixir.Enum' , 'member?' , [TRight , TLeft ]) };
304309 false ->
305- syntax_error (Meta , S # elixir_scope .file , " invalid args for operator in, it expects an explicit array or an explicit range on the right side when used in guard expressions" )
310+ syntax_error (Meta , S # elixir_scope .file , " invalid args for operator in, it expects an explicit list "
311+ " or an explicit range on the right side when used in guard expressions" )
306312 end
307313 end ,
308314
0 commit comments