CVC5_API_CHECK(d_type->isParametricDatatype())
<< "Not a parametric datatype sort.";
//////// all checks before this line
- return typeNodeVectorToSorts(d_solver, d_type->getParamTypes());
+ return typeNodeVectorToSorts(d_solver, d_type->getDType().getParameters());
////////
CVC5_API_TRY_CATCH_END;
}
if (isParam)
{
paramTypes = t.getDType().getParameters();
- instTypes = t.getParamTypes();
+ instTypes = t.getInstantiatedParamTypes();
}
for (unsigned i = 0, nargs = getNumArgs(); i < nargs; i++)
{
if (isParam)
{
paramTypes = t.getDType().getParameters();
- instTypes = t.getParamTypes();
+ instTypes = t.getInstantiatedParamTypes();
}
for (size_t i = 0, nargs = d_args.size(); i < nargs; i++)
{
if (isParam)
{
paramTypes = t.getDType().getParameters();
- instTypes = TypeNode(t).getParamTypes();
+ instTypes = TypeNode(t).getInstantiatedParamTypes();
}
for (size_t i = 0, nargs = getNumArgs(); i < nargs; i++)
{
#include "type_matcher.h"
+#include "expr/dtype.h"
+
namespace cvc5 {
TypeMatcher::TypeMatcher(TypeNode dt)
void TypeMatcher::addTypesFromDatatype(TypeNode dt)
{
- std::vector<TypeNode> argTypes = dt.getParamTypes();
+ std::vector<TypeNode> argTypes;
+ if (dt.isInstantiated())
+ {
+ argTypes = dt.getInstantiatedParamTypes();
+ }
+ else
+ {
+ argTypes = dt.getDType().getParameters();
+ }
addTypes(argTypes);
Trace("typecheck-idt") << "instantiating matcher for " << dt << std::endl;
for (unsigned i = 0, narg = argTypes.size(); i < narg; ++i)
return args;
}
-std::vector<TypeNode> TypeNode::getParamTypes() const {
+std::vector<TypeNode> TypeNode::getInstantiatedParamTypes() const
+{
+ Assert(isInstantiated());
vector<TypeNode> params;
- Assert(isParametricDatatype());
- for(unsigned i = 1, i_end = getNumChildren(); i < i_end; ++i) {
+ for (uint32_t i = 1, i_end = getNumChildren(); i < i_end; ++i)
+ {
params.push_back((*this)[i]);
}
return params;
std::vector<TypeNode> getArgTypes() const;
/**
- * Get the paramater types of a parameterized datatype. Fails an
- * assertion if this type is not a parametric datatype.
+ * Get the types used to instantiate the type parameters of a parametric
+ * type (parametric datatype or uninterpreted sort constructor type,
+ * see TypeNode::instantiate(const std::vector<TypeNode>& const).
+ *
+ * Asserts that this type is an instantiated type.
+ *
+ * @return the types used to instantiate the type parameters of a
+ * parametric type
*/
- std::vector<TypeNode> getParamTypes() const;
+ std::vector<TypeNode> getInstantiatedParamTypes() const;
/**
* Get the range type (i.e., the type of the result) of a function,