From 26e4e5f72249a3bb43f2f28ab50bc5cb4af979b4 Mon Sep 17 00:00:00 2001 From: felix Date: Thu, 16 Feb 2017 13:51:46 +0000 Subject: [PATCH] add tests #2552, #8625, #8915, #11407 --- test/subtype.jl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/subtype.jl b/test/subtype.jl index 27b33350782a04..82c622513749ab 100644 --- a/test/subtype.jl +++ b/test/subtype.jl @@ -915,3 +915,27 @@ ftwoparams(::TwoParams{<:Real,<:Real}) = 3 # supertype operator @test !(Int >: Integer) @test Integer >: Int + +# #2552 +typealias DiagDict{T} Dict{T,T} +f2552(::Dict) = 1 +f2552(::DiagDict) = 2 +@test f2552(Dict(1 => "a")) == 1 +@test f2552(Dict(1 => 1)) == 2 + +# #8625 +typealias CV8625{T<:Real} Vector{Complex{T}} +@test isa([2.0+3.0im],CV8625) + +# #8915 +type D8915{T <: Union{Float32,Float64}} + D8915(a) = 1 + D8915(a::Int) = 2 +end +@test D8915{Float64}(1) = 2 + +# #11407 +f11407{K,V}(::Dict{K,V},::Dict{Any,V}) = 1 +f11407{K,V}(::Dict{K,V},::Dict{K,Any}) = 2 +d = Dict{Any,Any}() +@test_throws MethodError f11407(d,d)