diff --git a/test/ambiguous.jl b/test/ambiguous.jl index bad5f19f389c9..8d0c2092f21c2 100644 --- a/test/ambiguous.jl +++ b/test/ambiguous.jl @@ -369,4 +369,21 @@ let ambig = Int32[0] @test ambig[1] == 1 end +# issue #11407 +f11407(::Dict{K,V}, ::Dict{Any,V}) where {K,V} = 1 +f11407(::Dict{K,V}, ::Dict{K,Any}) where {K,V} = 2 +@test_throws MethodError f11407(Dict{Any,Any}(), Dict{Any,Any}()) # ambiguous +@test f11407(Dict{Any,Int}(), Dict{Any,Int}()) == 1 +f11407(::Dict{Any,Any}, ::Dict{Any,Any}) where {K,V} = 3 +@test f11407(Dict{Any,Any}(), Dict{Any,Any}()) == 3 + +# issue #12814 +abstract type A12814{N, T} end +struct B12814{N, T} <: A12814{N, T} + x::NTuple{N, T} +end +(::Type{T})(x::X) where {T <: A12814, X <: Array} = 1 +@test_throws MethodError B12814{3, Float64}([1, 2, 3]) # ambiguous +@test B12814{3,Float64}((1, 2, 3)).x === (1.0, 2.0, 3.0) + nothing diff --git a/test/subtype.jl b/test/subtype.jl index 6956c212301ea..244ce3c4b7900 100644 --- a/test/subtype.jl +++ b/test/subtype.jl @@ -1901,3 +1901,16 @@ let A = Tuple{Array{Pair{T, JT} where JT<:Ref{T}, 1} where T, Vector}, @test_broken I <: A @test_broken !Base.has_free_typevars(I) end + +# issue #8915 +struct D8915{T<:Union{Float32,Float64}} + D8915{T}(a) where {T} = 1 + D8915{T}(a::Int) where {T} = 2 +end +@test D8915{Float64}(1) == 2 +@test D8915{Float64}(1.0) == 1 + +# issue #18985 +f18985(x::T, y...) where {T<:Union{Int32,Int64}} = (length(y), f18985(y[1], y[2:end]...)...) +f18985(x::T) where {T<:Union{Int32,Int64}} = 100 +@test f18985(1, 2, 3) == (2, 1, 100)