Skip to content

Commit

Permalink
allow types containing Union{} to be ordered
Browse files Browse the repository at this point in the history
want to use the sorted part of the type cache as much as possible
  • Loading branch information
JeffBezanson committed Dec 30, 2015
1 parent 95ee269 commit 2dca1f8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/jltypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1811,7 +1811,7 @@ JL_DLLEXPORT jl_value_t *jl_tupletype_fill(size_t n, jl_value_t *v)

static int contains_unions(jl_value_t *type)
{
if (jl_is_uniontype(type)) return 1;
if (jl_is_uniontype(type)) return type != jl_bottom_type;
if (jl_is_typector(type)) return contains_unions(((jl_typector_t*)type)->body);
if (!jl_is_datatype(type)) return 0;
int i;
Expand All @@ -1832,7 +1832,8 @@ static int is_typekey_ordered(jl_value_t **key, size_t n)
if (jl_is_type(k) &&
!(jl_is_datatype(k) && (((jl_datatype_t*)k)->uid ||
k == ((jl_datatype_t*)k)->name->primary ||
(!jl_has_typevars_(k,1) && !contains_unions(k)))))
(!jl_has_typevars_(k,1) && !contains_unions(k)))) &&
k != jl_bottom_type)
return 0;
}
return 1;
Expand Down

0 comments on commit 2dca1f8

Please sign in to comment.