new_merged of AssignmentCollections is broken
When merging two AssignmentCollections, both containing an alias subexpression with the same alias that themselves depend on another Assignment, the resulting merged dict is broken. ```python import pystencils as ps import sympy as sp a, b, res1, res2 = sp.symbols("a b res1 res2") ac = ps.AssignmentCollection([ps.Assignment(res1, b)], [ps.Assignment(a, 20), ps.Assignment(b, a)]) ac2 = ps.AssignmentCollection([ps.Assignment(res2, b)], [ps.Assignment(a, 10), ps.Assignment(b, a)]) merged_ac = ac.new_merged(ac2).new_without_subexpressions() print(f"ac:\n {ac}") print(f"ac2:\n {ac2}") print(f"merged:\n {merged_ac}") assert ps.Assignment(res1, 20) in new_merged.main_assignments assert ps.Assignment(res2, 10) in new_merged.main_assignments ``` Executing this code results in: ``` ac: Subexpressions: a ← 20 b ← a Main Assignments: res1 ← b ac2: Subexpressions: a ← 10 b ← a Main Assignments: res2 ← b merged: Subexpressions: Main Assignments: res1 ← 20 res2 ← 20 ### 10 should be here ``` In the merging-process the replacement of the rhs happens too late, so the expressions are treated as equal, although their rhs should already have been replaced.
issue