@@ -153,6 +153,7 @@ matched_expr -> access_expr kw_identifier : error_invalid_kw_identifier('$2').
153
153
unmatched_expr -> matched_expr unmatched_op_expr : build_op ('$1' , '$2' ).
154
154
unmatched_expr -> unmatched_expr matched_op_expr : build_op ('$1' , '$2' ).
155
155
unmatched_expr -> unmatched_expr unmatched_op_expr : build_op ('$1' , '$2' ).
156
+ unmatched_expr -> unmatched_expr no_parens_op_expr : warn_no_parens_after_do_op ('$2' ), build_op ('$1' , '$2' ).
156
157
unmatched_expr -> unary_op_eol expr : build_unary_op ('$1' , '$2' ).
157
158
unmatched_expr -> at_op_eol expr : build_unary_op ('$1' , '$2' ).
158
159
unmatched_expr -> capture_op_eol expr : build_unary_op ('$1' , '$2' ).
@@ -1218,6 +1219,16 @@ warn_pipe({arrow_op, {Line, Column, _}, Op}, {_, [_ | _], [_ | _]}) ->
1218
1219
warn_pipe (_Token , _ ) ->
1219
1220
ok .
1220
1221
1222
+ % % TODO: Make this an error on v2.0
1223
+ warn_no_parens_after_do_op ({{_Type , Location , Op }, _ }) ->
1224
+ {Line , _ , _ } = Location ,
1225
+
1226
+ warn (
1227
+ Line ,
1228
+ " missing parentheses on expression following operator \" " ++ atom_to_list (Op ) ++ " \" , "
1229
+ " you must add parentheses to avoid ambiguities"
1230
+ ).
1231
+
1221
1232
% % TODO: Make this an error on v2.0
1222
1233
warn_nested_no_parens_keyword (Key , Value ) when is_atom (Key ) ->
1223
1234
{line , Line } = lists :keyfind (line , 1 , ? meta (Value )),
0 commit comments