summaryrefslogtreecommitdiff
path: root/src/theory/booleans
diff options
context:
space:
mode:
authorTim King <taking@cs.nyu.edu>2012-05-18 23:48:38 +0000
committerTim King <taking@cs.nyu.edu>2012-05-18 23:48:38 +0000
commitea8139dc7b727bf48bd7b7c6b169d763618a1f2a (patch)
tree95701608122c2a6e232ee22979e9da757bf4e2dd /src/theory/booleans
parent3b93d45dab9513195d5604a069423ed13e173f49 (diff)
This commit adds TypeNode::leastCommonTypeNode(). The special case for arithmetic in TypeNode::operator==() has been removed. A number of faulty type checking checks were switched to use isSubtypeOf. The resolves bug #339
Diffstat (limited to 'src/theory/booleans')
-rw-r--r--src/theory/booleans/theory_bool_type_rules.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/theory/booleans/theory_bool_type_rules.h b/src/theory/booleans/theory_bool_type_rules.h
index 3b30b9f59..ff6b99d77 100644
--- a/src/theory/booleans/theory_bool_type_rules.h
+++ b/src/theory/booleans/theory_bool_type_rules.h
@@ -50,14 +50,16 @@ class IteTypeRule {
public:
inline static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check)
throw (TypeCheckingExceptionPrivate, AssertionException) {
- TypeNode iteType = n[1].getType(check);
+ TypeNode thenType = n[1].getType(check);
+ TypeNode elseType = n[2].getType(check);
+ TypeNode iteType = TypeNode::leastCommonTypeNode(thenType, elseType);
if( check ) {
TypeNode booleanType = nodeManager->booleanType();
if (n[0].getType(check) != booleanType) {
throw TypeCheckingExceptionPrivate(n, "condition of ITE is not Boolean");
}
- if (iteType != n[2].getType(check)) {
- throw TypeCheckingExceptionPrivate(n, "both branches of the ITE must be of the same type");
+ if (iteType.isNull()) {
+ throw TypeCheckingExceptionPrivate(n, "both branches of the ITE must be a subtype of a common type.");
}
}
return iteType;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback