From 143a180bae1a51ab7e1eaa288ac1d72f310b1f74 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Mon, 20 Nov 2023 18:01:12 +0530 Subject: [PATCH] refactor: handle istree case in is_parameter --- src/systems/abstractsystem.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/systems/abstractsystem.jl b/src/systems/abstractsystem.jl index 6f0438ed88..51fa91e0aa 100644 --- a/src/systems/abstractsystem.jl +++ b/src/systems/abstractsystem.jl @@ -224,8 +224,12 @@ function SymbolicIndexingInterface.variable_symbols(sys::AbstractSystem) end function SymbolicIndexingInterface.is_parameter(sys::AbstractSystem, sym) + usym = unwrap(sym) if unwrap(sym) isa Int - return unwrap(sym) in 1:length(parameters(sys)) + return usym in 1:length(parameters(sys)) + end + if istree(usym) && operation(usym) != getindex + return false end return any(isequal(sym), parameters(sys)) || is_parameter(sys, getname(sym))