-
Notifications
You must be signed in to change notification settings - Fork 174
Closed
Description
It looks like there are some cases in which get_variables drops variable metadata, leading to the variables that are return to not be isequal to the original ones. This seems to be the case for callables, which are currently generated by the @mtkmodel macro as pointed out in #1364 (comment).
MWE
using Symbolics
@variables t x(..)
x = x(t)
Symbolics.get_variables(x + 1)
# 2-element Vector{SymbolicUtils.BasicSymbolic}:
# x
# t
isequal(Symbolics.get_variables(x + 1)[1], Symbolics.value(x)) # false
Symbolics.metadata(Symbolics.value(x))
# Base.ImmutableDict{DataType, Any} with 2 entries:
# CallWithParent => x⋆
# VariableSource => (:variables, :x)
Symbolics.metadata(Symbolics.get_variables(x + 1)[1]) # nothingWhile SciML/ModelingToolkit.jl#3217 could help avoid the issue for @mtkmodel based systems, I would expect the metadata to still be there.
Metadata
Metadata
Assignees
Labels
No labels