Skip to content

Commit 38a995f

Browse files
committed
Assert rtype
1 parent 6f16840 commit 38a995f

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

mypyc/codegen/emitfunc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
from mypyc.ir.rtypes import (
7474
RArray,
7575
RStruct,
76+
RInstance,
7677
RTuple,
7778
RType,
7879
is_int32_rprimitive,
@@ -537,6 +538,7 @@ def visit_method_call(self, op: MethodCall) -> None:
537538
def emit_method_call(self, dest: str, op_obj: Value, name: str, op_args: list[Value]) -> None:
538539
obj = self.reg(op_obj)
539540
rtype = op_obj.type
541+
assert isinstance(rtype, RInstance)
540542
class_ir = rtype.class_ir
541543
method = rtype.class_ir.get_method(name)
542544
assert method is not None

mypyc/ir/rtypes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class RType:
6464

6565
@abstractmethod
6666
def accept(self, visitor: RTypeVisitor[T]) -> T:
67-
raise NotImplementedError
67+
raise NotImplementedError()
6868

6969
def short_name(self) -> str:
7070
return short_name(self.name)

0 commit comments

Comments
 (0)