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
  • Loading branch information
JeffBezanson authored Oct 3, 2018
1 parent 37dc16e commit ea16391
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 @@ -1355,7 +1355,7 @@ static jl_value_t *set_var_to_const(jl_varbinding_t *bb, jl_value_t *v JL_MAYBE_
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 ea16391

Please sign in to comment.