@@ -1885,7 +1885,7 @@ defmodule Module.Types.Descr do
1885
1885
:error ->
1886
1886
# Note: the empty type is not a valid input
1887
1887
is_proper_tuple? = descr_key? ( descr , :tuple ) and tuple_only? ( descr )
1888
- is_proper_size? = tuple_of_size_at_least ?( descr , index + 1 )
1888
+ is_proper_size? = tuple_of_size_at_least_static ?( descr , index + 1 )
1889
1889
1890
1890
cond do
1891
1891
is_proper_tuple? and is_proper_size? -> tuple_delete_static ( descr , index )
@@ -1895,7 +1895,7 @@ defmodule Module.Types.Descr do
1895
1895
1896
1896
{ dynamic , static } ->
1897
1897
is_proper_tuple? = descr_key? ( dynamic , :tuple ) and tuple_only? ( static )
1898
- is_proper_size? = tuple_of_size_at_least ?( static , index + 1 )
1898
+ is_proper_size? = tuple_of_size_at_least_static ?( static , index + 1 )
1899
1899
1900
1900
cond do
1901
1901
is_proper_tuple? and is_proper_size? ->
@@ -1941,7 +1941,7 @@ defmodule Module.Types.Descr do
1941
1941
:error ->
1942
1942
# Note: the empty type is not a valid input
1943
1943
is_proper_tuple? = descr_key? ( descr , :tuple ) and tuple_only? ( descr )
1944
- is_proper_size? = index == 0 or tuple_of_size_at_least ?( descr , index )
1944
+ is_proper_size? = index == 0 or tuple_of_size_at_least_static ?( descr , index )
1945
1945
1946
1946
cond do
1947
1947
is_proper_tuple? and is_proper_size? -> tuple_insert_static ( descr , index , type )
@@ -1951,7 +1951,7 @@ defmodule Module.Types.Descr do
1951
1951
1952
1952
{ dynamic , static } ->
1953
1953
is_proper_tuple? = descr_key? ( dynamic , :tuple ) and tuple_only? ( static )
1954
- is_proper_size? = index == 0 or tuple_of_size_at_least ?( static , index )
1954
+ is_proper_size? = index == 0 or tuple_of_size_at_least_static ?( static , index )
1955
1955
1956
1956
cond do
1957
1957
is_proper_tuple? and is_proper_size? ->
@@ -2022,8 +2022,17 @@ defmodule Module.Types.Descr do
2022
2022
open_tuple ( List . duplicate ( term ( ) , n ) )
2023
2023
end
2024
2024
2025
- defp tuple_of_size_at_least? ( descr , index ) do
2026
- subtype? ( Map . take ( descr , [ :tuple ] ) , tuple_of_size_at_least ( index ) )
2025
+ defp tuple_of_size_at_least_static? ( descr , index ) do
2026
+ case descr do
2027
+ % { tuple: dnf } ->
2028
+ Enum . all? ( dnf , fn
2029
+ { _ , elements , [ ] } -> length ( elements ) >= index
2030
+ entry -> subtype? ( % { tuple: [ entry ] } , tuple_of_size_at_least ( index ) )
2031
+ end )
2032
+
2033
+ % { } ->
2034
+ true
2035
+ end
2027
2036
end
2028
2037
2029
2038
## Pairs
0 commit comments