@@ -171,7 +171,7 @@ def kill(self) -> None:
171
171
self .in_local = False
172
172
self .memory_offset = None
173
173
174
- def in_memory (self ):
174
+ def in_memory (self ) -> bool :
175
175
return self .memory_offset is not None or self .is_array ()
176
176
177
177
def is_dead (self ) -> bool :
@@ -220,7 +220,7 @@ def __init__(self, extract_bits: bool=True, cast_type: str = "uintptr_t") -> Non
220
220
self .extract_bits = extract_bits
221
221
self .cast_type = cast_type
222
222
223
- def drop (self , var : StackItem , check_liveness : bool ):
223
+ def drop (self , var : StackItem , check_liveness : bool ) -> None :
224
224
self .top_offset .pop (var )
225
225
if self .variables :
226
226
popped = self .variables .pop ()
@@ -376,7 +376,7 @@ def merge(self, other: "Stack", out: CWriter) -> None:
376
376
for self_var , other_var in zip (self .variables , other .variables ):
377
377
if self_var .memory_offset is not None :
378
378
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 } " )
380
380
381
381
382
382
def stacks (inst : Instruction | PseudoInstruction ) -> Iterator [StackEffect ]:
@@ -518,7 +518,7 @@ def reload(self, out: CWriter) -> None:
518
518
out .emit_reload ()
519
519
520
520
@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" ]:
522
522
code_list : list [str ] = []
523
523
inputs : list [Local ] = []
524
524
peeks : list [Local ] = []
@@ -687,7 +687,7 @@ def close_variable(var: Local, overwrite: str) -> None:
687
687
self .stack .drop (output .item , self .check_liveness )
688
688
self .inputs = []
689
689
return
690
- if var_size (lowest ) != var_size (output ):
690
+ if var_size (lowest . item ) != var_size (output . item ):
691
691
raise StackError ("Cannot call DECREF_INPUTS with live output not matching first input size" )
692
692
lowest .in_local = True
693
693
close_variable (lowest , output .name )
@@ -702,7 +702,7 @@ def close_variable(var: Local, overwrite: str) -> None:
702
702
self .stack .pop (self .inputs [0 ].item )
703
703
output_in_place = self .outputs and output is self .outputs [0 ] and lowest .memory_offset is not None
704
704
if output_in_place :
705
- output .memory_offset = lowest .memory_offset .copy ()
705
+ output .memory_offset = lowest .memory_offset .copy () # type: ignore[union-attr]
706
706
else :
707
707
self .stack .flush (out )
708
708
if output is not None :
0 commit comments