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
  • Loading branch information
N5N3 committed Apr 13, 2023
1 parent d6752eb commit fdd71c7
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 @@ -1536,7 +1536,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 @@ -2453,8 +2453,11 @@ let A = Tuple{Type{T}, T} where T,
@testintersect(A, B, C)
end

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 fdd71c7

Please sign in to comment.