Skip to content

Commit

Permalink
fix #7074
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Jun 3, 2014
1 parent 0462f5c commit c49b61f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/jltypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ static jl_value_t *intersect_typevar(jl_tvar_t *a, jl_value_t *b,
if (jl_subtype(b, (jl_value_t*)a, 0)) {
if (!a->bound) return b;
}
else if (var==invariant && !jl_has_typevars_(b,1)) {
else if (var==invariant && !jl_has_typevars_(b,0)) {
// for typevar a and non-typevar type b, b must be within a's bounds
// in invariant contexts.
return (jl_value_t*)jl_bottom_type;
Expand Down
12 changes: 9 additions & 3 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1221,8 +1221,8 @@ end # module
abstract IT4805{N, T}

let
T = TypeVar(:T,Int)
N = TypeVar(:N)
T = TypeVar(:T,Int,true)
N = TypeVar(:N,true)
@test typeintersect(Type{IT4805{1,T}}, Type{TypeVar(:_,IT4805{N,Int})}) != None
end

Expand Down Expand Up @@ -1616,7 +1616,7 @@ end
end

let
z = A5876.@x()
local z = A5876.@x()
@test z == 42
@test f5876(Int) === Int
end
Expand Down Expand Up @@ -1704,3 +1704,9 @@ function ttt7049(;init::Maybe7049{Union(String,(Int,Char))} = nothing)
string("init=", init)
end
@test ttt7049(init="a") == "init=a"

# issue #7074
let z{T<:Union(Float64,Complex{Float64},Float32,Complex{Float32})}(A::StridedMatrix{T}) = T,
S = zeros(Complex,2,2)
@test_throws MethodError z(S)
end

0 comments on commit c49b61f

Please sign in to comment.