Skip to content

Commit e2f4f5f

Browse files
committed
Bound Julia version due to RuntimeGeneratedFunction problem on 1.6
```julia using RuntimeGeneratedFunctions RuntimeGeneratedFunctions.init(@__MODULE__) ex = :(function foo(a, b) goo = function (c, d) end end) fun = @RuntimeGeneratedFunction(ex) fun(1, 2) ``` gives ```julia julia> fun(1, 2) ERROR: The function body AST defined by this @generated function is not pure. This likely means it contains a closure or comprehension. Stacktrace: [1] (::RuntimeGeneratedFunction{(:a, :b), var"#_RGF_ModTag", var"#_RGF_ModTag", (0x1c41534f, 0x444455e2, 0x6114b514, 0xa7b18630, 0x10e959a2)})(::Int64, ::Int64) @ RuntimeGeneratedFunctions ~/.julia/packages/RuntimeGeneratedFunctions/6v5Gn/src/RuntimeGeneratedFunctions.jl:124 [2] top-level scope @ REPL[47]:1 ```
1 parent 137bb8f commit e2f4f5f

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/systems/clock_inference.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ end
163163
function generate_discrete_affect(syss, inputs, continuous_id, id_to_clock;
164164
checkbounds = true,
165165
eval_module = @__MODULE__, eval_expression = true)
166+
@static if VERSION < v"1.7"
167+
error("The `generate_discrete_affect` function requires at least Julia 1.7")
168+
end
166169
out = Sym{Any}(:out)
167170
appended_parameters = parameters(syss[continuous_id])
168171
param_to_idx = Dict{Any, Int}(reverse(en) for en in enumerate(appended_parameters))

test/clock.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,12 @@ eqs = [yd ~ Sample(t, dt)(y)
112112
=#
113113
]
114114
@named sys = ODESystem(eqs)
115-
ss = structural_simplify(sys)
116-
prob = ODEProblem(ss, [x => 0.0, y => 0.0], (0.0, 1.0),
117-
[kp => 1.0; z => 0.0; z(k + 1) => 0.0])
118-
sol = solve(prob, Tsit5(), kwargshandle = KeywordArgSilent)
115+
ss = structural_simplify(sys);
116+
if VERSION >= v"1.7"
117+
prob = ODEProblem(ss, [x => 0.0, y => 0.0], (0.0, 1.0),
118+
[kp => 1.0; z => 0.0; z(k + 1) => 0.0])
119+
sol = solve(prob, Tsit5(), kwargshandle = KeywordArgSilent)
120+
end
119121
# For all inputs in parameters, just initialize them to 0.0, and then set them
120122
# in the callback.
121123

0 commit comments

Comments
 (0)