Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/elixir/lib/kernel.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3308,7 +3308,7 @@ defmodule Kernel do
end

defp nest_pop_in(:map, h, [{:access, key}]) do
quote do
quote generated: true do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you annotate the one a couple lines below too? It is just a matter of time until it warns too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done e165702

case unquote(h) do
nil -> {nil, nil}
h -> Access.pop(h, unquote(key))
Expand Down
2 changes: 2 additions & 0 deletions lib/elixir/test/elixir/kernel_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -1136,6 +1136,8 @@ defmodule KernelTest do
test "pop_in/1" do
users = %{"john" => %{age: 27}, "meg" => %{age: 23}}

assert pop_in(users["john"]) == {%{age: 27}, %{"meg" => %{age: 23}}}

assert pop_in(users["john"][:age]) == {27, %{"john" => %{}, "meg" => %{age: 23}}}
assert pop_in(users["john"][:name]) == {nil, %{"john" => %{age: 27}, "meg" => %{age: 23}}}
assert pop_in(users["bob"][:age]) == {nil, %{"john" => %{age: 27}, "meg" => %{age: 23}}}
Expand Down
Loading