Skip to content

Commit 9e3c147

Browse files
committed
Simplify is_typekey_ordered
1 parent 8f47a60 commit 9e3c147

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

src/jltypes.c

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -547,18 +547,6 @@ JL_DLLEXPORT jl_value_t *jl_type_unionall(jl_tvar_t *v, jl_value_t *body)
547547

548548
// --- type instantiation and cache ---
549549

550-
static int contains_unions(jl_value_t *type)
551-
{
552-
if (jl_is_uniontype(type) || jl_is_unionall(type)) return 1;
553-
if (!jl_is_datatype(type)) return 0;
554-
int i;
555-
for(i=0; i < jl_nparams(type); i++) {
556-
if (contains_unions(jl_tparam(type,i)))
557-
return 1;
558-
}
559-
return 0;
560-
}
561-
562550
static intptr_t wrapper_id(jl_value_t *t)
563551
{
564552
// DataType wrappers occur often, e.g. when called as constructors.
@@ -579,14 +567,13 @@ static int is_typekey_ordered(jl_value_t **key, size_t n)
579567
jl_value_t *k = key[i];
580568
if (jl_is_typevar(k))
581569
return 0;
582-
if (jl_is_type(k) && k != jl_bottom_type && !wrapper_id(k) &&
583-
!(jl_is_datatype(k) && (((jl_datatype_t*)k)->uid ||
584-
(!jl_has_free_typevars(k) && !contains_unions(k)))))
585-
return 0;
586570
if (jl_is_datatype(k)) {
587571
jl_datatype_t *kdt = (jl_datatype_t *) k;
588572
if (!is_typekey_ordered(jl_svec_data(kdt->parameters), jl_svec_len(kdt->parameters)))
589573
return 0;
574+
} else {
575+
if (jl_is_type(k) && k != jl_bottom_type && !wrapper_id(k))
576+
return 0; // Union or UnionAll which is not a wrapper
590577
}
591578
}
592579
return 1;

0 commit comments

Comments
 (0)