From e6e86acbf492f478a135ccccab64765b14cd754f Mon Sep 17 00:00:00 2001 From: K Pamnany Date: Thu, 18 May 2023 07:28:59 -0400 Subject: [PATCH 1/2] Disable slow path to handle Union explosion --- src/subtype.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/subtype.c b/src/subtype.c index fedaa6bcfabb9..9d1028af9c8a7 100644 --- a/src/subtype.c +++ b/src/subtype.c @@ -1386,7 +1386,8 @@ static int local_forall_exists_subtype(jl_value_t *x, jl_value_t *y, jl_stenv_t // Once limit_slow == 1, also skip it if // 1) `forall_exists_subtype` return false // 2) the left `Union` looks big - if (noRmore || (limit_slow && (count > 3 || !sub))) + // NOTE: altered to fix issue 49857 + if (noRmore || limit_slow) e->Runions.more = oldRmore; } else { From 2dcb8f04fb633d640e5949d159c3abdc5e217a83 Mon Sep 17 00:00:00 2001 From: K Pamnany Date: Thu, 18 May 2023 09:37:00 -0400 Subject: [PATCH 2/2] 3 tests are broken due to disabling slow path --- test/subtype.jl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/subtype.jl b/test/subtype.jl index 4629eac5a9429..925c719031ee2 100644 --- a/test/subtype.jl +++ b/test/subtype.jl @@ -2272,8 +2272,9 @@ abstract type P47654{A} end @test_broken typeintersect(Tuple{Vector{VT}, Vector{VT}} where {N1, VT<:AbstractVector{N1}}, Tuple{Vector{VN} where {N, VN<:AbstractVector{N}}, Vector{Vector{Float64}}}) !== Union{} #issue 40865 - @test Tuple{Set{Ref{Int}}, Set{Ref{Int}}} <: Tuple{Set{KV}, Set{K}} where {K,KV<:Union{K,Ref{K}}} - @test Tuple{Set{Val{Int}}, Set{Val{Int}}} <: Tuple{Set{KV}, Set{K}} where {K,KV<:Union{K,Val{K}}} + #broken due to 49857 and 49875 + @test_broken Tuple{Set{Ref{Int}}, Set{Ref{Int}}} <: Tuple{Set{KV}, Set{K}} where {K,KV<:Union{K,Ref{K}}} + @test_broken Tuple{Set{Val{Int}}, Set{Val{Int}}} <: Tuple{Set{KV}, Set{K}} where {K,KV<:Union{K,Val{K}}} #issue 39099 A = Tuple{Tuple{Int, Int, Vararg{Int, N}}, Tuple{Int, Vararg{Int, N}}, Tuple{Vararg{Int, N}}} where N @@ -2310,7 +2311,8 @@ end # try to fool a greedy algorithm that picks X=Int, Y=String here @test Tuple{Ref{Union{Int,String}}, Ref{Union{Int,String}}} <: Tuple{Ref{Union{X,Y}}, Ref{X}} where {X,Y} -@test Tuple{Ref{Union{Int,String,Missing}}, Ref{Union{Int,String}}} <: Tuple{Ref{Union{X,Y}}, Ref{X}} where {X,Y} +# broken due to 49857 and 49875 +@test_broken Tuple{Ref{Union{Int,String,Missing}}, Ref{Union{Int,String}}} <: Tuple{Ref{Union{X,Y}}, Ref{X}} where {X,Y} @test !(Tuple{Any, Any, Any} <: Tuple{Any, Vararg{T}} where T)