File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -606,7 +606,7 @@ function fast_substitute(expr, subs; operator = Nothing)
606606 args = let canfold = canfold
607607 map (args) do x
608608 x′ = fast_substitute (x, subs; operator)
609- canfold[] = canfold[] && ! (x′ isa Symbolic )
609+ canfold[] = canfold[] && ( symbolic_type (x′) == NotSymbolic () && ! is_array_of_symbolics (x′) )
610610 x′
611611 end
612612 end
@@ -633,7 +633,7 @@ function fast_substitute(expr, pair::Pair; operator = Nothing)
633633 args = let canfold = canfold
634634 map (args) do x
635635 x′ = fast_substitute (x, pair; operator)
636- canfold[] = canfold[] && ! (x′ isa Symbolic )
636+ canfold[] = canfold[] && ( symbolic_type (x′) == NotSymbolic () && ! is_array_of_symbolics (x′) )
637637 x′
638638 end
639639 end
@@ -645,6 +645,13 @@ function fast_substitute(expr, pair::Pair; operator = Nothing)
645645 metadata (expr))
646646end
647647
648+ function is_array_of_symbolics (x)
649+ symbolic_type (x) == ArraySymbolic () && return true
650+ symbolic_type (x) == ScalarSymbolic () && return false
651+ x isa AbstractArray &&
652+ any (y -> symbolic_type (y) != NotSymbolic () || is_array_of_symbolics (y), x)
653+ end
654+
648655function getparent (x, val= _fail)
649656 maybe_parent = getmetadata (x, Symbolics. GetindexParent, nothing )
650657 if maybe_parent != = nothing
You can’t perform that action at this time.
0 commit comments