Skip to content

Commit bc9d0fc

Browse files
N5N3KristofferC
authored andcommitted
Set intersection = 1 during intersect_sub_datatype (#46882)
(cherry picked from commit e6d9979)
1 parent d12c9cb commit bc9d0fc

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/subtype.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2780,7 +2780,7 @@ static jl_value_t *intersect_sub_datatype(jl_datatype_t *xd, jl_datatype_t *yd,
27802780
JL_GC_PUSHARGS(env, envsz);
27812781
jl_stenv_t tempe;
27822782
init_stenv(&tempe, env, envsz);
2783-
tempe.ignore_free = 1;
2783+
tempe.intersection = tempe.ignore_free = 1;
27842784
if (subtype_in_env(isuper, super_pattern, &tempe)) {
27852785
jl_value_t *wr = wrapper;
27862786
int i;

test/subtype.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,3 +1885,10 @@ let A = Tuple{Array{Pair{T, JT} where JT<:Ref{T}, 1} where T, Vector},
18851885
@test_broken I <: A
18861886
@test_broken !Base.has_free_typevars(I)
18871887
end
1888+
1889+
#issue #46871
1890+
struct A46871{T, N, M} <: AbstractArray{T, N} end
1891+
struct B46871{T, N} <: Ref{A46871{T, N, N}} end
1892+
for T in (B46871{Int, N} where {N}, B46871{Int}) # intentional duplication
1893+
@testintersect(T, Ref{<:AbstractArray{<:Real, 3}}, B46871{Int, 3})
1894+
end

0 commit comments

Comments
 (0)