Branch data Line data Source code
1 : : /****************************************************************************** 2 : : * This file is part of the cvc5 project. 3 : : * 4 : : * Copyright (c) 2009-2026 by the authors listed in the file AUTHORS 5 : : * in the top-level source directory and their institutional affiliations. 6 : : * All rights reserved. See the file COPYING in the top-level source 7 : : * directory for licensing information. 8 : : * **************************************************************************** 9 : : * 10 : : * Test for project issue #379. 11 : : */ 12 : : #include <cvc5/cvc5.h> 13 : : 14 : : #include <cassert> 15 : : 16 : : using namespace cvc5; 17 : : 18 : 1 : int main(void) 19 : : { 20 : 1 : TermManager tm; 21 : : 22 : 1 : Sort bsort = tm.getBooleanSort(); 23 : 1 : Sort psort = tm.mkParamSort("_x1"); 24 : 1 : DatatypeConstructorDecl cdecl; 25 : 3 : DatatypeDecl dtdecl = tm.mkDatatypeDecl("x_0", {psort}); 26 : 1 : cdecl = tm.mkDatatypeConstructorDecl("_x8"); 27 : 1 : cdecl.addSelector("_x7", bsort); 28 : 1 : dtdecl.addConstructor(cdecl); 29 : 1 : cdecl = tm.mkDatatypeConstructorDecl("_x6"); 30 : 1 : cdecl.addSelector("_x2", psort); 31 : 1 : cdecl.addSelectorSelf("_x3"); 32 : 1 : cdecl.addSelector("_x4", psort); 33 : 1 : cdecl.addSelector("_x5", bsort); 34 : 1 : Sort s2 = tm.mkDatatypeSort(dtdecl); 35 : 3 : Sort s6 = s2.instantiate({bsort}); 36 : 1 : Term t317 = tm.mkConst(bsort, "_x345"); 37 : 1 : Term t843 = tm.mkConst(s6, "_x346"); 38 : 3 : Term t879 = tm.mkTerm(Kind::APPLY_UPDATER, 39 : 1 : {t843.getSort() 40 : 2 : .getDatatype() 41 : 2 : .getConstructor("_x8") 42 : 2 : .getSelector("_x7") 43 : : .getUpdaterTerm(), 44 : : t843, 45 : 3 : t317}); 46 [ - + ]: 1 : assert(t879.getSort() == s6); 47 : 1 : }