Skip to content

SMT2 parser: add 'as const' #5976

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 1 commit into from
Mar 25, 2021
Merged

SMT2 parser: add 'as const' #5976

merged 1 commit into from
Mar 25, 2021

Conversation

kroening
Copy link
Member

@kroening kroening commented Mar 25, 2021

This is an extension understood by Z3 and CVC4, which is the equivalent of
array_of_exprt.

  • 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.

@SaswatPadhi
Copy link
Contributor

Thanks adding this! This might resolve the CI issue in #5974.

@codecov
Copy link

codecov bot commented Mar 25, 2021

Codecov Report

Merging #5976 (95e1161) into develop (d38316e) will decrease coverage by 0.00%.
The diff coverage is 90.32%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #5976      +/-   ##
===========================================
- Coverage    75.02%   75.02%   -0.01%     
===========================================
  Files         1431     1431              
  Lines       155576   155595      +19     
===========================================
+ Hits        116721   116734      +13     
- Misses       38855    38861       +6     
Impacted Files Coverage Δ
src/ansi-c/expr2c_class.h 100.00% <ø> (ø)
src/goto-symex/goto_state.h 100.00% <ø> (ø)
src/util/expr.h 97.84% <ø> (ø)
src/solvers/smt2/smt2_parser.cpp 70.81% <68.42%> (-0.07%) ⬇️
src/ansi-c/expr2c.cpp 68.62% <100.00%> (ø)
src/goto-symex/complexity_limiter.cpp 96.34% <100.00%> (ø)
src/util/expr.cpp 76.47% <100.00%> (ø)
unit/util/expr.cpp 100.00% <100.00%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d7b9787...95e1161. Read the comment docs.

Comment on lines 703 to 706
if(sort.id() != ID_array)
throw error()
<< "unexpected 'as const' expression expects array type";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit pick: braces around multi-line body.

if(smt2_tokenizer.next_token() != smt2_tokenizert::CLOSE)
throw error() << "expecting ')' at the end of 'as const'";

return array_of_exprt(value, to_array_type(sort));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use array_sort instead of (repeated) to_array_type(sort)

This is an extension understood by Z3 and CVC4, which is the equivalent of
array_of_exprt.
@tautschnig tautschnig merged commit 0ba60d7 into develop Mar 25, 2021
@tautschnig tautschnig deleted the smt2_as_const branch March 25, 2021 22:42
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.

4 participants