From 87b204084e86b534571f16250ca4871150b2a783 Mon Sep 17 00:00:00 2001 From: Andrew Reynolds Date: Wed, 2 Jun 2021 16:16:40 -0500 Subject: [PATCH] Fixes for printing define-fun-rec (#6673) --- src/printer/smt2/smt2_printer.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/printer/smt2/smt2_printer.cpp b/src/printer/smt2/smt2_printer.cpp index 4607d2747..04a57e0e9 100644 --- a/src/printer/smt2/smt2_printer.cpp +++ b/src/printer/smt2/smt2_printer.cpp @@ -1698,21 +1698,20 @@ void Smt2Printer::toStreamCmdDefineFunctionRec( out << funcs[i] << " ("; // print its type signature vector::const_iterator itf = formals[i].cbegin(); - for (;;) + while (itf != formals[i].cend()) { out << "(" << (*itf) << " " << (*itf).getType() << ")"; ++itf; - if (itf != formals[i].end()) + if (itf != formals[i].cend()) { out << " "; } - else - { - break; - } } TypeNode type = funcs[i].getType(); - type = type.getRangeType(); + if (type.isFunction()) + { + type = type.getRangeType(); + } out << ") " << type; if (funcs.size() > 1) { @@ -1723,6 +1722,10 @@ void Smt2Printer::toStreamCmdDefineFunctionRec( { out << ") ("; } + else + { + out << " "; + } for (unsigned i = 0, size = formulas.size(); i < size; i++) { if (i > 0) -- 2.30.2