Skip to content

Commit 4f5510f

Browse files
authored
Merge pull request #20134 from JuliaLang/jb/fix20121
fix #20121, segfault in subtyping in big vcat operation
2 parents 5fa3e5d + e71c423 commit 4f5510f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/subtype.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,9 @@ static int subtype_tuple(jl_datatype_t *xd, jl_datatype_t *yd, jl_stenv_t *e, in
588588
if (!vvx && yi == (jl_value_t*)jl_any_type)
589589
break; // if y ends in `Vararg{Any}` skip checking everything
590590
}
591-
if (xi == lastx && yi == lasty && !jl_has_free_typevars(xi) && !jl_has_free_typevars(yi)) {
591+
if (xi == lastx &&
592+
((yi == lasty && !jl_has_free_typevars(xi) && !jl_has_free_typevars(yi)) ||
593+
(yi == lasty && !vx && vy && jl_is_leaf_type(xi)))) {
592594
// fast path for repeated elements
593595
}
594596
else if (e->Runions.depth == 0 && e->Lunions.depth == 0 && !jl_has_free_typevars(xi) && !jl_has_free_typevars(yi)) {

test/subtype.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,3 +826,6 @@ test_old()
826826
test_intersection()
827827
test_properties()
828828
test_intersection_properties()
829+
830+
# issue #20121
831+
@test NTuple{170,Matrix{Int}} <: (Tuple{Vararg{Union{Array{T,1},Array{T,2},Array{T,3}}}} where T)

0 commit comments

Comments
 (0)