-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve error when using non-arith guard BIF in match #5667
Conversation
Only arith BIFs are allowed in matches
79f7ed8
to
b73f86e
Compare
test "invalid :erlang call on guard" do | ||
assert_compile_fail CompileError, | ||
"nofile:1: cannot invoke remote function :erlang.make_ref/0 inside match", | ||
'case [] do; :erlang.make_ref() -> :ok; end' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know the rest of the file is like this so that might be the reason, but why are we using ;
s here instead of:
case [] do :erlang.make_ref() -> :ok end
Is there a specific reason or just No Particular Reason™?
That's what rest of file did? More importantly messed up guard tests from
lazy copy paste.
…On 17 Jan 2017 4:44 pm, "Andrea Leopardi" ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In lib/elixir/test/elixir/kernel/errors_test.exs
<#5667 (review)>
:
> @@ -925,6 +925,22 @@ defmodule Kernel.ErrorsTest do
'case [] do; [] when Hello.something_that_does_not_exist == [] -> :ok; end'
end
+ test "invalid :erlang call on match" do
+ assert_compile_fail CompileError,
+ "nofile:1: cannot invoke remote function :erlang.make_ref/0 inside match",
+ 'case [] do; :erlang.make_ref() -> :ok; end'
+
+ assert_compile_fail CompileError,
+ "nofile:1: cannot invoke remote function :erlang.self/0 inside match",
+ 'case [] do; self() -> :ok; end'
+ end
+
+ test "invalid :erlang call on guard" do
+ assert_compile_fail CompileError,
+ "nofile:1: cannot invoke remote function :erlang.make_ref/0 inside match",
+ 'case [] do; :erlang.make_ref() -> :ok; end'
I know the rest of the file is like this so that might be the reason, but
why are we using ;s here instead of:
case [] do :erlang.make_ref() -> :ok end
Is there a specific reason or just No Particular Reason™?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#5667 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB6JTVCZENHwdE-leSUa7hymKfp3TcUBks5rTO_CgaJpZM4Ll1Mj>
.
|
Yup, I suspected this :) |
Would you like to change it? |
@fishcakez We can change it on the whole file after this if we care about this, for this PR I think we're ok sticking with what's in the file. Wdyt? |
@whatyouhide ok, I have fixed the guard test. |
Only arith BIFs are allowed in matches.
Partial fix for #5666.