Skip to content

Commit 3e1c22d

Browse files
authored
assert dialect in lowering.Frame (#172)
1 parent f524713 commit 3e1c22d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/kirin/lowering/frame.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from dataclasses import field, dataclass
44

55
from kirin.ir import Block, Region, SSAValue, Statement
6+
from kirin.exceptions import DialectLoweringError
67
from kirin.lowering.stream import StmtStream
78

89
if TYPE_CHECKING:
@@ -124,6 +125,8 @@ def get_local(self, name: str) -> SSAValue | None:
124125
StmtType = TypeVar("StmtType", bound=Statement)
125126

126127
def append_stmt(self, stmt: StmtType) -> StmtType:
128+
if not stmt.dialect or stmt.dialect not in self.state.dialects:
129+
raise DialectLoweringError(f"Unsupported dialect {stmt.dialect}")
127130
self.current_block.stmts.append(stmt)
128131
stmt.source = self.state.source
129132
return stmt

0 commit comments

Comments
 (0)