Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Correctly typing and initialising prior_loops_cache #4654

Merged
merged 2 commits into from
Oct 3, 2024

Conversation

PetarMax
Copy link
Contributor

@PetarMax PetarMax commented Oct 3, 2024

If an APR proof on disk contains a loops_cache, it cannot be executed further because of a typing error in the style of:

...
File "/nix/store/6bi78qgqbnqryswaly3m4rggsqkrj72w-python3.10-kframework-7.1.145/lib/python3.10/site-packages/pyk/proof/reachability.py", line 793, in step_proof                                                                                    
    prior_loops = step.prior_loops_cache[node.id] + (node.id,)                                                                                                                                                                                        
TypeError: can only concatenate list (not "tuple") to list     

when initialising prior_loops_cache from disk.

This PR corrects this bug by enforcing the correct types.

@PetarMax PetarMax added the bug label Oct 3, 2024
@PetarMax PetarMax self-assigned this Oct 3, 2024
@rv-jenkins rv-jenkins changed the base branch from master to develop October 3, 2024 10:21
Comment on lines 587 to 589
prior_loops_cache: dict[int, tuple[int, ...]] = {
int(k): tuple(v) for k, v in proof_dict.get('loops_cache', {}).items()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Condiser pushing the conversion down into APRPRoof.__init__:

self.prior_loops_cache = prior_loops_cache if prior_loops_cache is not None else {}

@PetarMax PetarMax merged commit 64b0260 into develop Oct 3, 2024
17 checks passed
@PetarMax PetarMax deleted the petar/loop-cache-type-correction branch October 3, 2024 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants