summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Noetzli <noetzli@stanford.edu>2017-05-15 10:09:45 -0700
committerAndres Noetzli <noetzli@stanford.edu>2017-05-15 10:09:45 -0700
commit370052d7bb7125376eeb7296091f5ce977421efa (patch)
tree03331800f869765a2660dad7d6d3174e9e539ea7
parent31681c7ff2a1469f5efc325fc1b3a406e3a85949 (diff)
Fix type checks for relation operators
This commit fixes an assertion error when applying transpose or transitive closure to a set instead of a relation. Instead it now prints a parse error.
-rw-r--r--src/theory/sets/theory_sets_type_rules.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/theory/sets/theory_sets_type_rules.h b/src/theory/sets/theory_sets_type_rules.h
index b8c0a8055..a5a78e691 100644
--- a/src/theory/sets/theory_sets_type_rules.h
+++ b/src/theory/sets/theory_sets_type_rules.h
@@ -277,8 +277,8 @@ struct RelTransposeTypeRule {
throw (TypeCheckingExceptionPrivate, AssertionException) {
Assert(n.getKind() == kind::TRANSPOSE);
TypeNode setType = n[0].getType(check);
- if(check && !setType.isSet() && !setType.getSetElementType().isTuple()) {
- throw TypeCheckingExceptionPrivate(n, "relation transpose operats on non-relation");
+ if(check && (!setType.isSet() || !setType.getSetElementType().isTuple())) {
+ throw TypeCheckingExceptionPrivate(n, "relation transpose operates on non-relation");
}
std::vector<TypeNode> tupleTypes = setType[0].getTupleTypes();
std::reverse(tupleTypes.begin(), tupleTypes.end());
@@ -296,7 +296,7 @@ struct RelTransClosureTypeRule {
Assert(n.getKind() == kind::TCLOSURE);
TypeNode setType = n[0].getType(check);
if(check) {
- if(!setType.isSet() && !setType.getSetElementType().isTuple()) {
+ if(!setType.isSet() || !setType.getSetElementType().isTuple()) {
throw TypeCheckingExceptionPrivate(n, " transitive closure operates on non-relation");
}
std::vector<TypeNode> tupleTypes = setType[0].getTupleTypes();
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback