Skip to content

smt2 id_map: Do not use nil_typet when we mean "optional" [blocks: #3800] #3948

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 2 commits into from
Jan 27, 2019

Conversation

tautschnig
Copy link
Collaborator

Use optionalt instead. nil_typet is deprecated.

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

Copy link
Contributor

@allredj allredj left a 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: 8033ac4).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/98644406
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.

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 incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.

@kroening
Copy link
Member

I believe it's an invariant that the type is always set -- get_fresh_id could do a .find() instead, and then .emplace could be used to insert.

@tautschnig
Copy link
Collaborator Author

I'll re-architect this one as suggested.

@tautschnig tautschnig assigned tautschnig and unassigned kroening Jan 26, 2019
@tautschnig tautschnig force-pushed the deprecation-nil_typet-smt2 branch from 8033ac4 to c638239 Compare January 26, 2019 20:39
@tautschnig
Copy link
Collaborator Author

@kroening Re-architected in a way that seems overall cleaner to me - but it isn't a part of the code base that I know all that well.

@tautschnig tautschnig assigned kroening and unassigned tautschnig Jan 26, 2019
@kroening
Copy link
Member

idt::type is now redundant -- that information is always in idt::definition as well. I am mildly uneasy about a NIL expression whose type is used in an important way; I don't have a better idea right now.

@kroening
Copy link
Member

I think what we would want here is a variant type; so a cheap substitute is to have both the typet and the exprt, both optional, and exactly one is used.

@kroening
Copy link
Member

If this is indeed a case of a variant type, then #3962 may appeal.

Do not silently replace their type.
Use std::map's emplace API for that purpose, and while at it also refactor all
inserts into id_map.
@tautschnig tautschnig force-pushed the deprecation-nil_typet-smt2 branch from c638239 to 7792612 Compare January 27, 2019 16:01
@tautschnig
Copy link
Collaborator Author

It seems it only almost is a case of a variant type: it's not quite the case for define-fun. This was a place where my initial patch had introduced a new bug, and also where a bug already existed (and is now fixed), see the included extension of a regression test.

Copy link
Contributor

@allredj allredj left a 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: 7792612).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/98740109

@tautschnig tautschnig merged commit 7f2ff2c into diffblue:develop Jan 27, 2019
@tautschnig tautschnig deleted the deprecation-nil_typet-smt2 branch January 27, 2019 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants