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) ->
27
27
guard_op (Op , Arity ) ->
28
28
try erl_internal :op_type (Op , Arity ) of
29
29
arith -> true ;
30
- list -> true ;
31
30
comp -> true ;
32
31
bool -> true ;
32
+ list -> false ;
33
33
send -> false
34
34
catch
35
35
_ :_ -> false
Original file line number Diff line number Diff line change @@ -310,6 +310,22 @@ defmodule Kernel.GuardTest do
310
310
end
311
311
end
312
312
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
+
313
329
assert_raise CompileError , ~r" invalid expression in guard" , fn ->
314
330
defmodule LocalCallUsage do
315
331
defguard foo ( local , call ) when local . ( call )
You can’t perform that action at this time.
0 commit comments