File otp_src_19.2-dializer-relax-check-plt.patch of Package erlang
diff -Ndurp otp_src_19.2/lib/dialyzer/src/dialyzer_plt.erl otp_src_19.2-dializer-relax-check-plt/lib/dialyzer/src/dialyzer_plt.erl
--- otp_src_19.2/lib/dialyzer/src/dialyzer_plt.erl 2016-12-09 12:45:24.000000000 +0200
+++ otp_src_19.2-dializer-relax-check-plt/lib/dialyzer/src/dialyzer_plt.erl 2017-01-15 02:17:40.118626329 +0200
@@ -285,12 +285,7 @@ included_files(FileName) ->
Error
end.
-check_version(#file_plt{version = ?VSN, implementation_md5 = ImplMd5}) ->
- case compute_new_md5(ImplMd5, [], []) of
- ok -> ok;
- {differ, _, _} -> error;
- {error, _} -> error
- end;
+check_version(#file_plt{version = ?VSN}) -> ok;
check_version(#file_plt{}) -> error.
get_record_from_file(FileName) ->
@@ -401,15 +396,16 @@ to_file(FileName,
check_plt(FileName, RemoveFiles, AddFiles) ->
case get_record_from_file(FileName) of
{ok, #file_plt{file_md5_list = Md5, mod_deps = ModDeps} = Rec} ->
+ Md5Res = compute_new_md5(Md5, RemoveFiles, AddFiles),
case check_version(Rec) of
ok ->
- case compute_new_md5(Md5, RemoveFiles, AddFiles) of
+ case Md5Res of
ok -> ok;
{differ, NewMd5, DiffMd5} -> {differ, NewMd5, DiffMd5, ModDeps};
{error, _What} = Err -> Err
end;
error ->
- case compute_new_md5(Md5, RemoveFiles, AddFiles) of
+ case Md5Res of
ok -> {old_version, Md5};
{differ, NewMd5, _DiffMd5} -> {old_version, NewMd5};
{error, _What} = Err -> Err
@@ -463,12 +459,9 @@ compute_md5_from_file(File) ->
Msg = io_lib:format("Not a regular file: ~s\n", [File]),
throw({dialyzer_error, Msg});
true ->
- case dialyzer_utils:get_abstract_code_from_beam(File) of
- error ->
- Msg = io_lib:format("Could not get abstract code for file: ~s (please recompile it with +debug_info)\n", [File]),
- throw({dialyzer_error, Msg});
- {ok, Abs} ->
- erlang:md5(term_to_binary(Abs))
+ case beam_lib:md5(File) of
+ {ok, {_, MD5}} -> MD5;
+ E -> throw({dialyzer_error, beam_lib:format_error(E)})
end
end.