Skip to content

Commit 3d7b529

Browse files
committed
fix: note instability in kw deprecation
1 parent 586baf8 commit 3d7b529

File tree

1 file changed

+29
-39
lines changed

1 file changed

+29
-39
lines changed

src/Evaluate.jl

Lines changed: 29 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -56,48 +56,38 @@ end
5656
default_union_limit = 2,
5757
@inline _to_bool_val(x::Bool) = x ? Val(true) : Val(false)
5858
)
59-
@stable(default_mode = "disable", @inline _to_bool_val(x::Val{T}) where {T} = Val(T::Bool))
59+
@inline _to_bool_val(x::Val{T}) where {T} = Val(T::Bool)
6060

61-
@stable(
62-
default_mode = "disable",
63-
default_union_limit = 4,
64-
begin
65-
function EvalOptions(;
66-
turbo::Union{Bool,Val}=Val(false),
67-
bumper::Union{Bool,Val}=Val(false),
68-
early_exit::Union{Bool,Val}=Val(true),
69-
)
70-
return EvalOptions(
71-
_to_bool_val(turbo), _to_bool_val(bumper), _to_bool_val(early_exit)
72-
)
73-
end
61+
@unstable function EvalOptions(;
62+
turbo::Union{Bool,Val}=Val(false),
63+
bumper::Union{Bool,Val}=Val(false),
64+
early_exit::Union{Bool,Val}=Val(true),
65+
)
66+
return EvalOptions(_to_bool_val(turbo), _to_bool_val(bumper), _to_bool_val(early_exit))
67+
end
7468

75-
function _process_deprecated_kws(eval_options, deprecated_kws)
76-
turbo = get(deprecated_kws, :turbo, nothing)
77-
bumper = get(deprecated_kws, :bumper, nothing)
78-
if any(Base.Fix2(, (:turbo, :bumper)), keys(deprecated_kws))
79-
throw(
80-
ArgumentError("Invalid keyword argument(s): $(keys(deprecated_kws))")
81-
)
82-
end
83-
if !isempty(deprecated_kws)
84-
@assert eval_options === nothing "Cannot use both `eval_options` and deprecated flags `turbo` and `bumper`."
85-
Base.depwarn(
86-
"The `turbo` and `bumper` keyword arguments are deprecated. Please use `eval_options` instead.",
87-
:eval_tree_array,
88-
)
89-
end
90-
if eval_options !== nothing
91-
return eval_options
92-
else
93-
return EvalOptions(;
94-
turbo=turbo === nothing ? Val(false) : turbo,
95-
bumper=bumper === nothing ? Val(false) : bumper,
96-
)
97-
end
98-
end
69+
@unstable function _process_deprecated_kws(eval_options, deprecated_kws)
70+
turbo = get(deprecated_kws, :turbo, nothing)
71+
bumper = get(deprecated_kws, :bumper, nothing)
72+
if any(Base.Fix2(, (:turbo, :bumper)), keys(deprecated_kws))
73+
throw(ArgumentError("Invalid keyword argument(s): $(keys(deprecated_kws))"))
9974
end
100-
)
75+
if !isempty(deprecated_kws)
76+
@assert eval_options === nothing "Cannot use both `eval_options` and deprecated flags `turbo` and `bumper`."
77+
Base.depwarn(
78+
"The `turbo` and `bumper` keyword arguments are deprecated. Please use `eval_options` instead.",
79+
:eval_tree_array,
80+
)
81+
end
82+
if eval_options !== nothing
83+
return eval_options
84+
else
85+
return EvalOptions(;
86+
turbo=turbo === nothing ? Val(false) : turbo,
87+
bumper=bumper === nothing ? Val(false) : bumper,
88+
)
89+
end
90+
end
10191

10292
"""
10393
eval_tree_array(

0 commit comments

Comments
 (0)