Skip to content

Commit 2dca1f8

Browse files
committed
allow types containing Union{} to be ordered
want to use the sorted part of the type cache as much as possible
1 parent 95ee269 commit 2dca1f8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/jltypes.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,7 +1811,7 @@ JL_DLLEXPORT jl_value_t *jl_tupletype_fill(size_t n, jl_value_t *v)
18111811

18121812
static int contains_unions(jl_value_t *type)
18131813
{
1814-
if (jl_is_uniontype(type)) return 1;
1814+
if (jl_is_uniontype(type)) return type != jl_bottom_type;
18151815
if (jl_is_typector(type)) return contains_unions(((jl_typector_t*)type)->body);
18161816
if (!jl_is_datatype(type)) return 0;
18171817
int i;
@@ -1832,7 +1832,8 @@ static int is_typekey_ordered(jl_value_t **key, size_t n)
18321832
if (jl_is_type(k) &&
18331833
!(jl_is_datatype(k) && (((jl_datatype_t*)k)->uid ||
18341834
k == ((jl_datatype_t*)k)->name->primary ||
1835-
(!jl_has_typevars_(k,1) && !contains_unions(k)))))
1835+
(!jl_has_typevars_(k,1) && !contains_unions(k)))) &&
1836+
k != jl_bottom_type)
18361837
return 0;
18371838
}
18381839
return 1;

0 commit comments

Comments
 (0)