Skip to content

Commit ba63cc9

Browse files
committed
More
1 parent 014b12a commit ba63cc9

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/elixir/src/elixir_erl_compiler.erl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ format_warnings(Opts, Warnings) ->
118118
%% Those we implement ourselves
119119
handle_file_warning(_, _File, {_Line, v3_core, {map_key_repeated, _}}) -> ok;
120120
handle_file_warning(_, _File, {_Line, sys_core_fold, {ignored, useless_building}}) -> ok;
121-
handle_file_warning(_, _File, {_Line, sys_core_fold, {nomatch, _}}) -> ok;
121+
122+
%% We skip all of no_clause, clause_type, guard, shadow.
123+
%% Those have too little information and they overlap with the type system.
124+
handle_file_warning(_, _File, {_Line, sys_core_fold, {nomatch, Reason}}) when is_atom(Reason) -> ok;
122125

123126
%% Ignore all linting errors (only come up on parse transforms)
124127
handle_file_warning(_, _File, {_Line, erl_lint, _}) -> ok;
@@ -151,6 +154,14 @@ custom_format(sys_core_fold, {ignored, {no_effect, {erlang, F, A}}}) ->
151154
end,
152155
io_lib:format(Fmt, Args);
153156

157+
custom_format(sys_core_fold, {nomatch, {shadow, Line, {ErlName, ErlArity}}}) ->
158+
{Name, Arity} = elixir_utils:erl_fa_to_elixir_fa(ErlName, ErlArity),
159+
160+
io_lib:format(
161+
"this clause for ~ts/~B cannot match because a previous clause at line ~B always matches",
162+
[Name, Arity, Line]
163+
);
164+
154165
custom_format([], Desc) ->
155166
io_lib:format("~p", [Desc]);
156167

0 commit comments

Comments
 (0)