diff --git a/src/subtype.c b/src/subtype.c index fcb4aac2aaef2..e05965caa0ee7 100644 --- a/src/subtype.c +++ b/src/subtype.c @@ -1170,7 +1170,7 @@ static int subtype(jl_value_t *x, jl_value_t *y, jl_stenv_t *e, int param) x = pick_union_element(x, e, 0); } if (jl_is_uniontype(y)) { - if (x == ((jl_uniontype_t*)y)->a || x == ((jl_uniontype_t*)y)->b) + if (in_union(y, x)) return 1; if (jl_is_unionall(x)) return subtype_unionall(y, (jl_unionall_t*)x, e, 0, param);