Skip to content

Commit

Permalink
Preserve source when building with deterministic option
Browse files Browse the repository at this point in the history
  • Loading branch information
delitrem committed Jul 2, 2024
1 parent e424399 commit 1fddc23
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/compiler/src/compile.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2588,6 +2588,8 @@ compile_info(File, CompilerOpts, Opts) ->
case paranoid_absname(File) of
[_|_] = Source when not IsSlim, not IsDeterministic ->
[{source,Source} | Info0];
[_|_] = Source when IsDeterministic ->
[{source,filename:basename(Source)} | Info0];
_ ->
Info0
end,
Expand Down
4 changes: 2 additions & 2 deletions lib/compiler/test/compile_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ file_1(Config) when is_list(Config) ->
%% Test option 'deterministic'.
{ok,simple} = compile:file(Simple, [deterministic]),
{module,simple} = c:l(simple),
[{version,_}] = simple:module_info(compile),
[{version,_},{source,"simple.erl"}] = simple:module_info(compile),
true = code:delete(simple),
false = code:purge(simple),

Expand All @@ -172,7 +172,7 @@ file_1(Config) when is_list(Config) ->
{DetPath, DetTarget} = get_files(Config, Det, "det_target"),
{ok,Det,DetCode} = compile:file(DetPath, [binary]),
{module,Det} = code:load_binary(Det, "", DetCode),
[{version,_}] = Det:module_info(compile),
[{version,_},{source,"deterministic_module.erl"}] = Det:module_info(compile),
true = code:delete(Det),
false = code:purge(Det),

Expand Down

0 comments on commit 1fddc23

Please sign in to comment.