From 35de03626f4b3c9a29f14ad635151aed9642370d Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 7 Oct 2015 17:32:05 +0200 Subject: Check invalid integer constants for functions accepting arbitrary arguments. --- test/libsolidity/SolidityNameAndTypeResolution.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 99fdf6d9..b55c92f0 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -54,9 +54,9 @@ parseAnalyseAndReturnError(string const& _source, bool _reportWarnings = false) try { sourceUnit = parser.parse(std::make_shared(CharStream(_source))); - NameAndTypeResolver resolver({}); - resolver.registerDeclarations(*sourceUnit); std::shared_ptr globalContext = make_shared(); + NameAndTypeResolver resolver(globalContext->declarations()); + resolver.registerDeclarations(*sourceUnit); for (ASTPointer const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast(node.get())) @@ -2366,6 +2366,17 @@ BOOST_AUTO_TEST_CASE(non_initialized_references) SOLIDITY_CHECK_ERROR_TYPE(parseAndAnalyseReturnError(text, true), Warning); } +BOOST_AUTO_TEST_CASE(sha3_with_large_integer_constant) +{ + char const* text = R"( + contract c + { + function f() { sha3(2**500); } + } + )"; + SOLIDITY_CHECK_ERROR_TYPE(parseAndAnalyseReturnError(text), TypeError); +} + BOOST_AUTO_TEST_CASE(cyclic_binary_dependency) { char const* text = R"( -- cgit v1.2.3