Skip to content

Commit 1db3279

Browse files
authored
Merge pull request #21339 from JuliaLang/mh/subtype_tests
Some more `typeintersect` tests
2 parents df2438c + ea8d04b commit 1db3279

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

test/subtype.jl

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,69 @@ ftwoparams(::TwoParams{<:Real,<:Real}) = 3
999999
@testintersect(Tuple{Val{Val{0}}, Val{N}} where N, Tuple{Val{Val{N}}, Val{N}} where N, Tuple{Val{Val{0}},Val{0}})
10001000
@testintersect(Tuple{Val{Val{N}}, Val{0}} where N, Tuple{Val{Val{N}}, Val{N}} where N, Tuple{Val{Val{0}},Val{0}})
10011001

1002+
# a bunch of cases found by fuzzing
1003+
let a = Tuple{Float64,T7} where T7,
1004+
b = Tuple{S5,Tuple{S5}} where S5
1005+
@test_broken typeintersect(a, b) <: b
1006+
end
1007+
let a = Tuple{T1,T1} where T1,
1008+
b = Tuple{Val{S2},S6} where S2 where S6
1009+
@test_broken typeintersect(a, b) == typeintersect(b, a)
1010+
end
1011+
let a = Val{Tuple{T1,T1}} where T1,
1012+
b = Val{Tuple{Val{S2},S6}} where S2 where S6
1013+
@testintersect(a, b, Val{Tuple{Val{T},Val{T}}} where T)
1014+
end
1015+
let a = Tuple{Float64,T3,T4} where T4 where T3,
1016+
b = Tuple{S2,Tuple{S3},S3} where S2 where S3
1017+
@test_broken typeintersect(a, b) == typeintersect(b, a)
1018+
end
1019+
let a = Tuple{T1,Tuple{T1}} where T1,
1020+
b = Tuple{Float64,S3} where S3
1021+
@test_broken typeintersect(a, b) <: a
1022+
end
1023+
let a = Tuple{5,T4,T5} where T4 where T5,
1024+
b = Tuple{S2,S3,Tuple{S3}} where S2 where S3
1025+
@test_broken typeintersect(a, b) == typeintersect(b, a)
1026+
end
1027+
let a = Tuple{T2,Tuple{T4,T2}} where T4 where T2,
1028+
b = Tuple{Float64,Tuple{Tuple{S3},S3}} where S3
1029+
@test_broken typeintersect(a, b) <: b
1030+
end
1031+
let a = Tuple{Tuple{T2,4},T6} where T2 where T6,
1032+
b = Tuple{Tuple{S2,S3},Tuple{S2}} where S2 where S3
1033+
@test_broken typeintersect(a, b) == typeintersect(b, a)
1034+
end
1035+
let a = Tuple{T3,Int64,Tuple{T3}} where T3,
1036+
b = Tuple{S3,S3,S4} where S4 where S3
1037+
@test_broken typeintersect(a, b) <: a
1038+
end
1039+
let a = Tuple{T1,Val{T2},T2} where T2 where T1,
1040+
b = Tuple{Float64,S1,S2} where S2 where S1
1041+
@test_broken typeintersect(a, b) == typeintersect(b, a)
1042+
end
1043+
let a = Tuple{T1,Val{T2},T2} where T2 where T1,
1044+
b = Tuple{Float64,S1,S2} where S2 where S1
1045+
@test_broken typeintersect(a, b) <: a
1046+
end
1047+
let a = Tuple{Float64,T1} where T1,
1048+
b = Tuple{S1,Tuple{S1}} where S1
1049+
@test_broken typeintersect(a, b) <: b
1050+
end
1051+
let a = Tuple{Val{T1},T2,T2} where T2 where T1,
1052+
b = Tuple{Val{Tuple{S2}},S3,Float64} where S2 where S3
1053+
@testintersect(a, b, Tuple{Val{Tuple{S2}},Float64,Float64} where S2)
1054+
end
1055+
let a = Tuple{T1,T2,T2} where T1 where T2,
1056+
b = Tuple{Val{S2},S2,Float64} where S2,
1057+
x = Tuple{Val{Float64},Float64,Float64}
1058+
@test_broken x <: typeintersect(a, b)
1059+
end
1060+
let a = Val{Tuple{T1,Val{T2},Val{Int64},Tuple{Tuple{T3,5,Float64},T4,T2,T5}}} where T1 where T5 where T4 where T3 where T2,
1061+
b = Val{Tuple{Tuple{S1,5,Float64},Val{S2},S3,Tuple{Tuple{Val{Float64},5,Float64},2,Float64,S4}}} where S2 where S3 where S1 where S4
1062+
@test_skip typeintersect(b, a)
1063+
end
1064+
10021065
# issue #20992
10031066
abstract type A20992{T,D,d} end
10041067
abstract type B20992{SV,T,D,d} <: A20992{T,D,d} end

0 commit comments

Comments
 (0)