File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -27,9 +27,9 @@ guard_op('orelse', 2) ->
2727guard_op (Op , Arity ) ->
2828 try erl_internal :op_type (Op , Arity ) of
2929 arith -> true ;
30- list -> true ;
3130 comp -> true ;
3231 bool -> true ;
32+ list -> false ;
3333 send -> false
3434 catch
3535 _ :_ -> false
Original file line number Diff line number Diff line change @@ -310,6 +310,22 @@ defmodule Kernel.GuardTest do
310310 end
311311 end
312312
313+ assert_raise CompileError ,
314+ ~r" cannot invoke remote function :erlang\. \+ \+ /2 inside guards" ,
315+ fn ->
316+ defmodule ListSubtractionUsage do
317+ defguard foo ( list ) when list ++ [ ]
318+ end
319+ end
320+
321+ assert_raise CompileError ,
322+ ~r" cannot invoke remote function :erlang\. \- \- /2 inside guards" ,
323+ fn ->
324+ defmodule ListSubtractionUsage do
325+ defguard foo ( list ) when list -- [ ]
326+ end
327+ end
328+
313329 assert_raise CompileError , ~r" invalid expression in guard" , fn ->
314330 defmodule LocalCallUsage do
315331 defguard foo ( local , call ) when local . ( call )
You can’t perform that action at this time.
0 commit comments