Skip to content

Commit e6d9979

Browse files
authored
Set intersection = 1 during intersect_sub_datatype (#46882)
1 parent b43bc62 commit e6d9979

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
@@ -2897,7 +2897,7 @@ static jl_value_t *intersect_sub_datatype(jl_datatype_t *xd, jl_datatype_t *yd,
28972897
JL_GC_PUSHARGS(env, envsz);
28982898
jl_stenv_t tempe;
28992899
init_stenv(&tempe, env, envsz);
2900-
tempe.ignore_free = 1;
2900+
tempe.intersection = tempe.ignore_free = 1;
29012901
if (subtype_in_env(isuper, super_pattern, &tempe)) {
29022902
jl_value_t *wr = wrapper;
29032903
int i;

test/subtype.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,3 +2182,10 @@ S46735{B<:Val, M<:AbstractMatrix} = Tuple{<:Union{B, <:Val{<:B}},M,<:(Union{Abst
21822182
A46735{B<:Val, M<:AbstractMatrix} = Tuple{<:Union{B, <:Val{<:B}},M,Union{AbstractMatrix{B}, AbstractMatrix{<:Vector{<:B}}}}
21832183
@testintersect(A46735{B} where {B}, A46735, !Union{})
21842184
@testintersect(A46735{B, M} where {B, M}, A46735, !Union{})
2185+
2186+
#issue #46871
2187+
struct A46871{T, N, M} <: AbstractArray{T, N} end
2188+
struct B46871{T, N} <: Ref{A46871{T, N, N}} end
2189+
for T in (B46871{Int, N} where {N}, B46871{Int}) # intentional duplication
2190+
@testintersect(T, Ref{<:AbstractArray{<:Real, 3}}, B46871{Int, 3})
2191+
end

0 commit comments

Comments
 (0)