Skip to content

Commit

Permalink
fix #30122, bad type intersection involving NTuple and Vararg (#30265)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored Dec 5, 2018
1 parent ff0acfe commit 5fd7cfb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/subtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -1454,7 +1454,9 @@ static jl_value_t *intersect_var(jl_tvar_t *b, jl_value_t *a, jl_stenv_t *e, int
else if (bb->concrete || bb->constraintkind == 1) {
jl_value_t *ub = R ? intersect_aside(a, bb->ub, e, d) : intersect_aside(bb->ub, a, e, d);
JL_GC_PUSH1(&ub);
if (ub == jl_bottom_type || !subtype_in_env(bb->lb, a, e)) {
if (ub == jl_bottom_type ||
// this fixes issue #30122. TODO: better fix for R flag.
(!R && !subtype_in_env(bb->lb, a, e))) {
JL_GC_POP();
return jl_bottom_type;
}
Expand Down
5 changes: 5 additions & 0 deletions test/subtype.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1394,3 +1394,8 @@ let M = M29955{T,Vector{Float64}} where T
@test_throws TypeError M{Float32}
@test_throws TypeError M{Real}
end

# issue #30122
@testintersect(Tuple{Pair{Int64,2}, NTuple},
Tuple{Pair{F,N},Tuple{Vararg{F,N}}} where N where F,
Tuple{Pair{Int64,2}, Tuple{Int64,Int64}})

0 comments on commit 5fd7cfb

Please sign in to comment.