-
Notifications
You must be signed in to change notification settings - Fork 4
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
[OTP-21] Remove get_stacktrace calls to be compatible with OTP21 #10
Conversation
I can see Dialyzer check failed, not sure why:
|
@@ -144,19 +144,19 @@ reduce_while(Fun, AccIn, List) when is_function(Fun, 2) -> | |||
catch | |||
throw:{halt, AccOut} -> | |||
AccOut; | |||
Kind:Reason -> | |||
erlang:raise(Kind, Reason, erlang:get_stacktrace()) | |||
_:Reason -> |
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.
Let's remove this clause, we don't need it, if it is not throw :...
by default an error is raised.
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.
@maximvl did you have the chance to address the suggested fix above ^^ ??
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.
@cabol sorry for long reply, could you tell which exact part we can remove here? whole catch?
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 meant you should remove this pattern-match _:Reason
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.
@maximvl what about this? For me it should be removed, this pattern match doesn't make sense since by default the original error is raised.
Yes, no idea what dialyzer is complaining of, we should track where might be a spec violation maybe. BTW, if you run dialyzer locally ( |
@cabol locally dialyzer checks pass on this branch using Erlang 21 |
11ccd17
to
eaf2d3c
Compare
@@ -45,7 +45,12 @@ | |||
init_per_testcase(_, Config) -> | |||
Repo = xdb_lib:keyfetch(repo, Config), | |||
{ok, _} = Repo:start_link(), | |||
{_, _} = Repo:delete_all(person), | |||
%% On the first run this table does not exist and this will throw an error |
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 had to add this, otherwise, it always fails CI
@cabol Hi, I updated the PR but not sure how to trigger CI, could you check? |
src/xdb_transform.erl
Outdated
@@ -268,6 +271,14 @@ build_repo_fun(Repo, Adapter, Mod, Fun, Args) -> | |||
Body = build_repo_fun_body(Fun, "~p, ~p", Args), | |||
?Q(text(Body, [Mod, Repo, Adapter])). | |||
|
|||
%%@private | |||
build_repo_fun_spec(_, rollback, _) -> | |||
?Q(lists:flatten(["-spec ", "rollback", "(any()) -> no_return()."])); |
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.
This spec is required because new Dialyzer is very strict for no_return()
functions
I added a spec generation to |
424a59c
to
6a23a29
Compare
@@ -1,5 +1,7 @@ | |||
-module(xdb_lib_SUITE). | |||
|
|||
-dialyzer({nowarn_function, t_raise/1}). |
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 couldn't find any other way to stop dialyzer complaining about funs being no_return()
inside t_raise
Set build version to R21
I'm going to replace this PR with a fresh one |
Hey Carlos, here's the change we discussed: #9