Skip to content

Commit 19470af

Browse files
authored
Merge pull request #7559 from diffblue/array_vector_subtype
protect array_typet::subtype and vector_typet::subtype
2 parents d9f2d01 + 902cf14 commit 19470af

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/solvers/flattening/boolbv_get.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ exprt boolbvt::bv_get_unbounded_array(const exprt &expr) const
339339
{
340340
if(value.is_nil())
341341
values[*index_mpint] =
342-
exprt(ID_unknown, to_array_type(type).subtype());
342+
exprt(ID_unknown, to_array_type(type).element_type());
343343
else
344344
values[*index_mpint] = value;
345345
}

src/solvers/strings/string_refinement.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ void string_refinementt::add_lemma(
927927
{
928928
it.mutate() = array_of_exprt(
929929
from_integer(
930-
CHARACTER_FOR_UNKNOWN, to_array_type(it->type()).subtype()),
930+
CHARACTER_FOR_UNKNOWN, to_array_type(it->type()).element_type()),
931931
to_array_type(it->type()));
932932
it.next_sibling_or_parent();
933933
}
@@ -1032,7 +1032,7 @@ static optionalt<exprt> get_array(
10321032
}
10331033

10341034
const exprt arr_val = simplify_expr(super_get(arr), ns);
1035-
const typet char_type = to_array_type(arr.type()).subtype();
1035+
const typet char_type = to_array_type(arr.type()).element_type();
10361036
const typet &index_type = size.value().type();
10371037

10381038
if(

src/util/std_types.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -780,16 +780,12 @@ class array_typet:public type_with_subtypet
780780
}
781781

782782
/// The type of the elements of the array.
783-
/// This method is preferred over .subtype(),
784-
/// which will eventually be deprecated.
785783
const typet &element_type() const
786784
{
787785
return subtype();
788786
}
789787

790788
/// The type of the elements of the array.
791-
/// This method is preferred over .subtype(),
792-
/// which will eventually be deprecated.
793789
typet &element_type()
794790
{
795791
return subtype();
@@ -822,6 +818,10 @@ class array_typet:public type_with_subtypet
822818
static void check(
823819
const typet &type,
824820
const validation_modet vm = validation_modet::INVARIANT);
821+
822+
protected:
823+
// Use element_type() instead
824+
using type_with_subtypet::subtype;
825825
};
826826

827827
/// Check whether a reference to a typet is a \ref array_typet.
@@ -1021,23 +1021,23 @@ class vector_typet:public type_with_subtypet
10211021
}
10221022

10231023
/// The type of the elements of the vector.
1024-
/// This method is preferred over .subtype(),
1025-
/// which will eventually be deprecated.
10261024
const typet &element_type() const
10271025
{
10281026
return subtype();
10291027
}
10301028

10311029
/// The type of the elements of the vector.
1032-
/// This method is preferred over .subtype(),
1033-
/// which will eventually be deprecated.
10341030
typet &element_type()
10351031
{
10361032
return subtype();
10371033
}
10381034

10391035
const constant_exprt &size() const;
10401036
constant_exprt &size();
1037+
1038+
protected:
1039+
// Use element_type() instead
1040+
using type_with_subtypet::subtype;
10411041
};
10421042

10431043
/// Check whether a reference to a typet is a \ref vector_typet.

0 commit comments

Comments
 (0)