@@ -2618,10 +2618,20 @@ end
26182618abstract type A54356{T<: Real } end
26192619struct B54356{T} <: A54356{T} end
26202620struct C54356{S,T<: Union{S,Complex{S}} } end
2621- let S = Tuple{Val, Val{T}} where {T}, R = Tuple{Val{Val{T}}, Val{T}} where {T}
2622- # general parameters check
2621+ struct D54356{S<: Real ,T} end
2622+ let S = Tuple{Val, Val{T}} where {T}, R = Tuple{Val{Val{T}}, Val{T}} where {T},
2623+ SS = Tuple{Val, Val{T}, Val{T}} where {T}, RR = Tuple{Val{Val{T}}, Val{T}, Val{T}} where {T}
2624+ # parameters check for self
26232625 @testintersect (Tuple{Val{A}, A} where {B, A<: Union{Val{B}, Complex{B}} }, S{1 }, R{1 })
2626+ # parameters check for supertype (B54356 -> A54356)
26242627 @testintersect (Tuple{Val{A}, A} where {B, A<: Union{Val{B}, B54356{B}} }, S{1 }, R{1 })
2628+ # enure unused TypeVar skips the `UnionAll` wrapping
2629+ @testintersect (Tuple{Val{A}, A} where {B, A<: (Union{Val{B}, D54356{B,C}} where {C}) }, S{1 }, R{1 })
2630+ # invariant parameter should not get narrowed
2631+ @testintersect (Tuple{Val{A}, A} where {B, A<: Union {Val{B}, Val{Union{Int,Complex{B}}}}}, S{1 }, R{1 })
2632+ # bit value could not be `Union` element
2633+ @testintersect (Tuple{Val{A}, A, Val{B}} where {B, A<: Union{B, Val{B}} }, SS{1 }, RR{1 })
2634+ @testintersect (Tuple{Val{A}, A, Val{B}} where {B, A<: Union{B, Complex{B}} }, SS{1 }, Union{})
26252635 # `check_datatype_parameters` should ignore bad `Union` elements in constraint's ub
26262636 T = Tuple{Val{Union{Val{Nothing}, Val{C54356{V,V}}}}, Val{Nothing}} where {Nothing<: V <: Nothing }
26272637 @test T <: S{Nothing}
@@ -2630,6 +2640,7 @@ let S = Tuple{Val, Val{T}} where {T}, R = Tuple{Val{Val{T}}, Val{T}} where {T}
26302640 # extra check for Vararg
26312641 @testintersect (Tuple{Val{A}, A} where {B, A<: Union{Val{B}, NTuple{B,Any}} }, S{- 1 }, R{- 1 })
26322642 @testintersect (Tuple{Val{A}, A} where {B, A<: Union{Val{B}, Tuple{Any,Vararg{Any,B}}} }, S{- 1 }, R{- 1 })
2643+ @testintersect (Tuple{Val{A}, A} where {B, A<: Union {Val{B}, Tuple{Vararg{Int,Union{Int,Complex{B}}}}}}, S{1 }, R{1 })
26332644 # extra check for NamedTuple
26342645 @testintersect (Tuple{Val{A}, A} where {B, A<: Union{Val{B}, NamedTuple{B,Tuple{Int}}} }, S{1 }, R{1 })
26352646 @testintersect (Tuple{Val{A}, A} where {B, A<: Union{Val{B}, NamedTuple{B,Tuple{Int}}} }, S{(1 ,)}, R{(1 ,)})
0 commit comments