Skip to content

Commit 1f47617

Browse files
authored
fix #32726, regression in subtyping Tuple{Type{T},Vararg{T}} (#32742)
1 parent f38de00 commit 1f47617

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/subtype.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,6 +1665,8 @@ JL_DLLEXPORT int jl_obvious_subtype(jl_value_t *x, jl_value_t *y, int *subtype)
16651665
assert(vy != JL_VARARG_NONE && istuple && iscov);
16661666
jl_value_t *a1 = (vx != JL_VARARG_NONE && i >= npx - 1) ? vxt : jl_tparam(x, i);
16671667
jl_value_t *b = jl_unwrap_vararg(jl_tparam(y, i));
1668+
if (jl_is_typevar(b) && var_occurs_inside(y, (jl_tvar_t*)b, 0, 1))
1669+
return 0;
16681670
if (nparams_expanded_x > npy && jl_is_typevar(b) && concrete_min(a1) > 1) {
16691671
// diagonal rule for 2 or more elements: they must all be concrete on the LHS
16701672
*subtype = 0;

test/subtype.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,9 @@ function test_5()
393393

394394
@test isequal_type(Ref{Tuple{Union{Int,Int8},Int16,T}} where T,
395395
Ref{Union{Tuple{Int,Int16,S},Tuple{Int8,Int16,S}}} where S)
396+
397+
# issue #32726
398+
@test Tuple{Type{Any}, Int, Float64, String} <: Tuple{Type{T}, Vararg{T}} where T
396399
end
397400

398401
# tricky type variable lower bounds

0 commit comments

Comments
 (0)