Skip to content

Commit 4c65dce

Browse files
authored
rename Base.@assume_effects :total_may_throw setting to :foldable (#45534)
1 parent 32106ab commit 4c65dce

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

base/expr.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ julia> code_typed() do
402402
1 ─ return 479001600
403403
) => Int64
404404
405-
julia> Base.@assume_effects :total_may_throw @ccall jl_type_intersection(Vector{Int}::Any, Vector{<:Integer}::Any)::Any
405+
julia> Base.@assume_effects :foldable @ccall jl_type_intersection(Vector{Int}::Any, Vector{<:Integer}::Any)::Any
406406
Vector{Int64} (alias for Array{Int64, 1})
407407
```
408408
@@ -541,7 +541,7 @@ This `setting` combines the following other assertions:
541541
and is a convenient shortcut.
542542
543543
---
544-
# `:total_may_throw`
544+
# `:foldable`
545545
546546
This `setting` combines the following other assertions:
547547
- `:consistent`
@@ -554,10 +554,10 @@ and is a convenient shortcut.
554554
the applied method when all the call arguments are fully known to be constant, no matter
555555
if the call results in an error or not.
556556
557-
`@assume_effects :total_may_throw` is similar to [`@pure`](@ref) with the primary
557+
`@assume_effects :foldable` is similar to [`@pure`](@ref) with the primary
558558
distinction that the `:consistent`-cy requirement applies world-age wise rather
559559
than globally as described above. However, in particular, a method annotated
560-
`@pure` should always be `:total` or `:total_may_throw`.
560+
`@pure` should always be `:total` or `:foldable`.
561561
Another advantage is that effects introduced by `@assume_effects` are propagated to
562562
callers interprocedurally while a purity defined by `@pure` is not.
563563
"""
@@ -580,7 +580,7 @@ macro assume_effects(args...)
580580
terminates_locally = true
581581
elseif setting === :total
582582
consistent = effect_free = nothrow = terminates_globally = true
583-
elseif setting === :total_may_throw
583+
elseif setting === :foldable
584584
consistent = effect_free = terminates_globally = true
585585
else
586586
throw(ArgumentError("@assume_effects $setting not supported"))

test/compiler/inference.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -4079,7 +4079,7 @@ const CONST_DICT = let d = Dict()
40794079
end
40804080
d
40814081
end
4082-
Base.@assume_effects :total_may_throw getcharid(c) = CONST_DICT[c]
4082+
Base.@assume_effects :foldable getcharid(c) = CONST_DICT[c]
40834083
@noinline callf(f, args...) = f(args...)
40844084
function entry_to_be_invalidated(c)
40854085
return callf(getcharid, c)

test/compiler/inline.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ recur_termination22(x) = x * recur_termination21(x-1)
10891089
end
10901090

10911091
const ___CONST_DICT___ = Dict{Any,Any}(Symbol(c) => i for (i, c) in enumerate('a':'z'))
1092-
Base.@assume_effects :total_may_throw concrete_eval(
1092+
Base.@assume_effects :foldable concrete_eval(
10931093
f, args...; kwargs...) = f(args...; kwargs...)
10941094
@test fully_eliminated() do
10951095
concrete_eval(getindex, ___CONST_DICT___, :a)

0 commit comments

Comments
 (0)