From 5e4166acb811dcfc03ef9ed981616ac9cbd3e542 Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 2 Oct 2015 23:18:54 +0200 Subject: [PATCH] Report warning in tests if requested. --- .../SolidityNameAndTypeResolution.cpp | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 961c10b47..c386e2b43 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -72,22 +72,20 @@ parseAnalyseAndReturnError(string const& _source, bool _reportWarnings = false) globalContext->setCurrentContract(*contract); resolver.updateDeclaration(*globalContext->currentThis()); TypeChecker typeChecker; - if (!typeChecker.checkTypeRequirements(*contract)) + bool success = typeChecker.checkTypeRequirements(*contract); + BOOST_CHECK(success || !typeChecker.errors().empty()); + for (auto const& firstError: typeChecker.errors()) { - for (auto const& firstError: typeChecker.errors()) + if (_reportWarnings || !dynamic_pointer_cast(firstError)) { - if (_reportWarnings || !dynamic_pointer_cast(firstError)) - { - err = firstError; - break; - } - else if (_reportWarnings) - { - err = firstError; - break; - } + err = firstError; + break; + } + else if (_reportWarnings) + { + err = firstError; + break; } - break; } } }