Skip to content

Commit

Permalink
Test that getindex is inlined with Union{Int,Missing} array
Browse files Browse the repository at this point in the history
  • Loading branch information
nalimilan committed Jun 19, 2018
1 parent 54ecb9b commit e1cb0d5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/inline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,18 @@ end
@test f19122()
@test g19122()
end

@testset "issue #27403: getindex is inlined with Union{Int,Missing}" begin
function sum27403(X::AbstractArray)
s = zero(eltype(X)) + zero(eltype(X))
for x in X
if !ismissing(x)
s += x
end
end
s
end

(src, _) = code_typed(sum27403, Tuple{Vector{Int}})[1]
@test !any(x -> x isa Expr && x.head === :invoke, src.code)
end

0 comments on commit e1cb0d5

Please sign in to comment.