Skip to content

Commit aae487a

Browse files
committed
fixing bug in initial rewrite guard
1 parent df50bd1 commit aae487a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/kirin/dialects/ilist/rewrite/flatten_add.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ class FlattenAdd(RewriteRule):
99
def rewrite_Statement(self, node: ir.Statement) -> RewriteResult:
1010
if not (
1111
isinstance(node, py.binop.Add)
12-
and node.lhs.type.is_subseteq(ilist.IListType)
13-
and node.rhs.type.is_subseteq(ilist.IListType)
12+
and (lhs_type := node.lhs.type).is_subseteq(ilist.IListType)
13+
and (rhs_type := node.rhs.type).is_subseteq(ilist.IListType)
14+
and not lhs_type.is_structurally_equal(types.Bottom)
15+
and not rhs_type.is_structurally_equal(types.Bottom)
1416
):
1517
return RewriteResult()
1618

0 commit comments

Comments
 (0)