Skip to content

Commit

Permalink
More through reachable_var check.
Browse files Browse the repository at this point in the history
Fix #47874 case2
  • Loading branch information
N5N3 committed Jan 8, 2023
1 parent b6a7a6c commit 6e0c036
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/subtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -2368,6 +2368,9 @@ static int _reachable_var(jl_value_t *x, jl_tvar_t *y, jl_stenv_t *e)
{
if (in_union(x, (jl_value_t*)y))
return 1;
if (jl_is_uniontype(x))
return _reachable_var(((jl_uniontype_t *)x)->a, y, e) ||
_reachable_var(((jl_uniontype_t *)x)->b, y, e);
if (!jl_is_typevar(x))
return 0;
jl_varbinding_t *xv = lookup(e, (jl_tvar_t*)x);
Expand Down
8 changes: 8 additions & 0 deletions test/subtype.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2308,6 +2308,14 @@ let S1 = Tuple{Int, Any, Union{Val{C1}, C1}} where {R1<:Real, C1<:Union{Complex{
end
end

let S = Tuple{Int, Vararg{Val{C} where C<:Union{Complex{R}, R}}} where R
T = Tuple{Any, Vararg{Val{C} where C<:Union{Complex{R}, R}}} where R<:Real
I = Tuple{Any, Vararg{Val{C} where C<:Union{Complex{R}, R}}} where R<:Real
@testintersect(S, T, !Union{})
@test_broken typeintersect(S, T) == I
@test_broken typeintersect(T, S) == I
end

let S = Tuple{T2, V2} where {T2, N2, V2<:(Array{S2, N2} where {S2 <: T2})},
T = Tuple{V1, T1} where {T1, N1, V1<:(Array{S1, N1} where {S1 <: T1})}
@testintersect(S, T, !Union{})
Expand Down

0 comments on commit 6e0c036

Please sign in to comment.