Skip to content

Commit

Permalink
Subtype: fix union estimation on non-type parameters. (#49345)
Browse files Browse the repository at this point in the history
(cherry picked from commit fdd71c7)
  • Loading branch information
N5N3 authored and KristofferC committed Apr 14, 2023
1 parent f7d8e20 commit 6d03913
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/subtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,7 @@ static int may_contain_union_decision(jl_value_t *x, jl_stenv_t *e, jl_typeenv_t
return 0;
}
if (!jl_is_typevar(x))
return 1;
return jl_is_type(x);
jl_typeenv_t *t = log;
while (t != NULL) {
if (x == (jl_value_t *)t->var)
Expand Down
5 changes: 4 additions & 1 deletion test/subtype.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2317,8 +2317,11 @@ end
# issue #39967
@test (NTuple{27, T} where {S, T<:Union{Array, Array{S}}}) <: Tuple{Array, Array, Vararg{AbstractArray, 25}}

let a = (isodd(i) ? Pair{Char, String} : Pair{String, String} for i in 1:2000)
let
a = (isodd(i) ? Pair{Char, String} : Pair{String, String} for i in 1:2000)
@test Tuple{Type{Pair{Union{Char, String}, String}}, a...} <: Tuple{Type{Pair{K, V}}, Vararg{Pair{A, B} where B where A}} where V where K
a = (isodd(i) ? Matrix{Int} : Vector{Int} for i in 1:4000)
@test Tuple{Type{Pair{Union{Char, String}, String}}, a...,} <: Tuple{Type{Pair{K, V}}, Vararg{Array}} where V where K
end

#issue 48582
Expand Down

0 comments on commit 6d03913

Please sign in to comment.