@@ -573,6 +573,11 @@ static int var_gt(jl_tvar_t *b, jl_value_t *a, jl_stenv_t *e, int param)
573
573
return 0 ;
574
574
bb -> lb = simple_join (bb -> lb , a );
575
575
assert (bb -> lb != (jl_value_t * )b );
576
+ if (jl_is_typevar (a )) {
577
+ jl_varbinding_t * aa = lookup (e , (jl_tvar_t * )a );
578
+ if (aa && !aa -> right && bb -> depth0 != aa -> depth0 && param == 2 && var_outside (e , b , (jl_tvar_t * )a ))
579
+ return subtype_left_var (aa -> ub , aa -> lb , e );
580
+ }
576
581
return 1 ;
577
582
}
578
583
@@ -960,7 +965,7 @@ static int subtype(jl_value_t *x, jl_value_t *y, jl_stenv_t *e, int param)
960
965
if (xr ) {
961
966
if (yy ) record_var_occurrence (yy , e , param );
962
967
if (yr ) {
963
- if ( xx ) record_var_occurrence (xx , e , param );
968
+ record_var_occurrence (xx , e , param );
964
969
return subtype (xx -> lb , yy -> ub , e , 0 );
965
970
}
966
971
return var_lt ((jl_tvar_t * )x , y , e , param );
@@ -1410,6 +1415,7 @@ static int subtype_in_env(jl_value_t *x, jl_value_t *y, jl_stenv_t *e)
1410
1415
e2 .vars = e -> vars ;
1411
1416
e2 .intersection = e -> intersection ;
1412
1417
e2 .ignore_free = e -> ignore_free ;
1418
+ e2 .invdepth = e -> invdepth ;
1413
1419
e2 .envsz = e -> envsz ;
1414
1420
e2 .envout = e -> envout ;
1415
1421
e2 .envidx = e -> envidx ;
@@ -1624,6 +1630,8 @@ static int subtype_in_env_existential(jl_value_t *x, jl_value_t *y, jl_stenv_t *
1624
1630
{
1625
1631
jl_varbinding_t * v = e -> vars ;
1626
1632
int len = 0 ;
1633
+ if (x == jl_bottom_type || y == (jl_value_t * )jl_any_type )
1634
+ return 1 ;
1627
1635
while (v != NULL ) {
1628
1636
len ++ ;
1629
1637
v = v -> prev ;
0 commit comments