Skip to content

Commit 021cca4

Browse files
author
José Valim
committed
Do not include debug_info in metadata String modules
Signed-off-by: José Valim <[email protected]>
1 parent a3d88dc commit 021cca4

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

lib/elixir/src/elixir_compiler.erl

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,17 @@ allows_fast_compilation(_) -> false.
169169
%% executes the callback in case of success. This automatically
170170
%% handles errors and warnings. Used by this module and elixir_module.
171171
module(Forms, Opts, E, Callback) ->
172-
Final =
173-
case (get_opt(debug_info) == true) orelse
174-
lists:member(debug_info, Opts) of
175-
true -> [debug_info] ++ options();
176-
false -> options()
172+
Extra =
173+
case proplists:get_value(debug_info, Opts) of
174+
true -> [debug_info];
175+
false -> [];
176+
undefined ->
177+
case get_opt(debug_info) of
178+
true -> [debug_info];
179+
false -> []
180+
end
177181
end,
178-
inner_module(Forms, Final, false, E, Callback).
182+
inner_module(Forms, Extra ++ options(), false, E, Callback).
179183

180184
inner_module(Forms, Options, Bootstrap, #{file := File} = E, Callback) when
181185
is_list(Forms), is_list(Options), is_boolean(Bootstrap), is_function(Callback) ->

lib/elixir/test/elixir/string_test.exs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,4 +539,10 @@ defmodule StringTest do
539539
assert String.jaro_distance("jon", "john") == 0.9166666666666666
540540
assert String.jaro_distance("jon", "jan") == 0.7777777777777777
541541
end
542+
543+
test "skip debug_info in metadata modules" do
544+
assert String.Unicode.__info__(:compile)[:options] == []
545+
assert String.Graphemes.__info__(:compile)[:options] == []
546+
assert String.Normalizer.__info__(:compile)[:options] == []
547+
end
542548
end

lib/elixir/unicode/unicode.ex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ end
1010

1111
defmodule String.Unicode do
1212
@moduledoc false
13+
@compile {:debug_info, false}
1314
def version, do: {7, 0, 0}
1415

1516
data_path = Path.join(__DIR__, "UnicodeData.txt")
@@ -204,6 +205,7 @@ end
204205

205206
defmodule String.Graphemes do
206207
@moduledoc false
208+
@compile {:debug_info, false}
207209

208210
cluster_path = Path.join(__DIR__, "GraphemeBreakProperty.txt")
209211
regex = ~r/(?:^([0-9A-F]+)(?:\.\.([0-9A-F]+))?)\s+;\s(\w+)/m
@@ -413,6 +415,7 @@ end
413415

414416
defmodule String.Normalizer do
415417
@moduledoc false
418+
@compile {:debug_info, false}
416419

417420
decomposition_path = Path.join(__DIR__, "Decomposition.txt")
418421

0 commit comments

Comments
 (0)