diff options
author | Abdalrhman Mohamed <32971963+abdoo8080@users.noreply.github.com> | 2020-12-08 14:10:10 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-08 14:10:10 -0600 |
commit | 3255e4335f25f35318a41f174ec15a28b0f0520d (patch) | |
tree | cc79f2a3f325167d3210a1d89e2114e369cf6282 /src/printer | |
parent | 0ab8a3a7af5b80aa7bcaa028276cdc396aa7a4cb (diff) |
Fix a bug with synth-fun printer (#5512)
This PR fixes #5448. SynthFunCommand::toStream used to call d_grammar->resolve even when d_grammar is a nullptr. This PR fixes the issue and modifies the signature of Printer::toStreamCmdSynthFun to make it clear that grammar is an optional argument.
Diffstat (limited to 'src/printer')
-rw-r--r-- | src/printer/printer.h | 2 | ||||
-rw-r--r-- | src/printer/smt2/smt2_printer.cpp | 2 | ||||
-rw-r--r-- | src/printer/smt2/smt2_printer.h | 13 |
3 files changed, 9 insertions, 8 deletions
diff --git a/src/printer/printer.h b/src/printer/printer.h index 068c79330..bfc1dc64a 100644 --- a/src/printer/printer.h +++ b/src/printer/printer.h @@ -135,7 +135,7 @@ class Printer const std::vector<Node>& vars, TypeNode range, bool isInv, - TypeNode sygusType) const; + TypeNode sygusType = TypeNode::null()) const; /** Print constraint command */ virtual void toStreamCmdConstraint(std::ostream& out, Node n) const; diff --git a/src/printer/smt2/smt2_printer.cpp b/src/printer/smt2/smt2_printer.cpp index 376913ebd..81445d281 100644 --- a/src/printer/smt2/smt2_printer.cpp +++ b/src/printer/smt2/smt2_printer.cpp @@ -2043,7 +2043,7 @@ void Smt2Printer::toStreamCmdSynthFun(std::ostream& out, } out << '\n'; // print grammar, if any - if (sygusType != TypeNode::null()) + if (!sygusType.isNull()) { toStreamSygusGrammar(out, sygusType); } diff --git a/src/printer/smt2/smt2_printer.h b/src/printer/smt2/smt2_printer.h index 287a81286..1e6be22d3 100644 --- a/src/printer/smt2/smt2_printer.h +++ b/src/printer/smt2/smt2_printer.h @@ -117,12 +117,13 @@ class Smt2Printer : public CVC4::Printer TypeNode type) const override; /** Print synth-fun command */ - void toStreamCmdSynthFun(std::ostream& out, - const std::string& sym, - const std::vector<Node>& vars, - TypeNode range, - bool isInv, - TypeNode sygusType) const override; + void toStreamCmdSynthFun( + std::ostream& out, + const std::string& sym, + const std::vector<Node>& vars, + TypeNode range, + bool isInv, + TypeNode sygusType = TypeNode::null()) const override; /** Print constraint command */ void toStreamCmdConstraint(std::ostream& out, Node n) const override; |