aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/formal
diff options
context:
space:
mode:
authorLeonardo Alt <leo@ethereum.org>2018-08-02 05:27:46 +0800
committerLeonardo Alt <leo@ethereum.org>2018-08-02 05:27:46 +0800
commit90f319615f12b5a025f4cbc07ac28deb1a61899d (patch)
tree10183029223400b87fe314faffa16b1b40010435 /libsolidity/formal
parentb6a265551335edeff2f4e43f4a249fabba5381d7 (diff)
downloaddexon-solidity-90f319615f12b5a025f4cbc07ac28deb1a61899d.tar
dexon-solidity-90f319615f12b5a025f4cbc07ac28deb1a61899d.tar.gz
dexon-solidity-90f319615f12b5a025f4cbc07ac28deb1a61899d.tar.bz2
dexon-solidity-90f319615f12b5a025f4cbc07ac28deb1a61899d.tar.lz
dexon-solidity-90f319615f12b5a025f4cbc07ac28deb1a61899d.tar.xz
dexon-solidity-90f319615f12b5a025f4cbc07ac28deb1a61899d.tar.zst
dexon-solidity-90f319615f12b5a025f4cbc07ac28deb1a61899d.zip
SMT model variables are sorted and printed as secondary source location
Diffstat (limited to 'libsolidity/formal')
-rw-r--r--libsolidity/formal/SMTChecker.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/libsolidity/formal/SMTChecker.cpp b/libsolidity/formal/SMTChecker.cpp
index 15300bc6..17b50a38 100644
--- a/libsolidity/formal/SMTChecker.cpp
+++ b/libsolidity/formal/SMTChecker.cpp
@@ -601,15 +601,23 @@ void SMTChecker::checkCondition(
message << _description << " happens here";
if (m_currentFunction)
{
- message << " for:\n";
+ std::ostringstream modelMessage;
+ modelMessage << " for:\n";
solAssert(values.size() == expressionNames.size(), "");
+ map<string, string> sortedModel;
for (size_t i = 0; i < values.size(); ++i)
if (expressionsToEvaluate.at(i).name != values.at(i))
- message << " " << expressionNames.at(i) << " = " << values.at(i) << "\n";
+ sortedModel[expressionNames.at(i)] = values.at(i);
+
+ for (auto const& eval: sortedModel)
+ modelMessage << " " << eval.first << " = " << eval.second << "\n";
+ m_errorReporter.warning(_location, message.str() + loopComment, SecondarySourceLocation().append(modelMessage.str(), SourceLocation()));
}
else
+ {
message << ".";
- m_errorReporter.warning(_location, message.str() + loopComment);
+ m_errorReporter.warning(_location, message.str() + loopComment);
+ }
break;
}
case smt::CheckResult::UNSATISFIABLE: