From e1cb0d53ce156e2afb512002724ca5e0f23feb4f Mon Sep 17 00:00:00 2001 From: Milan Bouchet-Valat Date: Tue, 19 Jun 2018 10:18:57 +0200 Subject: [PATCH] Test that getindex is inlined with Union{Int,Missing} array --- test/inline.jl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/inline.jl b/test/inline.jl index 0e6fe39b71e3e..0128e24def329 100644 --- a/test/inline.jl +++ b/test/inline.jl @@ -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 \ No newline at end of file