-
Notifications
You must be signed in to change notification settings - Fork 273
Java: tolerate fields and classes with the name "nil" #4329
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
Java: tolerate fields and classes with the name "nil" #4329
Conversation
@@ -352,7 +352,8 @@ class fieldref_exprt : public exprt | |||
template <> | |||
inline bool can_cast_expr<fieldref_exprt>(const exprt &base) | |||
{ | |||
return base.get(ID_class) != ID_nil && base.get(ID_component_name) != ID_nil; | |||
return base.get(ID_class) != ID_empty_string && |
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.
How about return !base.get(ID_class).empty() && !base.get(ID_component_name).empty();
?
And while I'm at it: would mind adding a test case?
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.
Done
fieldref_exprt confused ID_nil with ID_empty_string and therefore rejected "class nil { int nil; }" for example.
4cd4cf3
to
796f7e1
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: 796f7e1).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/103234960
Status will be re-evaluated on next push.
Common spurious failures:
-
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).
-
the 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.
Thanks a lot for adding a test!
fieldref_exprt confused ID_nil with ID_empty_string and therefore rejected "class nil { int nil; }" for example.