Skip to content

Commit

Permalink
effects: mark svec as :consistent (JuliaLang#46120)
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk authored and Francesco Fucci committed Aug 11, 2022
1 parent 808bbef commit 32bc794
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion base/compiler/tfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,8 @@ const _EFFECT_FREE_BUILTINS = [
]

const _CONSISTENT_BUILTINS = Any[
tuple, # tuple is immutable, thus tuples of egal arguments are egal
tuple, # Tuple is immutable, thus tuples of egal arguments are egal
svec, # SimpleVector is immutable, thus svecs of egal arguments are egal
===,
typeof,
nfields,
Expand Down
6 changes: 6 additions & 0 deletions test/compiler/effects.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,9 @@ end
@test Base.infer_effects((Vector{Int},Int)) do a, i
a[i] = 0 # may throw
end |> !Core.Compiler.is_nothrow

# SimpleVector allocation can be consistent
@test Core.Compiler.is_consistent(Base.infer_effects(Core.svec))
@test Base.infer_effects() do
Core.svec(nothing, 1, "foo")
end |> Core.Compiler.is_consistent

0 comments on commit 32bc794

Please sign in to comment.