diff --git a/src/systems/abstractsystem.jl b/src/systems/abstractsystem.jl index a7ff3954eb..7266b63b8d 100644 --- a/src/systems/abstractsystem.jl +++ b/src/systems/abstractsystem.jl @@ -627,7 +627,7 @@ function namespace_expr(O, sys, n = nameof(sys); ivs = independent_variables(sys O end end - +_nonum(@nospecialize x) = x isa Num ? x.val : x function states(sys::AbstractSystem) sts = get_states(sys) systems = get_systems(sys) @@ -637,9 +637,13 @@ function states(sys::AbstractSystem) system_states = reduce(vcat, namespace_variables.(systems)) isempty(sts) ? system_states : [sts; system_states] end + isempty(nonunique_states) && return nonunique_states # `Vector{Any}` is incompatible with the `SymbolicIndexingInterface`, which uses # `elsymtype = symbolic_type(eltype(_arg))` # which inappropriately returns `NotSymbolic()` + if nonunique_states isa Vector{Any} + nonunique_states = _nonum.(nonunique_states) + end @assert typeof(nonunique_states) !== Vector{Any} unique(nonunique_states) end diff --git a/src/systems/connectors.jl b/src/systems/connectors.jl index b85f0f1abc..3882ec9f8a 100644 --- a/src/systems/connectors.jl +++ b/src/systems/connectors.jl @@ -150,7 +150,7 @@ struct ConnectionElement h::UInt end function _hash_impl(sys, v, isouter) - hashcore = hash(nameof(sys)) ⊻ hash(v) + hashcore = hash(nameof(sys)) ⊻ hash(getname(v)) hashouter = isouter ? hash(true) : hash(false) hashcore ⊻ hashouter end