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

(cherry picked from commit da6087e)

Conflicts:
	test/core.jl
  • Loading branch information
JeffBezanson authored and ivarne committed Nov 7, 2014
1 parent 478ac06 commit f9dcf0d
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 @@ -2579,6 +2579,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 @@ -1854,3 +1854,10 @@ let ex = Expr(:(=), :(f8338(x;y=4)), :(x*y))
eval(ex)
@test f8338(2) == 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 f9dcf0d

Please sign in to comment.