Skip to content

Commit 5e22b12

Browse files
lexmagJosé Valim
authored andcommitted
Validate application properties before altering them
Closes #4873. Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
1 parent d450189 commit 5e22b12

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

lib/elixir/test/elixir/kernel/warning_test.exs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,8 @@ defmodule Kernel.WarningTest do
421421
assert capture_err(fn ->
422422
Code.eval_string ~S"""
423423
defmodule Sample do
424-
def hello(arg \\ 0), do: nil
425-
def hello(arg), do: nil
424+
def hello(arg \\ 0), do: nil
425+
def hello(arg), do: nil
426426
end
427427
"""
428428
end) =~ "definitions with multiple clauses and default values require a function head"
@@ -551,7 +551,7 @@ defmodule Kernel.WarningTest do
551551
"""
552552
end) =~ "undefined behaviour function foo/0 (for behaviour Sample1)"
553553
after
554-
purge [Sample1, Sample2, Sample3]
554+
purge [Sample1, Sample2]
555555
end
556556

557557
test "undefined macro for behaviour" do
@@ -567,7 +567,7 @@ defmodule Kernel.WarningTest do
567567
"""
568568
end) =~ "undefined behaviour macro foo/0 (for behaviour Sample1)"
569569
after
570-
purge [Sample1, Sample2, Sample3]
570+
purge [Sample1, Sample2]
571571
end
572572

573573
test "undefined behavior" do

lib/mix/lib/mix/tasks/compile.app.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ defmodule Mix.Tasks.Compile.App do
9090
best_guess
9191
end
9292

93+
properties = ensure_correct_properties(app, config, properties)
94+
9395
# Ensure we always prepend the standard application dependencies
94-
core_apps = [:kernel, :stdlib] ++ language_app(config)
9596
properties = Keyword.update!(properties, :applications, fn apps ->
96-
core_apps ++ apps
97+
[:kernel, :stdlib] ++ language_app(config) ++ apps
9798
end)
9899

99-
properties = ensure_correct_properties(app, config, properties)
100-
contents = {:application, app, properties}
100+
contents = {:application, app, properties}
101101

102102
Mix.Project.ensure_structure()
103103
File.write!(target, :io_lib.format("~p.", [contents]), [:utf8])

0 commit comments

Comments
 (0)