Skip to content

Commit 9262249

Browse files
committed
hopefully num->BasicSymbolic for states
1 parent 4647656 commit 9262249

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/systems/abstractsystem.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ function namespace_expr(O, sys, n = nameof(sys); ivs = independent_variables(sys
627627
O
628628
end
629629
end
630-
630+
_nonum(@nospecialize x) = x isa Num ? x.val : x
631631
function states(sys::AbstractSystem)
632632
sts = get_states(sys)
633633
systems = get_systems(sys)
@@ -637,9 +637,13 @@ function states(sys::AbstractSystem)
637637
system_states = reduce(vcat, namespace_variables.(systems))
638638
isempty(sts) ? system_states : [sts; system_states]
639639
end
640+
isempty(nonunique_states) && return nonunique_states
640641
# `Vector{Any}` is incompatible with the `SymbolicIndexingInterface`, which uses
641642
# `elsymtype = symbolic_type(eltype(_arg))`
642643
# which inappropriately returns `NotSymbolic()`
644+
if nonunique_states isa Vector{Any}
645+
nonunique_states = _nonum.(nonunique_states)
646+
end
643647
@assert typeof(nonunique_states) !== Vector{Any}
644648
unique(nonunique_states)
645649
end

src/systems/connectors.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ struct ConnectionElement
150150
h::UInt
151151
end
152152
function _hash_impl(sys, v, isouter)
153-
hashcore = hash(nameof(sys)) hash(v)
153+
hashcore = hash(nameof(sys)) hash(getname(v))
154154
hashouter = isouter ? hash(true) : hash(false)
155155
hashcore hashouter
156156
end

0 commit comments

Comments
 (0)