Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
felixrehren authored Feb 17, 2017
1 parent 95fc331 commit 60f2c9e
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/subtype.jl
Original file line number Diff line number Diff line change
Expand Up @@ -939,3 +939,36 @@ f11407{K,V}(::Dict{K,V},::Dict{Any,V}) = 1
f11407{K,V}(::Dict{K,V},::Dict{K,Any}) = 2
d11407 = Dict{Any,Any}()
@test_throws MethodError f11407(d11407,d11407)

# #12814
abstract type A12814{N, T} end
struct B12814{N, T} <: A12814{N, T}
x::NTuple{N, T}
end
Base.call{T <: A12814, X <: Array}(::Type{T}, x::X) = 1
@test_throws MethodError B12814{3, Float32}([1,2,3])

# #16922
U16922{T} = Union{AbstractVector{T}, AbstractVector{Nullable{T}}}
@test AbstractArray{Nullable{Int},1} <: U16922{Int}

# #17943
@test_throws TypeError Int{}

# #18892, dup #19159 #19413
f18892(x) = 1
f18892{T}(x::T) = 2
@test f18892(0) == 2

# #19041
mutable struct A19041{K} end
A19041(K::Type) = A19041{K}()
struct B19041{T} end
f19041{K}(x::A19041{K}) = deepcopy(x)
@test f19041(A19041(B19041)) == A19041{B19041}()

# #19985
f19985{T<:Union{Int32,Int64}}(x::T, y...) = (length(y), f(y[1], y[2:end]...)...)
f19985{T<:Union{Int32,Int64}}(x::T) = (100)
@test f(1,rand(1)...) == (1,100)

0 comments on commit 60f2c9e

Please sign in to comment.