Skip to content

Commit

Permalink
Added misc tests referenced in JuliaLang#19998
Browse files Browse the repository at this point in the history
  • Loading branch information
mauro3 committed Jan 17, 2017
1 parent 8313964 commit 2970623
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
8 changes: 3 additions & 5 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,13 @@ g11840{T<:Tuple}(sig::Type{T}) = 3

g11840b(::DataType) = 1
g11840b(::Type) = 2
# FIXME: how to compute that the guard entry is still required,
# even though Type{Vector} ∩ DataType = Bottom and this method would set cache_with_orig = true
#g11840b{T<:Tuple}(sig::Type{T}) = 3
g11840b{T<:Tuple}(sig::Type{T}) = 3
@test g11840b(Vector) == 2
@test g11840b(Vector.body) == 1
@test g11840b(Vector) == 2
@test g11840b(Vector.body) == 1
#@test g11840b(Tuple) == 3
#@test g11840b(TT11840) == 3
@test g11840b(Tuple) == 3
@test g11840b(TT11840) == 3

h11840(::DataType) = '1'
h11840(::Type) = '2'
Expand Down
27 changes: 26 additions & 1 deletion test/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -493,4 +493,29 @@ abstract AbstractMyType18457{T,F,G}
immutable MyType18457{T,F,G}<:AbstractMyType18457{T,F,G} end
tpara18457{I}(::Type{AbstractMyType18457{I}}) = I
tpara18457{A<:AbstractMyType18457}(::Type{A}) = tpara18457(supertype(A))
@test tpara18457(MyType18457{true}) === true
@test tpara18457(MyType18457{true}) == true

# Issue #12580
abstract AbstractMyType12580{T}
immutable MyType12580{T}<:AbstractMyType12580{T} end
tpara{A<:AbstractMyType12580}(::Type{A}) = tpara(supertype(A))
tpara{I}(::Type{AbstractMyType12580{I}}) = I
@test tpara(MyType12580{true})

# Issue #18348
f18348{T<:Any}(::Type{T}, x) = 1
f18348{T<:Any}(::Type{T}, x::T) = 2
@test length(methods(f18348, Tuple{Type{Any},Any})) == 1

# Issue #13165
@test Symmetric{Float64,Matrix{Float64}} <: LinAlg.RealHermSymComplexHerm
@test Hermitian{Float64,Matrix{Float64}} <: LinAlg.RealHermSymComplexHerm
@test Hermitian{Complex{Float64},Matrix{Complex{Float64}}} <: LinAlg.RealHermSymComplexHerm

# Issue #11803
@test TypeVar(:T, Int) <: Int
@test TypeVar(:T, Union{Int,Float64}) <: Union{Int,Float64}

# Issue #12721
f12721{T<:Type{Int}}(::T) = true;
@test_throws MethodError f12721(Float64)

0 comments on commit 2970623

Please sign in to comment.