Skip to content

Commit 7327a8f

Browse files
authored
effects: add some more test cases for Base.@propagate_inbounds (#52236)
1 parent 72cd63c commit 7327a8f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/compiler/effects.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,3 +1280,13 @@ end |> !Core.Compiler.is_noub
12801280
@test Base.infer_effects((Vector{Any},Int)) do xs, i
12811281
@inbounds xs[i]
12821282
end |> !Core.Compiler.is_noub
1283+
Base.@propagate_inbounds getindex_propagate(xs, i) = xs[i]
1284+
getindex_dont_propagate(xs, i) = xs[i]
1285+
@test Core.Compiler.is_noub_if_noinbounds(Base.infer_effects(getindex_propagate, (Vector{Any},Int)))
1286+
@test Core.Compiler.is_noub(Base.infer_effects(getindex_dont_propagate, (Vector{Any},Int)))
1287+
@test Base.infer_effects((Vector{Any},Int)) do xs, i
1288+
@inbounds getindex_propagate(xs, i)
1289+
end |> !Core.Compiler.is_noub
1290+
@test Base.infer_effects((Vector{Any},Int)) do xs, i
1291+
@inbounds getindex_dont_propagate(xs, i)
1292+
end |> Core.Compiler.is_noub

0 commit comments

Comments
 (0)