20 const std::optional<typet> &subtype)
22 REQUIRE(type.
id() == ID_pointer);
26 REQUIRE(pointer.
base_type() == subtype.value());
43 return component.get_name() == component_name;
58 const auto &componet = std::find_if(
62 return component.get_name() == component_name;
65 REQUIRE(componet != struct_type.
components().end());
74 REQUIRE(type.
id() == ID_code);
88 REQUIRE(code_type.
parameters().size() == num_params);
111 REQUIRE(method_type.
parameters().size() == num_params);
124 const auto param = std::find_if(
128 return param.get_base_name() == param_name;
131 REQUIRE(param != function_type.
parameters().end());
144 switch(expected.
kind)
198 REQUIRE(generic_type_arguments.size() == type_expectations.size());
201 generic_type_arguments.begin(),
202 generic_type_arguments.end(),
203 type_expectations.begin(),
236 return generic_param;
246 const std::optional<struct_tag_typet> &expect_subtype)
260 REQUIRE(class_type.
id() == ID_struct);
263 REQUIRE(java_class_type.
is_class());
266 return java_class_type;
274 REQUIRE(class_type.
id() == ID_struct);
277 REQUIRE(java_class_type.
is_class());
280 return java_class_type;
289 REQUIRE(class_type.
id() == ID_struct);
299 return java_generic_class_type;
308 const typet &class_type,
309 const std::initializer_list<irep_idt> &type_variables)
316 REQUIRE(generic_type_vars.size() == type_variables.size());
319 type_variables.begin(),
320 type_variables.end(),
321 generic_type_vars.begin(),
325 REQUIRE(is_java_generic_parameter(param));
326 return param.type_variable().get_identifier() == type_var_name;
329 return java_generic_class_type;
348 const typet &class_type,
349 const std::initializer_list<irep_idt> &type_variables)
361 REQUIRE(class_type.
id() == ID_struct);
369 &java_implicitly_generic_class_type =
372 return java_implicitly_generic_class_type;
382 const typet &class_type,
383 const std::initializer_list<irep_idt> &implicit_type_variables)
386 &java_implicitly_generic_class_type =
390 &implicit_generic_type_vars =
392 REQUIRE(implicit_generic_type_vars.size() == implicit_type_variables.size());
393 auto param = implicit_generic_type_vars.begin();
394 auto type_var_name = implicit_type_variables.begin();
395 for(; param != implicit_generic_type_vars.end(); ++param, ++type_var_name)
398 REQUIRE(param->type_variable().get_identifier() == *type_var_name);
400 return java_implicitly_generic_class_type;
408 const typet &class_type)
421 const typet &class_type,
422 const std::initializer_list<irep_idt> &implicit_type_variables)
426 class_type, implicit_type_variables);
435 REQUIRE(class_type.
id() == ID_struct);
444 return java_class_type;
464 REQUIRE(type.
id() == ID_struct_tag);
466 if(!identifier.
empty())
488 const std::string &identifier)
511 const std::string &identifier,
519 REQUIRE(generic_type_arguments.size() == type_expectations.size());
522 generic_type_arguments.begin(),
523 generic_type_arguments.end(),
524 type_expectations.begin(),
527 return generic_base_type;
539 const std::vector<std::string> &expected_identifiers)
543 REQUIRE(lambda_method_handles.size() == expected_identifiers.size());
546 lambda_method_handles.begin(),
547 lambda_method_handles.end(),
548 expected_identifiers.begin(),
551 const std::string &expected_identifier) {
552 return lambda_method_handle.get_lambda_method_descriptor()
553 .get_identifier() == expected_identifier;
555 return lambda_method_handles;
pointer_typet pointer_type(const typet &subtype)
const parameterst & parameters() const
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
const irep_idt & id() const
Represents a lambda call to a method.
const java_lambda_method_handlest & lambda_method_handles() const
const componentst & components() const
Class to hold a class with generics, extends the java class type with a vector of java generic type p...
std::vector< java_generic_parametert > generic_typest
const generic_typest & generic_types() const
Reference that points to a java_generic_parameter_tagt.
const type_variablet & type_variable() const
Class to hold type with generic type arguments, for example java.util.List in either a reference of t...
const generic_typest & generic_types() const
Reference that points to a java_generic_struct_tag_typet.
const generic_type_argumentst & generic_type_arguments() const
java_generic_struct_tag_typet::generic_typest generic_type_argumentst
Type to hold a Java class that is implicitly generic, e.g., an inner class of a generic outer class o...
const implicit_generic_typest & implicit_generic_types() const
std::vector< java_generic_parametert > implicit_generic_typest
The pointer type These are both 'bitvector_typet' (they have a width) and 'type_with_subtypet' (they ...
const typet & base_type() const
The type of the data what we point to.
A struct tag type, i.e., struct_typet with an identifier.
Structure type, corresponds to C style structs.
bool is_class() const
A struct may be a class, where members may have access restrictions.
const componentst & components() const
const irep_idt & get_identifier() const
The type of an expression, extends irept.
const java_class_typet & to_java_class_type(const typet &type)
bool is_java_generic_type(const typet &type)
const java_method_typet & to_java_method_type(const typet &type)
bool is_java_generic_parameter(const typet &type)
Checks whether the type is a java generic parameter/variable, e.g., T in List<T>.
bool can_cast_type< java_method_typet >(const typet &type)
const java_generic_class_typet & to_java_generic_class_type(const java_class_typet &type)
bool is_java_generic_struct_tag_type(const typet &type)
bool is_java_generic_class_type(const typet &type)
bool is_java_implicitly_generic_class_type(const typet &type)
const java_generic_typet & to_java_generic_type(const typet &type)
const java_generic_parametert & to_java_generic_parameter(const typet &type)
const java_generic_struct_tag_typet & to_java_generic_struct_tag_type(const typet &type)
const java_implicitly_generic_class_typet & to_java_implicitly_generic_class_type(const java_class_typet &type)
static std::optional< java_class_typet::java_lambda_method_handlet > lambda_method_handle(const symbol_table_baset &symbol_table, const irep_idt &method_identifier, const java_method_typet &dynamic_method_type)
java_implicitly_generic_class_typet require_java_implicitly_generic_class(const typet &class_type)
Verify that a class is a valid java implicitly generic class.
class_typet require_incomplete_class(const typet &class_type)
Checks that the given type is an incomplete class.
const struct_tag_typet & require_struct_tag(const typet &type, const irep_idt &identifier="")
Verify a given type is a symbol type, optionally with a specific identifier.
pointer_typet require_pointer_to_tag(const typet &type, const irep_idt &identifier=irep_idt())
code_typet::parametert require_parameter(const code_typet &function_type, const irep_idt ¶m_name)
Verify that a function has a parameter of a specific name.
java_lambda_method_handlest require_lambda_method_handles(const java_class_typet &class_type, const std::vector< std::string > &expected_identifiers)
Verify that the lambda method handles of a class match the given expectation.
java_generic_typet require_java_generic_type(const typet &type)
Verify a given type is a java_generic_type.
std::initializer_list< expected_type_argumentt > expected_type_argumentst
class_typet require_complete_class(const typet &class_type)
Checks that the given type is a complete class.
java_class_typet::java_lambda_method_handlest java_lambda_method_handlest
java_generic_parametert require_java_generic_parameter(const typet &type)
Verify a given type is a java_generic_parameter, e.g., T
java_class_typet require_complete_java_non_generic_class(const typet &class_type)
Verify that a class is a complete, valid nongeneric java class.
java_generic_class_typet require_java_generic_class(const typet &class_type)
Verify that a class is a valid java generic class.
java_generic_class_typet require_complete_java_generic_class(const typet &class_type)
Verify that a class is a complete, valid java generic class.
const typet & require_java_non_generic_type(const typet &type, const std::optional< struct_tag_typet > &expect_subtype)
Test a type to ensure it is not a java generics type.
java_generic_struct_tag_typet require_java_generic_struct_tag_type(const typet &type, const std::string &identifier)
Verify a given type is a java generic symbol type.
java_class_typet require_java_non_generic_class(const typet &class_type)
Verify that a class is a valid nongeneric java class.
code_typet require_code(const typet &type)
Checks a type is a code_type (i.e.
java_implicitly_generic_class_typet require_complete_java_implicitly_generic_class(const typet &class_type)
Verify that a class is a complete, valid java implicitly generic class.
java_method_typet require_java_method(const typet &type)
Checks a type is a java_method_typet (i.e.
pointer_typet require_pointer(const typet &type, const std::optional< typet > &subtype)
Checks a type is a pointer type optionally with a specific subtype.
java_class_typet::componentt require_component(const java_class_typet &java_class_type, const irep_idt &component_name)
Checks that a class has a component with a specific name.
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
bool require_java_generic_type_argument_expectation(const reference_typet &type_argument, const require_type::expected_type_argumentt &expected)
Helper function for testing that java generic type arguments match a given expectation.
Helper functions for requiring specific types If the type is of the wrong type, throw a CATCH excepti...
auto component(T &struct_expr, const irep_idt &name, const namespacet &ns) -> decltype(struct_expr.op0())
const class_typet & to_class_type(const typet &type)
Cast a typet to a class_typet.
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.
const struct_tag_typet & to_struct_tag_type(const typet &type)
Cast a typet to a struct_tag_typet.