From c49b61fba640f89889471f9cfbd9a896a260cee8 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Tue, 3 Jun 2014 14:38:54 -0400 Subject: [PATCH] fix #7074 --- src/jltypes.c | 2 +- test/core.jl | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/jltypes.c b/src/jltypes.c index 6d0c1636d1574..2dfae108a52c7 100644 --- a/src/jltypes.c +++ b/src/jltypes.c @@ -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; diff --git a/test/core.jl b/test/core.jl index 367015fcb3d82..f7076e8816ce3 100644 --- a/test/core.jl +++ b/test/core.jl @@ -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 @@ -1616,7 +1616,7 @@ end end let - z = A5876.@x() + local z = A5876.@x() @test z == 42 @test f5876(Int) === Int end @@ -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