@@ -2362,6 +2362,16 @@ end
2362
2362
Tuple{Type{Tuple{Val{T},T}}, Val{T}} where T,
2363
2363
Union{})
2364
2364
2365
+ @test only (intersection_env (Val{Union{Val{Val{T}} where {T},Int}}, Val{Union{T,Int}} where T)[2 ]) === Val{Val{T}} where {T}
2366
+
2367
+ # issue 47654
2368
+ Vec47654{T} = Union{AbstractVector{T}, AbstractVector{Union{T,Nothing}}}
2369
+ struct Wrapper47654{T, V<: Vec47654{T} }
2370
+ v:: V
2371
+ end
2372
+ abstract type P47654{A} end
2373
+ @test Wrapper47654{P47654, Vector{Union{P47654,Nothing}}} <: Wrapper47654
2374
+
2365
2375
@testset " known subtype/intersect issue" begin
2366
2376
# issue 45874
2367
2377
# Causes a hang due to jl_critical_error calling back into malloc...
@@ -2390,7 +2400,7 @@ end
2390
2400
@test_broken (Tuple{Q,Int} where Q<: Int ) <: Tuple{T,T} where T
2391
2401
2392
2402
# issue 24333
2393
- @test_broken (Type{Union{Ref,Cvoid}} <: Type{Union{T,Cvoid}} where T)
2403
+ @test (Type{Union{Ref,Cvoid}} <: Type{Union{T,Cvoid}} where T)
2394
2404
2395
2405
# issue 22123
2396
2406
t1 = Ref{Ref{Ref{Union{Int64, T}}} where T}
@@ -2401,6 +2411,18 @@ end
2401
2411
@test_broken (Tuple{T1,T1} where T1<: (Val{T2} where T2) ) <: (Tuple{Val{S},Val{S}} where S)
2402
2412
end
2403
2413
2414
+ # issue #47658
2415
+ let T = Ref{NTuple{8 , Ref{Union{Int, P}}}} where P,
2416
+ S = Ref{NTuple{8 , Ref{Union{Int, P}}}} where P
2417
+ # note T and S are identical but we need 2 copies to avoid being fooled by pointer equality
2418
+ @test T <: Union{Int, S}
2419
+ end
2420
+
2421
+ # try to fool a greedy algorithm that picks X=Int, Y=String here
2422
+ @test Tuple{Ref{Union{Int,String}}, Ref{Union{Int,String}}} <: Tuple{Ref{Union{X,Y}}, Ref{X}} where {X,Y}
2423
+ # this slightly more complex case has been broken since 1.0 (worked in 0.6)
2424
+ @test_broken Tuple{Ref{Union{Int,String,Missing}}, Ref{Union{Int,String}}} <: Tuple{Ref{Union{X,Y}}, Ref{X}} where {X,Y}
2425
+
2404
2426
@test ! (Tuple{Any, Any, Any} <: Tuple{Any, Vararg{T}} where T)
2405
2427
2406
2428
abstract type MyAbstract47877{C}; end
0 commit comments