Skip to content

Commit 3129270

Browse files
Correct refined_string_typet constructor
We make the second argument be a the content type which makes it more flexible, and is compatible with how it was used once. We way it was used was inconsistent.
1 parent fde97f0 commit 3129270

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

jbmc/unit/solvers/refinement/string_constraint_instantiation/instantiate_not_contains.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class tt
3636
}
3737
refined_string_typet string_type() const
3838
{
39-
return refined_string_typet(length_type(), char_type());
39+
return refined_string_typet(length_type(), pointer_type(char_type()));
4040
}
4141
array_typet witness_type() const
4242
{

jbmc/unit/solvers/refinement/string_refinement/dependency_graph.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ SCENARIO("dependency_graph", "[core][solvers][refinement][string_refinement]")
4848
GIVEN("dependency graph")
4949
{
5050
string_dependenciest dependencies;
51-
refined_string_typet string_type(java_char_type(), java_int_type());
51+
const typet string_type =
52+
refined_string_typet(java_int_type(), pointer_type(java_char_type()));
5253
const exprt string1 = make_string_argument("string1");
5354
const exprt string2 = make_string_argument("string2");
5455
const exprt string3 = make_string_argument("string3");

src/util/refined_string_type.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ Author: Romain Brenguier, romain.brenguier@diffblue.com
2121
#include "std_expr.h"
2222

2323
refined_string_typet::refined_string_typet(
24-
const typet &index_type, const typet &char_type)
24+
const typet &index_type,
25+
const typet &content_type)
2526
{
26-
array_typet char_array(char_type, infinity_exprt(index_type));
2727
components().emplace_back("length", index_type);
28-
components().emplace_back("content", char_array);
28+
components().emplace_back("content", content_type);
2929
set_tag(CPROVER_PREFIX"refined_string_type");
3030
}

0 commit comments

Comments
 (0)