diff --git a/src/subtype.c b/src/subtype.c index fd9bd3e8be00f..2c11bd733ec9e 100644 --- a/src/subtype.c +++ b/src/subtype.c @@ -1510,6 +1510,9 @@ static int local_forall_exists_subtype(jl_value_t *x, jl_value_t *y, jl_stenv_t { int16_t oldRmore = e->Runions.more; int sub; + // fast-path for #49857 + if (obviously_in_union(y, x)) + return 1; int kindx = !jl_has_free_typevars(x); int kindy = !jl_has_free_typevars(y); if (kindx && kindy) diff --git a/test/subtype.jl b/test/subtype.jl index 4a3e55c039e94..c637fccb6552f 100644 --- a/test/subtype.jl +++ b/test/subtype.jl @@ -2547,3 +2547,6 @@ let T = Tuple{Union{Type{T}, Type{S}}, Union{Val{T}, Val{S}}, Union{Val{T}, S}} @test typeintersect(T, S) == Tuple{Type{A}, Union{Val{A}, Val{S} where S<:Union{Val, A}, Val{x} where x<:Val, Val{x} where x<:Union{Val, A}}, Val{A}} where A<:(Val{S} where S<:Val) @test typeintersect(S, T) == Tuple{Type{T}, Union{Val{T}, Val{S}}, Val{T}} where {T<:Val, S<:(Union{Val{A}, Val} where A)} end + +#issue #49857 +@test !<:(Type{Vector{Union{Base.BitInteger, Base.IEEEFloat, StridedArray, Missing, Nothing, Val{T}}}} where {T}, Type{Array{T}} where {T})