Skip to content

Commit 025d875

Browse files
committed
Cleanup
1 parent f306af5 commit 025d875

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

lib/elixir/lib/module/types/descr.ex

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ defmodule Module.Types.Descr do
4343
}
4444
@empty_list %{bitmap: @bit_empty_list}
4545
@not_non_empty_list Map.delete(@term, :list)
46-
@not_list Map.replace!(@not_non_empty_list, :bitmap, @bit_top - @bit_empty_list)
4746

4847
@empty_intersection [0, @none]
4948
@empty_difference [0, []]
@@ -1085,21 +1084,20 @@ defmodule Module.Types.Descr do
10851084
defp list_to_quoted(dnf, empty?, opts) do
10861085
dnf = list_normalize(dnf)
10871086

1088-
{unions, list_rendered?} =
1089-
Enum.reduce(dnf, {[], false}, fn {list_type, last_type, negs}, {acc, list_rendered?} ->
1090-
{name, arguments, list_rendered?} =
1087+
unions =
1088+
Enum.reduce(dnf, [], fn {list_type, last_type, negs}, acc ->
1089+
{name, arguments} =
10911090
if subtype?(last_type, @empty_list) do
10921091
name = if empty?, do: :list, else: :non_empty_list
1093-
{name, [to_quoted(list_type, opts)], empty?}
1092+
{name, [to_quoted(list_type, opts)]}
10941093
else
10951094
name = if empty?, do: :maybe_improper_list, else: :non_empty_maybe_improper_list
10961095

10971096
# mark non_empty_maybe_improper_list(term(), term()) as such rather than:
10981097
# non_empty_maybe_improper_list(term(), atom() or binary() or float() or ...)
10991098
rendered_last_type = if list_improper_term?(last_type), do: :term, else: last_type
11001099

1101-
args = [to_quoted(list_type, opts), to_quoted(rendered_last_type, opts)]
1102-
{name, args, empty?}
1100+
{name, [to_quoted(list_type, opts), to_quoted(rendered_last_type, opts)]}
11031101
end
11041102

11051103
acc =
@@ -1125,10 +1123,10 @@ defmodule Module.Types.Descr do
11251123
)
11261124
end
11271125

1128-
{acc, list_rendered?}
1126+
acc
11291127
end)
11301128

1131-
if empty? and not list_rendered? do
1129+
if empty? and dnf == [] do
11321130
[{:empty_list, [], []} | unions]
11331131
else
11341132
unions

0 commit comments

Comments
 (0)