Skip to content

Commit 68c413f

Browse files
authored
Improve ambiguous import error message (#15335)
1 parent 16f5174 commit 68c413f

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

lib/elixir/src/elixir_dispatch.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ format_error({import, {conflict, Receiver}, Name, Arity}) ->
363363
"please rename the local macro or remove the conflicting import",
364364
[Name, Arity, elixir_aliases:inspect(Receiver), Name, Arity]);
365365
format_error({import, {ambiguous, [Mod1, Mod2 | _]}, Name, Arity}) ->
366-
io_lib:format("function ~ts/~B imported from both ~ts and ~ts, call is ambiguous",
366+
io_lib:format("conflicting ~ts/~B import from modules ~ts and ~ts",
367367
[Name, Arity, elixir_aliases:inspect(Mod1), elixir_aliases:inspect(Mod2)]);
368368
format_error({compile_env, Name, Arity}) ->
369369
io_lib:format("Application.~s/~B is discouraged in the module body, use Application.compile_env/3 instead", [Name, Arity]);

lib/elixir/test/elixir/kernel/errors_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ defmodule Kernel.ErrorsTest do
674674

675675
test "function import conflict" do
676676
assert_compile_error(
677-
["nofile:3:16", "function exit/1 imported from both :erlang and Kernel, call is ambiguous"],
677+
["nofile:3:16", "conflicting exit/1 import from modules :erlang and Kernel"],
678678
~c"""
679679
defmodule Kernel.ErrorsTest.FunctionImportConflict do
680680
import :erlang, only: [exit: 1], warn: false
@@ -684,7 +684,7 @@ defmodule Kernel.ErrorsTest do
684684
)
685685

686686
assert_compile_error(
687-
["nofile:3:17", "function exit/1 imported from both :erlang and Kernel, call is ambiguous"],
687+
["nofile:3:17", "conflicting exit/1 import from modules :erlang and Kernel"],
688688
~c"""
689689
defmodule Kernel.ErrorsTest.FunctionImportConflict do
690690
import :erlang, only: [exit: 1], warn: false

lib/iex/test/iex/interaction_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ defmodule IEx.InteractionTest do
185185
assert capture_io(:stderr, fn ->
186186
capture_iex("open('README.md')", [], env: __ENV__)
187187
end) =~
188-
~r"function open/1 imported from both File and IEx.Helpers"
188+
~r"conflicting open/1 import from modules File and IEx.Helpers"
189189
end
190190

191191
test "receive exit" do

0 commit comments

Comments
 (0)