From cdebc657aa0dafa290f17f90de5e0009e024a534 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Tue, 24 Jan 2017 16:19:12 -0500 Subject: [PATCH] add a test for #11015, diagonal dispatch inference error fixed by jb/subtype fixes #11015 --- test/inference.jl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/inference.jl b/test/inference.jl index d2411f5f6e5aa0..a52a27445fc427 100644 --- a/test/inference.jl +++ b/test/inference.jl @@ -491,3 +491,13 @@ tpara18457{I}(::Type{AbstractMyType18457{I}}) = I tpara18457{A<:AbstractMyType18457}(::Type{A}) = tpara18457(supertype(A)) @test tpara18457(MyType18457{true}) === true +# issue #11015 +type AT11015 + f::Union{Bool,Function} +end + +g11015{S}(::Type{S}, ::S) = Int64(1) +f11015(a::AT11015) = g11015(Base.fieldtype(typeof(a), :f), true) +g11015(::Type{Bool}, ::Bool) = 2.0 +@test Int <: Base.return_types(f11015, (AT11015,))[1] +@test f11015(AT11015(true)) === Int64(1)