-
Notifications
You must be signed in to change notification settings - Fork 46
Python -> Laurel translation: unmodeled method calls to havoc non-receiver arguments too #1019
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
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
d0d3e11
test: Add reproduction for list.append() hole not mutating receiver
ssomayyajula ddea3df
fix: Havoc value-typed locals referenced in unmodeled calls
ssomayyajula 70e93e7
Merge github/main into fix-python-laurel-hole-mutate-receiver
ssomayyajula ee15f2d
fix: Havoc local arguments in unmodeled calls
ssomayyajula d0b1a17
fix: Use unknown method in argument havoc test
ssomayyajula b4853a3
fix: Regenerate expected output in default (deductive) mode
ssomayyajula 3a73276
Merge github/main: resolve expected output conflict
ssomayyajula c329108
Merge branch 'main' into fix-python-laurel-hole-mutate-receiver
thanhnguyen-aws 13b307c
fix: Only havoc Any-typed arguments in unmodeled calls
ssomayyajula c7f8429
Merge github/main into fix-python-laurel-hole-mutate-receiver
ssomayyajula c037d3c
docs: Document that composite heap havoc is out of scope
ssomayyajula 9a4658c
Merge remote-tracking branch 'github/main' into fix-python-laurel-hol…
ssomayyajula 9104a80
Merge branch 'fix-python-laurel-hole-mutate-receiver' of github.com:s…
ssomayyajula 538f7ef
fix: Update havoc test to use truthiness checks in bugFinding mode
ssomayyajula 7953cb4
fix: Restore assertion-based havoc test
ssomayyajula 6558ed9
fix: Move havoc from Expr handler to translateCall
ssomayyajula f54deb7
fix: Correct test assertion messages to match actual behavior
ssomayyajula 09cf4be
fix: Add expected_interpret file for test_havoc_callee_after_hole_call
keyboardDrummer-bot 5ab9f5a
fix: Handle Hole in statement position in LaurelToCoreTranslator
keyboardDrummer-bot 9d7402e
Add Strata internal benchmarks Github Action (#1070)
aqjune-aws a546083
PySpec pipeline: fix type mismatches, add type assertions, and clean …
joehendrix 94e6ba8
fix: Remove argHavoc from unmodeled calls to fix CI
keyboardDrummer-bot ef008fe
Merge branch 'main' into fix-python-laurel-hole-mutate-receiver
keyboardDrummer-bot a6ed10d
fix: Restore argument havoc for unmodeled calls
keyboardDrummer-bot 88f4e65
fix: Handle Hole RHS in Assign as havoc in LaurelToCoreTranslator
keyboardDrummer-bot 69b1df4
Merge branch 'main' into fix-python-laurel-hole-mutate-receiver
thanhnguyen-aws dd488eb
Merge branch 'main' into fix-python-laurel-hole-mutate-receiver
olivier-aws 17b0e82
Merge branch 'main' into fix-python-laurel-hole-mutate-receiver
robin-aws 07d3556
Fix regression when unmodelled function in a loop iterator
olivier-aws 65a0fdb
restore expected files
olivier-aws File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
StrataTest/Languages/Python/expected_interpret/test_havoc_callee_after_hole_call.expected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| \[ERROR\] procedure '__main__': expected 1 arguments, got 0 |
10 changes: 10 additions & 0 deletions
10
StrataTest/Languages/Python/expected_laurel/test_havoc_callee_after_hole_call.expected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| test_havoc_callee_after_hole_call.py(8, 0): ❓ unknown - expected unknown because xs should be havocked | ||
| test_havoc_callee_after_hole_call.py(12, 0): ❓ unknown - expected unknown because xs should be havocked | ||
| test_havoc_callee_after_hole_call.py(16, 0): ✔️ always true if reached - chained call: receiver not havocked (chained attribute is not a Name) | ||
| test_havoc_callee_after_hole_call.py(20, 0): ✔️ always true if reached - unrelated variable: nothing should be havocked | ||
| test_havoc_callee_after_hole_call.py(25, 0): ✔️ always true if reached - composite arg: heap not havocked (out of scope) | ||
| test_havoc_callee_after_hole_call.py(30, 0): ❓ unknown - expected unknown because argument locals should be havocked | ||
| test_havoc_callee_after_hole_call.py(36, 0): ❓ unknown - assume_assume(1193)_calls_PIn_0 | ||
| test_havoc_callee_after_hole_call.py(37, 4): ✔️ always true if reached - for-loop over unmodeled iterator should not crash | ||
| DETAIL: 4 passed, 0 failed, 4 inconclusive | ||
| RESULT: Inconclusive |
4 changes: 2 additions & 2 deletions
4
StrataTest/Languages/Python/expected_laurel/test_missing_models.expected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
StrataTest/Languages/Python/tests/test_havoc_callee_after_hole_call.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # strata-args: --check-mode bugFinding --check-level full | ||
| class MyClass: | ||
| def __init__(self, n: int): | ||
| self.val : int = n | ||
|
|
||
| xs: list[int] = [1, 2] | ||
| xs.some_unmodeled_call_1(3) | ||
| assert xs == [1, 2], "expected unknown because xs should be havocked" | ||
|
|
||
| xs = [1,2] | ||
| ys: list[int] = xs.some_unmodeled_call_2() | ||
| assert xs == [1, 2], "expected unknown because xs should be havocked" | ||
|
|
||
| xs = [1,2] | ||
| xs.some_unmodeled_call_3.some_unmodeled_call_4() | ||
| assert xs == [1, 2], "chained call: receiver not havocked (chained attribute is not a Name)" | ||
|
|
||
| xs = [1,2] | ||
| some_function().some_unmodeled_call_5() | ||
| assert xs == [1, 2], "unrelated variable: nothing should be havocked" | ||
|
|
||
| a : MyClass = MyClass(2) | ||
| a.val = 1 | ||
| some_unmodeled_call_6(a) | ||
| assert a.val == 1, "composite arg: heap not havocked (out of scope)" | ||
|
|
||
| xs2: list[int] = [1, 2] | ||
| ys2: list[int] = [] | ||
| xs2.unknown_method_that_may_modify_arguments(ys2) | ||
| assert ys2 == [], "expected unknown because argument locals should be havocked" | ||
|
|
||
| # Regression: unmodeled method call as for-loop iterator. | ||
| # The receiver havoc must be lifted out of the iterator expression so | ||
| # the block does not end up in expression position inside the assume. | ||
| response: dict = {"messages": []} | ||
| for msg in response.unmodeled_iter_method(): | ||
| assert True, "for-loop over unmodeled iterator should not crash" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this not eliminated by the
Strata/Languages/Laurel/EliminateHoles.leanpass?