We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent de3ea08 commit 2d8f4dbCopy full SHA for 2d8f4db
src/subtype.c
@@ -2803,6 +2803,14 @@ static jl_value_t *intersect_types(jl_value_t *x, jl_value_t *y, int emptiness_o
2803
jl_stenv_t e;
2804
if (obviously_disjoint(x, y, 0))
2805
return jl_bottom_type;
2806
+ if (jl_is_dispatch_tupletype(x) || jl_is_dispatch_tupletype(y)) {
2807
+ if (jl_subtype(x, y))
2808
+ return x;
2809
+ else if (jl_subtype(y, x))
2810
+ return y;
2811
+ else
2812
+ return jl_bottom_type;
2813
+ }
2814
init_stenv(&e, NULL, 0);
2815
e.intersection = e.ignore_free = 1;
2816
e.emptiness_only = emptiness_only;
test/subtype.jl
@@ -1615,3 +1615,22 @@ end
1615
Tuple{Array{Tuple{Vararg{Int64,N}},N},Tuple{Vararg{Array{Int64,1},N}}} where N,
1616
Tuple{Array{Tuple{Int64},1}, Tuple},
1617
Tuple{Array{Tuple{Int64},1},Tuple{Array{Int64,1}}})
1618
+
1619
+# issue #32703
1620
+struct Str{C} <: AbstractString
1621
+end
1622
+struct CSE{X}
1623
1624
+const UTF16CSE = CSE{1}
1625
+const UTF16Str = Str{UTF16CSE}
1626
+const ASCIIStr = Str{CSE{2}}
1627
+c32703(::Type{<:Str{UTF16CSE}}, str::AbstractString) = 42
1628
+c32703(::Type{<:Str{C}}, str::Str{C}) where {C<:CSE} = str
1629
1630
+@testintersect(Tuple{Type{UTF16Str},ASCIIStr},
1631
+ Tuple{Type{<:Str{C}}, Str{C}} where {C<:CSE},
1632
+ Union{})
1633
+@test c32703(UTF16Str, ASCIIStr()) == 42
1634
+@test_broken typeintersect(Tuple{Vector{Vector{Float32}},Matrix,Matrix},
1635
+ Tuple{Vector{V},Matrix{Int},Matrix{S}} where {S, V<:AbstractVector{S}}) ==
1636
+ Tuple{Array{Array{Float32,1},1},Array{Int,2},Array{Float32,2}}
0 commit comments