File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -256,9 +256,13 @@ def extract_array_names_from_stack_summaries(
256256) -> dict [str , str ]:
257257 array_display_names : dict [str , str ] = {}
258258 for stack_summaries in stacks :
259+ # Look for array names outside cubed, prioritizing those near top of stack.
260+ # E.g. if user code defines a variable v1 referring to an array, and passes
261+ # it to a utility function that assigns the array locally to v2 then v1 takes
262+ # priority.
259263 first_cubed_i = min (i for i , s in enumerate (stack_summaries ) if s .is_cubed ())
260- caller_summary = stack_summaries [first_cubed_i - 1 ]
261- array_display_names .update (caller_summary .array_names_to_variable_names )
264+ for caller_summary in reversed ( stack_summaries [: first_cubed_i ]):
265+ array_display_names .update (caller_summary .array_names_to_variable_names )
262266 return array_display_names
263267
264268
You can’t perform that action at this time.
0 commit comments