Skip to content

Commit

Permalink
Set intersection = 1 during intersect_sub_datatype (#46882)
Browse files Browse the repository at this point in the history
(cherry picked from commit e6d9979)
  • Loading branch information
N5N3 authored and KristofferC committed Dec 21, 2022
1 parent d12c9cb commit bc9d0fc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/subtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -2780,7 +2780,7 @@ static jl_value_t *intersect_sub_datatype(jl_datatype_t *xd, jl_datatype_t *yd,
JL_GC_PUSHARGS(env, envsz);
jl_stenv_t tempe;
init_stenv(&tempe, env, envsz);
tempe.ignore_free = 1;
tempe.intersection = tempe.ignore_free = 1;
if (subtype_in_env(isuper, super_pattern, &tempe)) {
jl_value_t *wr = wrapper;
int i;
Expand Down
7 changes: 7 additions & 0 deletions test/subtype.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1885,3 +1885,10 @@ let A = Tuple{Array{Pair{T, JT} where JT<:Ref{T}, 1} where T, Vector},
@test_broken I <: A
@test_broken !Base.has_free_typevars(I)
end

#issue #46871
struct A46871{T, N, M} <: AbstractArray{T, N} end
struct B46871{T, N} <: Ref{A46871{T, N, N}} end
for T in (B46871{Int, N} where {N}, B46871{Int}) # intentional duplication
@testintersect(T, Ref{<:AbstractArray{<:Real, 3}}, B46871{Int, 3})
end

0 comments on commit bc9d0fc

Please sign in to comment.