Skip to content

Commit 87af1e3

Browse files
committed
Do not check for emptiness in tuple element fallback
1 parent 3a21a6a commit 87af1e3

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

lib/elixir/lib/module/types/apply.ex

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,17 +1534,16 @@ defmodule Module.Types.Apply do
15341534
end
15351535

15361536
defp remote_apply_tuple_element(info, args_types, tuple, stack) do
1537+
# TODO: Convert this into a regular type signature {...a} and not {}, integer -> a
15371538
with {:ok, fallback} <- remote_apply(info, args_types, stack) do
15381539
case tuple_values(tuple) do
15391540
:badtuple ->
1541+
# This is not virtually possible, since remote apply validates the arguments.
1542+
# So returning the fallback is acceptable.
15401543
{:ok, fallback}
15411544

15421545
values ->
1543-
if empty?(values) do
1544-
{:error, {:badindex, 1, tuple}}
1545-
else
1546-
{:ok, return(values, args_types, stack)}
1547-
end
1546+
{:ok, return(values, args_types, stack)}
15481547
end
15491548
end
15501549
end

0 commit comments

Comments
 (0)