Skip to content

Commit 96c5500

Browse files
committed
movign assert and giving more clear message
1 parent aae487a commit 96c5500

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ def rewrite_Statement(self, node: ir.Statement) -> RewriteResult:
1616
):
1717
return RewriteResult()
1818

19+
assert isinstance(rhs_type, types.Generic), "Expecting generic type for IList"
20+
assert isinstance(lhs_type, types.Generic), "Expecting generic type for IList"
21+
1922
# check if we are adding two ilist.New objects
2023
new_data = ()
2124

@@ -48,9 +51,6 @@ def rewrite_Statement(self, node: ir.Statement) -> RewriteResult:
4851
):
4952
return RewriteResult()
5053

51-
assert isinstance(rhs_type := rhs.type, types.Generic), "Impossible"
52-
assert isinstance(lhs_type := lhs.type, types.Generic), "Impossible"
53-
5454
lhs_elem_type = lhs_type.vars[0]
5555
rhs_elem_type = rhs_type.vars[0]
5656

0 commit comments

Comments
 (0)