Skip to content

Commit

Permalink
smarter order of checks in jl_types_equal (#28677)
Browse files Browse the repository at this point in the history
this works around the test issue in RDatasets

(cherry picked from commit af3c452)
  • Loading branch information
JeffBezanson authored and KristofferC committed Sep 8, 2018
1 parent e29b4b4 commit 3feb0b6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/subtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -1188,6 +1188,13 @@ JL_DLLEXPORT int jl_types_equal(jl_value_t *a, jl_value_t *b)
{
if (obviously_egal(a, b)) return 1;
if (obviously_unequal(a, b)) return 0;
if (jl_is_datatype(a) && !jl_is_concrete_type(b)) {
// if one type looks more likely to be abstract, check it on the left
// first in order to reject more quickly.
jl_value_t *temp = a;
a = b;
b = temp;
}
return jl_subtype(a, b) && jl_subtype(b, a);
}

Expand Down

0 comments on commit 3feb0b6

Please sign in to comment.