mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fail on assertion failures in yul code generation.
This commit is contained in:
parent
7d036dcb81
commit
a4769d446f
@ -104,6 +104,7 @@ struct ErrorId
|
|||||||
{
|
{
|
||||||
unsigned long long error = 0;
|
unsigned long long error = 0;
|
||||||
bool operator==(ErrorId const& _rhs) const { return error == _rhs.error; }
|
bool operator==(ErrorId const& _rhs) const { return error == _rhs.error; }
|
||||||
|
bool operator!=(ErrorId const& _rhs) const { return !(*this == _rhs); }
|
||||||
};
|
};
|
||||||
constexpr ErrorId operator"" _error(unsigned long long _error) { return ErrorId{ _error }; }
|
constexpr ErrorId operator"" _error(unsigned long long _error) { return ErrorId{ _error }; }
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace solidity;
|
using namespace solidity;
|
||||||
using namespace solidity::yul;
|
using namespace solidity::yul;
|
||||||
|
using namespace solidity::langutil;
|
||||||
using namespace solidity::util;
|
using namespace solidity::util;
|
||||||
using namespace solidity::util::formatting;
|
using namespace solidity::util::formatting;
|
||||||
using namespace solidity::frontend::test;
|
using namespace solidity::frontend::test;
|
||||||
@ -120,8 +121,6 @@ TestCase::TestResult SemanticTest::run(ostream& _stream, string const& _linePref
|
|||||||
|
|
||||||
TestCase::TestResult SemanticTest::runTest(ostream& _stream, string const& _linePrefix, bool _formatted, bool _compileViaYul, bool _compileToEwasm)
|
TestCase::TestResult SemanticTest::runTest(ostream& _stream, string const& _linePrefix, bool _formatted, bool _compileViaYul, bool _compileToEwasm)
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
if (_compileViaYul && _compileToEwasm)
|
if (_compileViaYul && _compileToEwasm)
|
||||||
@ -151,6 +150,9 @@ TestCase::TestResult SemanticTest::runTest(ostream& _stream, string const& _line
|
|||||||
bool constructed = false;
|
bool constructed = false;
|
||||||
|
|
||||||
for (auto& test: m_tests)
|
for (auto& test: m_tests)
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (constructed)
|
if (constructed)
|
||||||
{
|
{
|
||||||
@ -175,6 +177,19 @@ TestCase::TestResult SemanticTest::runTest(ostream& _stream, string const& _line
|
|||||||
soltestAssert(deploy("", 0, bytes(), libraries), "Failed to deploy contract.");
|
soltestAssert(deploy("", 0, bytes(), libraries), "Failed to deploy contract.");
|
||||||
constructed = true;
|
constructed = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (langutil::UnimplementedFeatureError const&)
|
||||||
|
{
|
||||||
|
// ignore unimplemented feature errors when forcibly trying to compile via yul.
|
||||||
|
if (!_compileViaYul || m_runWithYul)
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (langutil::Error const& _error)
|
||||||
|
{
|
||||||
|
// ignore unimplemented feature errors when forcibly trying to compile via yul.
|
||||||
|
if (_error.errorId() != 1834_error || !_compileViaYul || m_runWithYul)
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
if (test.call().kind == FunctionCall::Kind::Storage)
|
if (test.call().kind == FunctionCall::Kind::Storage)
|
||||||
{
|
{
|
||||||
@ -268,32 +283,6 @@ TestCase::TestResult SemanticTest::runTest(ostream& _stream, string const& _line
|
|||||||
<< _linePrefix << "Note that the test also has to pass via Yul." << endl;
|
<< _linePrefix << "Note that the test also has to pass via Yul." << endl;
|
||||||
return TestResult::Failure;
|
return TestResult::Failure;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (WhiskersError const&)
|
|
||||||
{
|
|
||||||
// this is an error in Whiskers template, so should be thrown anyway
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
catch (YulException const&)
|
|
||||||
{
|
|
||||||
// this should be an error in yul compilation or translation
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
catch (boost::exception const&)
|
|
||||||
{
|
|
||||||
if (!_compileViaYul || m_runWithYul)
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
catch (std::exception const&)
|
|
||||||
{
|
|
||||||
if (!_compileViaYul || m_runWithYul)
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
if (!_compileViaYul || m_runWithYul)
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TestResult::Success;
|
return TestResult::Success;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user