Fix type checking for define-funs (resolves bug 398).
authorMorgan Deters <mdeters@gmail.com>
Wed, 26 Sep 2012 03:50:57 +0000 (03:50 +0000)
committerMorgan Deters <mdeters@gmail.com>
Wed, 26 Sep 2012 03:50:57 +0000 (03:50 +0000)
(this commit was certified error- and warning-free by the test-and-commit script.)

src/smt/smt_engine.cpp
src/theory/builtin/theory_builtin_type_rules.h
src/theory/uf/theory_uf_type_rules.h

index cedd866f977e9943c20f3f1c1c82c42c2f359987..ad72e07377884db8f4884dfc465603ca15232276 100644 (file)
@@ -888,7 +888,7 @@ void SmtEngine::defineFunction(Expr func,
   // doesn't match the SMT-LIBv2 standard...
   if(formals.size() > 0) {
     Type rangeType = FunctionType(funcType).getRangeType();
-    if(formulaType != rangeType) {
+    if(! formulaType.isComparableTo(rangeType)) {
       stringstream ss;
       ss << "Type of defined function does not match its declaration\n"
          << "The function  : " << func << "\n"
@@ -898,7 +898,7 @@ void SmtEngine::defineFunction(Expr func,
       throw TypeCheckingException(func, ss.str());
     }
   } else {
-    if(formulaType != funcType) {
+    if(! formulaType.isComparableTo(funcType)) {
       stringstream ss;
       ss << "Declared type of defined constant does not match its definition\n"
          << "The constant   : " << func << "\n"
index 939c52f31174fdcfc20f07eea310cbe1ac4861ac..a2e8e8179f7929100d70adf5b6de96e7cf1b85ed 100644 (file)
@@ -50,7 +50,7 @@ class ApplyTypeRule {
         TNode::iterator argument_it_end = n.end();
         TypeNode::iterator argument_type_it = fType.begin();
         for(; argument_it != argument_it_end; ++argument_it, ++argument_type_it) {
-          if((*argument_it).getType() != *argument_type_it) {
+          if(!(*argument_it).getType().isComparableTo(*argument_type_it)) {
             std::stringstream ss;
             ss << "argument types do not match the function type:\n"
                << "argument:  " << *argument_it << "\n"
index 09f287884d6338e7cda9b3a195fc60d395eaf34e..2c28d41e332da340c2ce26c4111f5160defe95bf 100644 (file)
@@ -44,7 +44,7 @@ public:
       for(; argument_it != argument_it_end; ++argument_it, ++argument_type_it) {
         TypeNode currentArgument = (*argument_it).getType();
         TypeNode currentArgumentType = *argument_type_it;
-        if(!currentArgument.isSubtypeOf(currentArgumentType)) {
+        if(!currentArgument.isComparableTo(currentArgumentType)) {
           std::stringstream ss;
           ss << "argument type is not a subtype of the function's argument type:\n"
              << "argument:  " << *argument_it << "\n"