Skip to content

Commit fdc7716

Browse files
ericmjJosé Valim
authored andcommitted
Improve type check error message (#9705)
A type error may not always cause a clause to fail. Related to #9700.
1 parent a050c00 commit fdc7716

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

lib/elixir/lib/module/types.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ defmodule Module.Types do
258258

259259
def format_warning({:unable_unify, left, right, expr, traces}) do
260260
[
261-
"function clause will never match, found incompatibility:\n\n ",
261+
"incompatible types:\n\n ",
262262
format_type(left),
263263
" !~ ",
264264
format_type(right),

lib/elixir/test/elixir/code_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ defmodule CodeTest do
111111
Code.compile_file(PathHelpers.fixture_path("checker_warning.exs"))
112112
end)
113113

114-
assert output =~ "function clause will never match"
114+
assert output =~ "incompatible types"
115115
end
116116

117117
test "require_file/1" do

lib/elixir/test/elixir/module/checker_test.exs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ defmodule Module.CheckerTest do
674674
}
675675

676676
warning = """
677-
warning: function clause will never match, found incompatibility:
677+
warning: incompatible types:
678678
679679
integer() !~ binary()
680680
@@ -710,7 +710,7 @@ defmodule Module.CheckerTest do
710710
}
711711

712712
warning = """
713-
warning: function clause will never match, found incompatibility:
713+
warning: incompatible types:
714714
715715
integer() !~ binary()
716716
@@ -746,7 +746,7 @@ defmodule Module.CheckerTest do
746746
}
747747

748748
warning = """
749-
warning: function clause will never match, found incompatibility:
749+
warning: incompatible types:
750750
751751
{var0} !~ var0
752752
@@ -777,7 +777,7 @@ defmodule Module.CheckerTest do
777777
}
778778

779779
warning = """
780-
warning: function clause will never match, found incompatibility:
780+
warning: incompatible types:
781781
782782
integer() !~ binary()
783783
@@ -813,7 +813,7 @@ defmodule Module.CheckerTest do
813813
}
814814

815815
warning = """
816-
warning: function clause will never match, found incompatibility:
816+
warning: incompatible types:
817817
818818
integer() !~ binary()
819819

0 commit comments

Comments
 (0)