Skip to content

Commit

Permalink
Fix refcounted definition
Browse files Browse the repository at this point in the history
  • Loading branch information
jairov4 committed Nov 23, 2024
1 parent 587cfa7 commit 317228f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mypyc/ir/rtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ class RTuple(RType):
def __init__(self, types: list[RType]) -> None:
self.name = "tuple"
self.types = tuple(types)
self.is_refcounted = any(t.is_refcounted for t in self.types)
self._is_refcounted = any(t.is_refcounted for t in self.types)
# Generate a unique id which is used in naming corresponding C identifiers.
# This is necessary since C does not have anonymous structural type equivalence
# in the same way python can just assign a Tuple[int, bool] to a Tuple[int, bool].
Expand All @@ -656,6 +656,10 @@ def __init__(self, types: list[RType]) -> None:
self._ctype = f"{self.struct_name}"
self.error_overlap = all(t.error_overlap for t in self.types) and bool(self.types)

@property
def is_refcounted(self) -> bool:
return self._is_refcounted

def accept(self, visitor: RTypeVisitor[T]) -> T:
return visitor.visit_rtuple(self)

Expand Down

0 comments on commit 317228f

Please sign in to comment.