Skip to content

Commit

Permalink
fix #29468, bug in intersection of different-length vararg tuples (#2…
Browse files Browse the repository at this point in the history
…9487)

(cherry picked from commit ea16391)
  • Loading branch information
JeffBezanson authored and KristofferC committed Feb 11, 2019
1 parent bc610f8 commit e933317
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/subtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,7 @@ static jl_value_t *set_var_to_const(jl_varbinding_t *bb, jl_value_t *v, jl_varbi
bb->lb = bb->ub = v;
}
else if (jl_is_long(v) && jl_is_long(bb->lb)) {
if (jl_unbox_long(v) + offset != jl_unbox_long(bb->lb))
if (jl_unbox_long(v) != jl_unbox_long(bb->lb))
return jl_bottom_type;
}
else if (!jl_egal(v, bb->lb)) {
Expand Down
14 changes: 14 additions & 0 deletions test/subtype.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1343,3 +1343,17 @@ struct A28256{names, T<:NamedTuple{names, <:Tuple}}
x::T
end
@test A28256{(:a,), NamedTuple{(:a,),Tuple{Int}}}((a=1,)) isa A28256

# issue #29468
@testintersect(Tuple{Vararg{Val{N}, N}} where N,
Tuple{Val{2}, Vararg{Val{2}}},
Tuple{Val{2}, Val{2}})
@testintersect(Tuple{Vararg{Val{N}, N}} where N,
Tuple{Val{3}, Vararg{Val{3}}},
Tuple{Val{3}, Val{3}, Val{3}})
@testintersect(Tuple{Vararg{Val{N}, N}} where N,
Tuple{Val{1}, Vararg{Val{2}}},
Tuple{Val{1}})
@testintersect(Tuple{Vararg{Val{N}, N}} where N,
Tuple{Val{2}, Vararg{Val{3}}},
Union{})

0 comments on commit e933317

Please sign in to comment.