Skip to content

Commit 3679d50

Browse files
committed
fix: ensure @generated functions pure
1 parent 67bfab0 commit 3679d50

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/Evaluate.jl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,7 @@ struct EvalOptions{T,B,E}
5252
early_exit::Val{E}
5353
end
5454

55-
@stable(
56-
default_mode = "disable",
57-
default_union_limit = 2,
58-
@inline _to_bool_val(x::Bool) = x ? Val(true) : Val(false)
59-
)
55+
@unstable @inline _to_bool_val(x::Bool) = x ? Val(true) : Val(false)
6056
@inline _to_bool_val(x::Val{T}) where {T} = Val(T::Bool)
6157

6258
@unstable function EvalOptions(;
@@ -183,8 +179,10 @@ function eval_tree_array(
183179
return eval_tree_array(tree, cX, operators; kws...)
184180
end
185181

186-
get_nuna(::Type{<:OperatorEnum{B,U}}) where {B,U} = counttuple(U)
187-
get_nbin(::Type{<:OperatorEnum{B}}) where {B} = counttuple(B)
182+
# These are marked unstable due to issues discussed on
183+
# https://github.com/JuliaLang/julia/issues/55147
184+
@unstable get_nuna(::Type{<:OperatorEnum{B,U}}) where {B,U} = counttuple(U)
185+
@unstable get_nbin(::Type{<:OperatorEnum{B}}) where {B} = counttuple(B)
188186

189187
function _eval_tree_array(
190188
tree::AbstractExpressionNode{T},

src/Utils.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
module UtilsModule
33

44
using MacroTools: postwalk, @capture, splitdef, combinedef
5+
using DispatchDoctor: @unstable
56

67
# Returns two arrays
78
macro return_on_false2(flag, retval, retval2)
@@ -124,7 +125,7 @@ function deprecate_varmap(variable_names, varMap, func_name)
124125
return variable_names
125126
end
126127

127-
counttuple(::Type{<:NTuple{N,Any}}) where {N} = N
128+
@unstable counttuple(::Type{<:NTuple{N,Any}}) where {N} = N
128129

129130
"""
130131
Undefined

0 commit comments

Comments
 (0)