JuliaSymbolics/SymbolicUtils.jl

Metadata is lost on construction of Mul

shashi opened this issue · 1 comments

(and potentially other constructions)

julia> SymbolicUtils.inspect(y)
1 POW metadata=(Sign => Positive,)
2 ├─ SYM(x) metadata=(Sign => AnySign,)
3 └─ 2

julia> SymbolicUtils.inspect(2y)
1 MUL(scalar = 2, powers = (x => 2,))
2 ├─ 2
3 └─ POW
4    ├─ SYM(x) metadata=(Sign => AnySign,)
5    └─ 2

when x is LiteralReal, thanks to #429

julia> SymbolicUtils.inspect(2y)
1 TERM{*}
2 ├─ 2
3 └─ TERM{^} metadata=(Sign => Positive,)
4    ├─ SYM(x) metadata=(Sign => AnySign,)
5    └─ 2

The correct solution is to not canonicalize arguments with metadata.

fixed by #547