File elixir-1.7.4-git.patch of Package elixir
diff --git a/lib/elixir/lib/calendar.ex b/lib/elixir/lib/calendar.ex
index 2beb1ff2e..ff24aeebc 100644
--- a/lib/elixir/lib/calendar.ex
+++ b/lib/elixir/lib/calendar.ex
@@ -170,7 +170,7 @@ defmodule Calendar do
@callback time_to_string(hour, minute, second, microsecond) :: String.t()
@doc """
- Converts the given datetime (with time zone) into the `t:iso_days/0` format.
+ Converts the given datetime (without time zone) into the `t:iso_days/0` format.
"""
@callback naive_datetime_to_iso_days(year, month, day, hour, minute, second, microsecond) ::
iso_days
diff --git a/lib/elixir/lib/string.ex b/lib/elixir/lib/string.ex
index 5035fb5d4..756e6ffce 100644
--- a/lib/elixir/lib/string.ex
+++ b/lib/elixir/lib/string.ex
@@ -389,13 +389,13 @@ defmodule String do
Note this function can split within or across grapheme boundaries.
For example, take the grapheme "é" which is made of the characters
- "e" and the acute accent. The following returns `true`:
+ "e" and the acute accent. The following returns the acute accent separately:
iex> String.split(String.normalize("é", :nfd), "e")
["", "́"]
However, if "é" is represented by the single character "e with acute"
- accent, then it will return `false`:
+ accent, then it will return "e with acute":
iex> String.split(String.normalize("é", :nfc), "e")
["é"]
diff --git a/lib/logger/lib/logger.ex b/lib/logger/lib/logger.ex
index 7f7e4bece..75b568f14 100644
--- a/lib/logger/lib/logger.ex
+++ b/lib/logger/lib/logger.ex
@@ -789,7 +789,7 @@ defmodule Logger do
metadata = Keyword.merge(caller, metadata)
{metadata, metadata}
else
- {metadata,
+ {[],
quote do
Keyword.merge(unquote(caller), unquote(metadata))
end}
diff --git a/lib/logger/test/logger_test.exs b/lib/logger/test/logger_test.exs
index cba491bf8..abcde63b7 100644
--- a/lib/logger/test/logger_test.exs
+++ b/lib/logger/test/logger_test.exs
@@ -252,11 +252,13 @@ defmodule LoggerTest do
test "remove unused calls at compile time based on matching metadata" do
Logger.configure(
+ compile_time_application: :sample_app,
compile_time_purge_matching: [
[module: LoggerTest.PurgeMatching, function: "two_filters/0"],
[function: "one_filter/0"],
[custom: true],
- [function: "level_filter/0", level_lower_than: :info]
+ [function: "level_filter/0", level_lower_than: :warn],
+ [application: :sample_app, level_lower_than: :info]
]
)
@@ -274,12 +276,16 @@ defmodule LoggerTest do
end
def level_filter do
- Logger.debug("debug_filter")
Logger.info("info_filter")
+ Logger.warn("warn_filter")
end
def works do
- Logger.debug("works")
+ Logger.info("works")
+ end
+
+ def log(level, metadata \\ []) do
+ Logger.log(level, "ok", metadata)
end
end
@@ -287,9 +293,13 @@ defmodule LoggerTest do
assert capture_log(fn -> assert PurgeMatching.one_filter() == :ok end) == ""
assert capture_log(fn -> assert PurgeMatching.two_filters() == :ok end) == ""
assert capture_log(fn -> assert PurgeMatching.custom_filters() == :ok end) == ""
- assert capture_log(fn -> assert PurgeMatching.level_filter() == :ok end) =~ "info_filter"
- refute capture_log(fn -> assert PurgeMatching.level_filter() == :ok end) =~ "debug_filter"
+ assert capture_log(fn -> assert PurgeMatching.level_filter() == :ok end) =~ "warn_filter"
+ refute capture_log(fn -> assert PurgeMatching.level_filter() == :ok end) =~ "info_filter"
+
+ capture_log(fn -> assert PurgeMatching.log(:info) == :ok end)
+ capture_log(fn -> assert PurgeMatching.log(:debug) == :ok end)
after
+ Logger.configure(compile_time_application: nil)
Logger.configure(compile_time_purge_matching: [])
end
diff --git a/lib/mix/lib/mix/utils.ex b/lib/mix/lib/mix/utils.ex
index 78758da0e..646b10d88 100644
--- a/lib/mix/lib/mix/utils.ex
+++ b/lib/mix/lib/mix/utils.ex
@@ -176,7 +176,7 @@ defmodule Mix.Utils do
(1970-01-01 00:00:00).
"""
def last_modified_and_size(path) do
- now = System.system_time(:second)
+ now = System.os_time(:second)
case :elixir_utils.read_posix_mtime_and_size(path) do
{:ok, mtime, size} when mtime > now ->