From 833385664804e4d5651108475b907ea240aac2ab Mon Sep 17 00:00:00 2001 From: Morgan Deters Date: Fri, 1 Feb 2013 08:31:34 -0500 Subject: [PATCH] Fix a tuple attribute bug that was causing model-generation problems for tuples --- src/expr/node_manager.cpp | 3 ++- test/regress/regress0/datatypes/Makefile.am | 1 + test/regress/regress0/datatypes/tuple-model.cvc | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 test/regress/regress0/datatypes/tuple-model.cvc diff --git a/src/expr/node_manager.cpp b/src/expr/node_manager.cpp index 59d23c6ea..a3c968158 100644 --- a/src/expr/node_manager.cpp +++ b/src/expr/node_manager.cpp @@ -412,6 +412,7 @@ TypeNode NodeManager::getDatatypeForTupleRecord(TypeNode t) { dt.addConstructor(c); dtt = TypeNode::fromType(toExprManager()->mkDatatypeType(dt)); Debug("tuprec") << "REWROTE " << t << " to " << dtt << std::endl; + dtt.setAttribute(DatatypeTupleAttr(), t); } else { const Record& rec = t.getRecord(); Datatype dt("__cvc4_record"); @@ -422,8 +423,8 @@ TypeNode NodeManager::getDatatypeForTupleRecord(TypeNode t) { dt.addConstructor(c); dtt = TypeNode::fromType(toExprManager()->mkDatatypeType(dt)); Debug("tuprec") << "REWROTE " << t << " to " << dtt << std::endl; + dtt.setAttribute(DatatypeRecordAttr(), t); } - dtt.setAttribute(DatatypeRecordAttr(), t); } else { Debug("tuprec") << "REUSING cached " << t << ": " << dtt << std::endl; } diff --git a/test/regress/regress0/datatypes/Makefile.am b/test/regress/regress0/datatypes/Makefile.am index 58bd6711d..08b00a309 100644 --- a/test/regress/regress0/datatypes/Makefile.am +++ b/test/regress/regress0/datatypes/Makefile.am @@ -18,6 +18,7 @@ MAKEFLAGS = -k # put it below in "TESTS +=" TESTS = \ tuple.cvc \ + tuple-model.cvc \ rec1.cvc \ rec2.cvc \ rec4.cvc \ diff --git a/test/regress/regress0/datatypes/tuple-model.cvc b/test/regress/regress0/datatypes/tuple-model.cvc new file mode 100644 index 000000000..2ba96712d --- /dev/null +++ b/test/regress/regress0/datatypes/tuple-model.cvc @@ -0,0 +1,6 @@ +% This was breaking with --check-models due to tuple model breakage. +% EXPECT: sat +% EXIT: 10 +x : [ INT, INT ]; +ASSERT x.0 = 5; +CHECKSAT; -- 2.30.2