From 5579b438bf3ab10d0f0ef3510558046c12e742f0 Mon Sep 17 00:00:00 2001 From: schillic Date: Tue, 19 Nov 2024 23:17:08 +0100 Subject: [PATCH] fix HPolytope constructor with old Symbolics version --- src/Initialization/init_Symbolics.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Initialization/init_Symbolics.jl b/src/Initialization/init_Symbolics.jl index 9e3b27bc0e..74ae681ca8 100644 --- a/src/Initialization/init_Symbolics.jl +++ b/src/Initialization/init_Symbolics.jl @@ -7,7 +7,12 @@ _vec(vars::Vector{Symbolics.Arr{Num,1}}) = reduce(vcat, vars) _vec(vars::Vector{Vector{Num}}) = reduce(vcat, vars) _vec(vars::Vector{Real}) = reduce(vcat, vars) -_get_variables(expr::Num) = convert(Vector{Num}, Symbolics.get_variables(expr; sort=true)) +# `sort` argument was introduced in Symbolics v6.1 +@static if VERSION < v"1.10" + _get_variables(expr::Num) = convert(Vector{Num}, Symbolics.get_variables(expr)) +else + _get_variables(expr::Num) = convert(Vector{Num}, Symbolics.get_variables(expr; sort=true)) +end function _get_variables(expr::Vector{<:Num}) return unique(reduce(vcat, _get_variables(ex) for ex in expr)) end