Skip to content

Commit b64b214

Browse files
committed
Preserve empty list in dynamic list type constructor
Closes #15488.
1 parent c540d1f commit b64b214

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2133,6 +2133,9 @@ defmodule Module.Types.Descr do
21332133
not dynamic? ->
21342134
dynamic_descr
21352135

2136+
static_empty? and empty? ->
2137+
%{bitmap: @bit_empty_list, dynamic: dynamic_descr}
2138+
21362139
static_empty? ->
21372140
%{dynamic: dynamic_descr}
21382141

lib/elixir/test/elixir/module/types/descr_test.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,7 @@ defmodule Module.Types.DescrTest do
941941
{closed_map([{domain_key(:integer), gradual}]),
942942
closed_map([{domain_key(:integer), static}]),
943943
closed_map([{domain_key(:integer), upper_bound}])},
944+
{list(dynamic()), empty_list(), list(term())},
944945
{non_empty_list(gradual), non_empty_list(static), non_empty_list(upper_bound)},
945946
{non_empty_list(head, gradual), non_empty_list(head, static),
946947
non_empty_list(head, upper_bound)}

0 commit comments

Comments
 (0)