Make user's SMT2 version override file version (#2004)
authorAndres Noetzli <andres.noetzli@gmail.com>
Tue, 29 May 2018 18:25:13 +0000 (11:25 -0700)
committerAndrew Reynolds <andrew.j.reynolds@gmail.com>
Tue, 29 May 2018 18:25:13 +0000 (13:25 -0500)
src/parser/smt2/smt2.h
src/smt/smt_engine.cpp
test/regress/Makefile.tests
test/regress/regress0/lang_opts_2_5.smt2 [new file with mode: 0644]
test/regress/regress0/lang_opts_2_6_1.smt2 [new file with mode: 0644]

index 09f7a5696503b2bfd18a0cf10a5595e020468b5e..3def5696bfe065dc155c71790327af1da425657d 100644 (file)
@@ -171,6 +171,7 @@ public:
   {
     return language::isInputLang_smt2_6(getLanguage(), exact);
   }
+
   bool sygus() const { return getLanguage() == language::input::LANG_SYGUS; }
 
   void setInfo(const std::string& flag, const SExpr& sexpr);
index 6ecf00ccd339dcab2457f0bcf6b1f7edeaf573c5..097b41d9347ddbba1d34490599c2191d90462d8d 100644 (file)
@@ -2363,7 +2363,9 @@ void SmtEngine::setInfo(const std::string& key, const CVC4::SExpr& value)
   } else if(key == "name") {
     d_filename = value.getValue();
     return;
-  } else if(key == "smt-lib-version") {
+  }
+  else if (key == "smt-lib-version" && !options::inputLanguage.wasSetByUser())
+  {
     language::input::Language ilang = language::input::LANG_AUTO;
     if( (value.isInteger() && value.getIntegerValue() == Integer(2)) ||
         (value.isRational() && value.getRationalValue() == Rational(2)) ||
index bd5002921e79b65375bee237c96d512d9ef18c40..36f0d945e0a6a421b60f8d2de306359b4d73b8f8 100644 (file)
@@ -162,11 +162,11 @@ REG0_TESTS = \
        regress0/bv/bug734.smt2 \
        regress0/bv/bv-int-collapse1.smt2 \
        regress0/bv/bv-int-collapse2.smt2 \
-       regress0/bv/bv-to-bool.smt \
        regress0/bv/bv-options1.smt2 \
        regress0/bv/bv-options2.smt2 \
        regress0/bv/bv-options3.smt2 \
        regress0/bv/bv-options4.smt2 \
+       regress0/bv/bv-to-bool.smt \
        regress0/bv/bv2nat-ground-c.smt2 \
        regress0/bv/bv2nat-simp-range.smt2 \
        regress0/bv/bvmul-pow2-only.smt2 \
@@ -475,6 +475,8 @@ REG0_TESTS = \
        regress0/ite4.smt2 \
        regress0/ite_real_int_type.smt \
        regress0/ite_real_valid.smt \
+       regress0/lang_opts_2_5.smt2 \
+       regress0/lang_opts_2_6_1.smt2 \
        regress0/lemmas/clocksynchro_5clocks.main_invar.base.model.smt \
        regress0/lemmas/fs_not_sc_seen.induction.smt \
        regress0/lemmas/mode_cntrl.induction.smt \
@@ -595,9 +597,9 @@ REG0_TESTS = \
        regress0/quantifiers/ex3.smt2 \
        regress0/quantifiers/ex6.smt2 \
        regress0/quantifiers/floor.smt2 \
-       regress0/quantifiers/issue1805.smt2 \
        regress0/quantifiers/is-even-pred.smt2 \
        regress0/quantifiers/is-int.smt2 \
+       regress0/quantifiers/issue1805.smt2 \
        regress0/quantifiers/lra-triv-gn.smt2 \
        regress0/quantifiers/macros-int-real.smt2 \
        regress0/quantifiers/macros-real-arg.smt2 \
diff --git a/test/regress/regress0/lang_opts_2_5.smt2 b/test/regress/regress0/lang_opts_2_5.smt2
new file mode 100644 (file)
index 0000000..5a56960
--- /dev/null
@@ -0,0 +1,7 @@
+; Check that the language set in the command line options has higher priority
+; than the language specified in the input file.
+;
+; COMMAND-LINE: --lang=smt2.5
+; EXPECT: "LANG_SMTLIB_V2_5"
+(set-info :smt-lib-version 2.6)
+(get-option :input-language)
diff --git a/test/regress/regress0/lang_opts_2_6_1.smt2 b/test/regress/regress0/lang_opts_2_6_1.smt2
new file mode 100644 (file)
index 0000000..bb005d5
--- /dev/null
@@ -0,0 +1,7 @@
+; Check that the language set in the command line options has higher priority
+; than the language specified in the input file.
+;
+; COMMAND-LINE: --lang=smt2.6.1
+; EXPECT: "LANG_SMTLIB_V2_6_1"
+(set-info :smt-lib-version 2.6)
+(get-option :input-language)