-
Notifications
You must be signed in to change notification settings - Fork 277
[TG-9189] Value retriever: Allow @nondetLength field to be false. #5043
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
Conversation
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.
This PR failed Diffblue compatibility checks (cbmc commit: 3786fa1).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/123942200
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.
Codecov Report
@@ Coverage Diff @@
## develop #5043 +/- ##
===========================================
- Coverage 69.53% 69.48% -0.06%
===========================================
Files 1314 1310 -4
Lines 108988 108815 -173
===========================================
- Hits 75786 75611 -175
- Misses 33202 33204 +2
Continue to review full report at Codecov.
|
if(get_type(json) || has_nondet_length(json)) | ||
return json[object_key]; | ||
return json; | ||
if(!json.is_object()) |
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.
Are you really expecting just any old thing here when it's not an object, or do you expect something specific, such as null for example? If so, check for your expectation.
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.
@smowton It could be pretty much anything so I think this change makes sense.
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.
I think the ticket number should be at the beginning of the PR title.
Thanks for fixing this!
if(get_type(json) || has_nondet_length(json)) | ||
return json[object_key]; | ||
return json; | ||
if(!json.is_object()) |
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.
@smowton It could be pretty much anything so I think this change makes sense.
|
||
const auto &json_object = to_json_object(json); | ||
PRECONDITION( | ||
get_type(json) || json_object.find("@nondetLength") != json_object.end()); |
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.
⛏️ We could be more precise and assert the current precondition only if json
is contains a json_arrayt
, and assert only get_type(json)
otherwise, as we wouldn't expect a @nondetLength
key on e.g. a number or boolean. But then again in the current version we would just ignore such @nondetLength
keys, which wouldn't cause any harm.
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.
precondition is split
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.
This introduced problems, so I reverted to the initial solution.
01d759f
to
31f77ab
Compare
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.
This PR failed Diffblue compatibility checks (cbmc commit: 01d759f).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/124064989
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 31f77ab).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/124068722
|
||
const auto &json_object = to_json_object(json); | ||
if(json.is_array()) | ||
PRECONDITION(json_object.find("@nondetLength") != json_object.end()); |
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.
This would have to be
PRECONDITION(get_type(json) || json_object.find("@nondetLength") != json_object.end());
31f77ab
to
926d4b8
Compare
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.
This PR failed Diffblue compatibility checks (cbmc commit: 926d4b8).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/124113599
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.
43b05de
to
681f353
Compare
Blocked by #5047 |
This can happen with Arrays$ArrayList. get_untyped now no longer calls has_nondet_length, which would fail if @nondetLength was false.
681f353
to
901403d
Compare
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 901403d).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/124729691
This can happen with
Arrays$ArrayList
.get_untyped now no longer calls has_nondet_length, which would fail if
@nondetLength
was false.There will be a regression test in TG.