Skip to content

Commit 4468a12

Browse files
committed
Do not compute previous subtype during inference
1 parent c6820a1 commit 4468a12

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/elixir/lib/module/types/pattern.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ defmodule Module.Types.Pattern do
197197
{trees, precise?, args_types, context} =
198198
of_precise_head(patterns, guards, expected, previous, tag, stack, original)
199199

200-
if context.failed and not empty_previous?(previous) and
200+
if context.failed and stack.mode != :infer and not empty_previous?(previous) and
201201
Keyword.get(meta, :generated, false) != true do
202202
# If it failed, let's try to break it down to a better error message.
203203
# First we check if it fails without previous, if it doesn't, check if it is redundant.
@@ -215,7 +215,7 @@ defmodule Module.Types.Pattern do
215215
end
216216
else
217217
cond do
218-
previous_subtype?(args_types, previous) ->
218+
stack.mode != :infer and previous_subtype?(args_types, previous) ->
219219
warning = {:redundant, tag, expected, args_types, previous, context}
220220
{trees, previous, warn(__MODULE__, warning, meta, stack, context)}
221221

0 commit comments

Comments
 (0)