Skip to content

Commit

Permalink
Also check eqc in intersect_typevar (fixes JuliaLang#11367)
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy authored and mbauman committed Jun 5, 2015
1 parent 4238c02 commit 9794e92
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/jltypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,16 @@ static jl_value_t *intersect_typevar(jl_tvar_t *a, jl_value_t *b,
break;
}
}
for(i=0; i < eqc->n; i+=2) {
if (eqc->data[i] == b && !jl_is_typevar(eqc->data[i+1])) {
jl_value_t *ti = jl_type_intersection((jl_value_t*)a, eqc->data[i+1]);
if (ti == (jl_value_t*)jl_bottom_type) {
JL_GC_POP();
return ti;
}
break;
}
}
}
extend((jl_value_t*)a, b, penv);
if (jl_is_typevar(b)) {
Expand Down
6 changes: 6 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2877,3 +2877,9 @@ type B11136 end
let T = TypeVar(:T, true), TB = TypeVar(:T, B11136, true)
testintersect(Tuple{T, T}, Tuple{A11136, TB}, Bottom)
end

# issue #11367
abstract Foo11367
let T1 = TypeVar(:T1, true), T2 = TypeVar(:T2, Foo11367, true)
testintersect(Tuple{T1, T1}, Tuple{Type{BigInt}, T2}, Bottom)
end

0 comments on commit 9794e92

Please sign in to comment.