@@ -2390,11 +2390,6 @@ abstract type P47654{A} end
23902390 @test Tuple{Set{Ref{Int}}, Set{Ref{Int}}} <: Tuple{Set{KV}, Set{K}} where {K,KV<: Union{K,Ref{K}} }
23912391 @test Tuple{Set{Val{Int}}, Set{Val{Int}}} <: Tuple{Set{KV}, Set{K}} where {K,KV<: Union{K,Val{K}} }
23922392
2393- # issue 39099
2394- A = Tuple{Tuple{Int, Int, Vararg{Int, N}}, Tuple{Int, Vararg{Int, N}}, Tuple{Vararg{Int, N}}} where N
2395- B = Tuple{NTuple{N, Int}, NTuple{N, Int}, NTuple{N, Int}} where N
2396- @test_broken ! (A <: B )
2397-
23982393 # issue 35698
23992394 @test_broken typeintersect (Type{Tuple{Array{T,1 } where T}}, UnionAll) != Union{}
24002395
@@ -2447,3 +2442,38 @@ end
24472442# issue 48582
24482443@test ! < :(Tuple{Pair{<: T ,<: T }, Val{S} where {S}} where {T<: Base.BitInteger },
24492444 Tuple{Pair{<: T ,<: T }, Val{Int}} where {T<: Base.BitInteger })
2445+
2446+ @testset " Type with Diagonal Vararg length" begin
2447+ A1 = Tuple{Tuple{Int,Int,Vararg{Int,N}},Tuple{Int,Vararg{Int,N}},Tuple{Vararg{Int,N}}} where N
2448+ A2 = Tuple{Tuple{Int,Vararg{Int,N}},Tuple{Int,Vararg{Int,N}},Tuple{Int,Vararg{Int,N}}} where N
2449+ B1 = NTuple{3 ,NTuple{N}} where N
2450+ B2 = NTuple{3 ,NTuple{N}} where {M,N<: M }
2451+ B3 = NTuple{3 ,NTuple{N}} where {M,M<: N <: M }
2452+ @test ! (A1 <: B1 ) && ! (A1 <: B2 )
2453+ @test_broken ! (A1 <: B3 )
2454+ @test ! (A1 >: B1 ) && ! (A1 >: B2 ) && ! (A1 >: B3 )
2455+ @testintersect (A1, B1, Union{})
2456+ @testintersect (A1, B2, Union{})
2457+ @test_broken typeintersect (A1, B3) == Union{} # failed due to wrong subtyping result
2458+ @testintersect (Tuple{Any,A1}, Tuple{Int,B3}, Union{}) # make sure the core intersect is correct
2459+
2460+ @test issub_strict (A2, B1) && issub_strict (A2, B2) && issub_strict (A2, B3)
2461+
2462+ A = Val{S} where {N,S<: Union {Tuple{Tuple{Int},Tuple{Int}},
2463+ Tuple{Tuple{Int,Int},Tuple{Int,Int}}}}
2464+ @test A <: Val{<:NTuple{2,NTuple{N}} where N}
2465+ # S could be `Union{...,...}` and we don't support Union{1,2}
2466+ @test ! (A <: Val{S} where {N,S<: NTuple{2,NTuple{N}} })
2467+ S = Tuple{Val{N},Vararg{Int,N}} where {N}
2468+ T = Tuple{Val{N},Int,Vararg{Int,N}} where {N}
2469+ @test ! (S <: T )
2470+ @test ! (S >: T )
2471+ @test typeintersect (S, T) == Union{}
2472+ S = Tuple{NTuple{N,Int},Val{N}} where {N}
2473+ T = Tuple{Tuple{Int,Vararg{Int,N}},Val{N}} where {N}
2474+ @test ! (S <: T )
2475+ @test ! (S >: T )
2476+ @test typeintersect (S, T) == Union{}
2477+ end
2478+
2479+ @test (Tuple{Int,Vararg{Int,N}} where {N}) <: (NTuple{N,Integer} where {M,M<:N<:M})
0 commit comments