CVC5_API_CHECK_SORTS(params);
CVC5_API_CHECK(isParametricDatatype() || isSortConstructor())
<< "Expected parametric datatype or sort constructor sort.";
+ CVC5_API_CHECK(isSortConstructor()
+ || d_type->getNumChildren() == params.size() + 1)
+ << "Arity mismatch for instantiated parametric datatype";
//////// all checks before this line
std::vector<cvc5::TypeNode> tparams = sortVectorToTypeNodes(params);
if (d_type->isDatatype())
ASSERT_THROW(d_solver.getValue(t3), CVC5ApiException);
}
+TEST_F(TestApiBlackSolver, proj_issue386)
+{
+ Sort s1 = d_solver.getBooleanSort();
+ Sort p1 = d_solver.mkParamSort("_p1");
+ Sort p2 = d_solver.mkParamSort("_p2");
+ DatatypeDecl dtdecl = d_solver.mkDatatypeDecl("_x0", {p1, p2});
+ DatatypeConstructorDecl ctordecl = d_solver.mkDatatypeConstructorDecl("_x1");
+ ctordecl.addSelector("_x2", p1);
+ dtdecl.addConstructor(ctordecl);
+ Sort s2 = d_solver.mkDatatypeSort(dtdecl);
+ ASSERT_THROW(s2.instantiate({s1}), CVC5ApiException);
+}
+
} // namespace test
} // namespace cvc5