Skip to content

Commit

Permalink
effects: add some more test cases for Base.@propagate_inbounds (#52236
Browse files Browse the repository at this point in the history
)
  • Loading branch information
aviatesk committed Nov 20, 2023
1 parent 72cd63c commit 7327a8f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/compiler/effects.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1280,3 +1280,13 @@ end |> !Core.Compiler.is_noub
@test Base.infer_effects((Vector{Any},Int)) do xs, i
@inbounds xs[i]
end |> !Core.Compiler.is_noub
Base.@propagate_inbounds getindex_propagate(xs, i) = xs[i]
getindex_dont_propagate(xs, i) = xs[i]
@test Core.Compiler.is_noub_if_noinbounds(Base.infer_effects(getindex_propagate, (Vector{Any},Int)))
@test Core.Compiler.is_noub(Base.infer_effects(getindex_dont_propagate, (Vector{Any},Int)))
@test Base.infer_effects((Vector{Any},Int)) do xs, i
@inbounds getindex_propagate(xs, i)
end |> !Core.Compiler.is_noub
@test Base.infer_effects((Vector{Any},Int)) do xs, i
@inbounds getindex_dont_propagate(xs, i)
end |> Core.Compiler.is_noub

0 comments on commit 7327a8f

Please sign in to comment.