@@ -2618,10 +2618,20 @@ end
2618
2618
abstract type A54356{T<: Real } end
2619
2619
struct B54356{T} <: A54356{T} end
2620
2620
struct 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
2623
2625
@testintersect (Tuple{Val{A}, A} where {B, A<: Union{Val{B}, Complex{B}} }, S{1 }, R{1 })
2626
+ # parameters check for supertype (B54356 -> A54356)
2624
2627
@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{})
2625
2635
# `check_datatype_parameters` should ignore bad `Union` elements in constraint's ub
2626
2636
T = Tuple{Val{Union{Val{Nothing}, Val{C54356{V,V}}}}, Val{Nothing}} where {Nothing<: V <: Nothing }
2627
2637
@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}
2630
2640
# extra check for Vararg
2631
2641
@testintersect (Tuple{Val{A}, A} where {B, A<: Union{Val{B}, NTuple{B,Any}} }, S{- 1 }, R{- 1 })
2632
2642
@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 })
2633
2644
# extra check for NamedTuple
2634
2645
@testintersect (Tuple{Val{A}, A} where {B, A<: Union{Val{B}, NamedTuple{B,Tuple{Int}}} }, S{1 }, R{1 })
2635
2646
@testintersect (Tuple{Val{A}, A} where {B, A<: Union{Val{B}, NamedTuple{B,Tuple{Int}}} }, S{(1 ,)}, R{(1 ,)})
0 commit comments