@@ -171,7 +171,7 @@ def kill(self) -> None:
171171 self .in_local = False
172172 self .memory_offset = None
173173
174- def in_memory (self ):
174+ def in_memory (self ) -> bool :
175175 return self .memory_offset is not None or self .is_array ()
176176
177177 def is_dead (self ) -> bool :
@@ -220,7 +220,7 @@ def __init__(self, extract_bits: bool=True, cast_type: str = "uintptr_t") -> Non
220220 self .extract_bits = extract_bits
221221 self .cast_type = cast_type
222222
223- def drop (self , var : StackItem , check_liveness : bool ):
223+ def drop (self , var : StackItem , check_liveness : bool ) -> None :
224224 self .top_offset .pop (var )
225225 if self .variables :
226226 popped = self .variables .pop ()
@@ -376,7 +376,7 @@ def merge(self, other: "Stack", out: CWriter) -> None:
376376 for self_var , other_var in zip (self .variables , other .variables ):
377377 if self_var .memory_offset is not None :
378378 if self_var .memory_offset != other_var .memory_offset :
379- raise StackError (f"Mismatched stack depths for { self_var .name } : { self_var .memory_offset . to_c () } and { other_var .memory_offset . to_c () } " )
379+ raise StackError (f"Mismatched stack depths for { self_var .name } : { self_var .memory_offset } and { other_var .memory_offset } " )
380380
381381
382382def stacks (inst : Instruction | PseudoInstruction ) -> Iterator [StackEffect ]:
@@ -518,7 +518,7 @@ def reload(self, out: CWriter) -> None:
518518 out .emit_reload ()
519519
520520 @staticmethod
521- def for_uop (stack : Stack , uop : Uop , check_liveness = True ) -> tuple [list [str ], "Storage" ]:
521+ def for_uop (stack : Stack , uop : Uop , check_liveness : bool = True ) -> tuple [list [str ], "Storage" ]:
522522 code_list : list [str ] = []
523523 inputs : list [Local ] = []
524524 peeks : list [Local ] = []
@@ -687,7 +687,7 @@ def close_variable(var: Local, overwrite: str) -> None:
687687 self .stack .drop (output .item , self .check_liveness )
688688 self .inputs = []
689689 return
690- if var_size (lowest ) != var_size (output ):
690+ if var_size (lowest . item ) != var_size (output . item ):
691691 raise StackError ("Cannot call DECREF_INPUTS with live output not matching first input size" )
692692 lowest .in_local = True
693693 close_variable (lowest , output .name )
@@ -702,7 +702,7 @@ def close_variable(var: Local, overwrite: str) -> None:
702702 self .stack .pop (self .inputs [0 ].item )
703703 output_in_place = self .outputs and output is self .outputs [0 ] and lowest .memory_offset is not None
704704 if output_in_place :
705- output .memory_offset = lowest .memory_offset .copy ()
705+ output .memory_offset = lowest .memory_offset .copy () # type: ignore[union-attr]
706706 else :
707707 self .stack .flush (out )
708708 if output is not None :
0 commit comments