Skip to content

Commit

Permalink
fix #8851, type intersection bug in Grid.jl tests exposed by call o…
Browse files Browse the repository at this point in the history
…verloading
  • Loading branch information
JeffBezanson committed Oct 30, 2014
1 parent 9ed8279 commit da6087e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/jltypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -2610,6 +2610,11 @@ static jl_value_t *type_match_(jl_value_t *child, jl_value_t *parent,
if (jl_is_typector(parent))
parent = (jl_value_t*)((jl_typector_t*)parent)->body;
size_t i, j;
if (match_intersection_mode && jl_is_typevar(child) && !jl_is_typevar(parent)) {
tmp = child;
child = parent;
parent = tmp;
}
if (jl_is_typevar(parent)) {
// make sure type is within this typevar's bounds
if (morespecific) {
Expand Down
7 changes: 7 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1921,3 +1921,10 @@ let
sizeof_lookup() = sizeof(npy_typestrs["i8"])
@test sizeof_lookup() == 8
end

# issue #8851
abstract AbstractThing{T,N}
type ConcreteThing{T<:FloatingPoint,N} <: AbstractThing{T,N}
end

@test typeintersect(AbstractThing{TypeVar(:T,true),2}, ConcreteThing) == ConcreteThing{TypeVar(:T,FloatingPoint),2}

0 comments on commit da6087e

Please sign in to comment.