Skip to content

Commit e55d031

Browse files
authored
Merge pull request #20222 from JuliaLang/jb/test11015
add a test for #11015, diagonal dispatch inference error
2 parents 0c6ff7a + d9eef8e commit e55d031

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/inference.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,3 +509,14 @@ f_inferred_union_float(::Any) = "broken"
509509
f_inferred_union_int(::Int) = 3
510510
f_inferred_union_int(::Any) = "broken"
511511
@test @inferred(f_inferred_union()) in (1, 2, 3)
512+
513+
# issue #11015
514+
type AT11015
515+
f::Union{Bool,Function}
516+
end
517+
518+
g11015{S}(::Type{S}, ::S) = 1
519+
f11015(a::AT11015) = g11015(Base.fieldtype(typeof(a), :f), true)
520+
g11015(::Type{Bool}, ::Bool) = 2.0
521+
@test Int <: Base.return_types(f11015, (AT11015,))[1]
522+
@test f11015(AT11015(true)) === 1

0 commit comments

Comments
 (0)