Skip to content

Commit

Permalink
juliatypes.jl: fix a bug in accumulating type var lower bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Dec 25, 2014
1 parent 4814557 commit b67b4b6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions examples/juliatypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ function issub(a::Ty, b::Var, env)
!issub(a, bb.ub, env) && return false
if issub(bb.lb, a, env)
bb.lb = a
elseif !issub(a, bb.lb, env)
bb.lb = UnionT(bb.lb, a)
end
end
return true
Expand Down Expand Up @@ -642,6 +644,12 @@ function test_3()
@test !issub(tupletype(inst(ArrayT,Ty(Integer),1), Ty(Real)),
(@UnionAll T<:Ty(Integer) tupletype(inst(ArrayT,T,1),T)))

@test !issub(Ty((Int,String,Vector{Integer})),
@UnionAll T tupletype(T, T, inst(ArrayT,T,1)))

@test issub(Ty((Int,String,Vector{Any})),
@UnionAll T tupletype(T, T, inst(ArrayT,T,1)))

@test isequal_type(Ty(Array{Int,1}), inst(ArrayT, (@UnionAll T<:Ty(Int) T), 1))
@test isequal_type(Ty(Array{(Any,),1}), inst(ArrayT, (@UnionAll T tupletype(T)), 1))

Expand Down

0 comments on commit b67b4b6

Please sign in to comment.