@@ -1569,6 +1569,10 @@ static int local_forall_exists_subtype(jl_value_t *x, jl_value_t *y, jl_stenv_t
15691569{
15701570    int16_t  oldRmore  =  e -> Runions .more ;
15711571    int  sub ;
1572+     int  kindx  =  !jl_has_free_typevars (x );
1573+     int  kindy  =  !jl_has_free_typevars (y );
1574+     if  (kindx  &&  kindy )
1575+         return  jl_subtype (x , y );
15721576    if  (may_contain_union_decision (y , e , NULL ) &&  pick_union_decision (e , 1 ) ==  0 ) {
15731577        jl_saved_unionstate_t  oldRunions ; push_unionstate (& oldRunions , & e -> Runions );
15741578        e -> Lunions .used  =  e -> Runions .used  =  0 ;
@@ -1581,6 +1585,8 @@ static int local_forall_exists_subtype(jl_value_t *x, jl_value_t *y, jl_stenv_t
15811585        // Once limit_slow == 1, also skip it if 
15821586        // 1) `forall_exists_subtype` return false 
15831587        // 2) the left `Union` looks big 
1588+         if  (limit_slow  ==  -1 )
1589+             limit_slow  =  kindx  ||  kindy ;
15841590        if  (noRmore  ||  (limit_slow  &&  (count  >  3   ||  !sub )))
15851591            e -> Runions .more  =  oldRmore ;
15861592    }
@@ -1630,8 +1636,7 @@ static int forall_exists_equal(jl_value_t *x, jl_value_t *y, jl_stenv_t *e)
16301636
16311637    jl_saved_unionstate_t  oldLunions ; push_unionstate (& oldLunions , & e -> Lunions );
16321638
1633-     int  limit_slow  =  !jl_has_free_typevars (x ) ||  !jl_has_free_typevars (y );
1634-     int  sub  =  local_forall_exists_subtype (x , y , e , 2 , limit_slow );
1639+     int  sub  =  local_forall_exists_subtype (x , y , e , 2 , -1 );
16351640    if  (sub ) {
16361641        flip_offset (e );
16371642        sub  =  local_forall_exists_subtype (y , x , e , 0 , 0 );
0 commit comments