diff options
author | José Valim <jose.valim@dashbit.co> | 2021-11-26 06:47:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-26 06:47:10 +0100 |
commit | 209688fc52bd35c65c892fc13d32fd1196f4039a (patch) | |
tree | 0766bc65ac8ff57e40407731f0c5bb5c96713d34 | |
parent | cc877ee16bfcc96afaeb392e683984ae81f847d6 (diff) | |
download | elixir-209688fc52bd35c65c892fc13d32fd1196f4039a.tar.gz |
Handle outdated anonymous functions in Erlang/OTP 25 (#11421)
-rw-r--r-- | lib/elixir/lib/inspect.ex | 3 | ||||
-rw-r--r-- | lib/elixir/test/elixir/inspect_test.exs | 2 | ||||
-rw-r--r-- | lib/elixir/test/elixir/kernel/raise_test.exs | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/lib/elixir/lib/inspect.ex b/lib/elixir/lib/inspect.ex index 8f77a66ad..52dcb227f 100644 --- a/lib/elixir/lib/inspect.ex +++ b/lib/elixir/lib/inspect.ex @@ -347,6 +347,9 @@ defimpl Inspect, for: Function do name = fun_info[:name] cond do + not is_atom(mod) -> + "#Function<#{uniq(fun_info)}/#{fun_info[:arity]}>" + fun_info[:type] == :external and fun_info[:env] == [] -> inspected_as_atom = Identifier.inspect_as_atom(mod) inspected_as_function = Identifier.inspect_as_function(name) diff --git a/lib/elixir/test/elixir/inspect_test.exs b/lib/elixir/test/elixir/inspect_test.exs index 6e2a64650..fbdb93d88 100644 --- a/lib/elixir/test/elixir/inspect_test.exs +++ b/lib/elixir/test/elixir/inspect_test.exs @@ -763,7 +763,7 @@ defmodule Inspect.OthersTest do anony = Application.get_env(:elixir, :anony) named = Application.get_env(:elixir, :named) - assert inspect(anony) =~ ~r"#Function<0.\d+/0 in Inspect.OthersTest.V>" + assert inspect(anony) =~ ~r"#Function<0.\d+/0" assert inspect(named) =~ ~r"&Inspect.OthersTest.V.fun/0" after Application.delete_env(:elixir, :anony) diff --git a/lib/elixir/test/elixir/kernel/raise_test.exs b/lib/elixir/test/elixir/kernel/raise_test.exs index c635c6bc5..3f0e24715 100644 --- a/lib/elixir/test/elixir/kernel/raise_test.exs +++ b/lib/elixir/test/elixir/kernel/raise_test.exs @@ -426,7 +426,7 @@ defmodule Kernel.RaiseTest do end assert result =~ - ~r/function #Function<[0-9]\.[0-9]*\/0 in Kernel.RaiseTest.BadFunction.Missing> is invalid, likely because it points to an old version of the code/ + ~r/function #Function<[0-9]\.[0-9]*\/0[^>]*> is invalid, likely because it points to an old version of the code/ end test "badmatch error" do |