aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-10-07 23:32:05 +0800
committerchriseth <c@ethdev.com>2015-10-08 00:13:20 +0800
commit35de03626f4b3c9a29f14ad635151aed9642370d (patch)
treed8bc99b9e865814b9e41fdaa8306088e5479092c /test
parentab433c9a788bee31417a52d1574a2c8240004901 (diff)
downloaddexon-solidity-35de03626f4b3c9a29f14ad635151aed9642370d.tar
dexon-solidity-35de03626f4b3c9a29f14ad635151aed9642370d.tar.gz
dexon-solidity-35de03626f4b3c9a29f14ad635151aed9642370d.tar.bz2
dexon-solidity-35de03626f4b3c9a29f14ad635151aed9642370d.tar.lz
dexon-solidity-35de03626f4b3c9a29f14ad635151aed9642370d.tar.xz
dexon-solidity-35de03626f4b3c9a29f14ad635151aed9642370d.tar.zst
dexon-solidity-35de03626f4b3c9a29f14ad635151aed9642370d.zip
Check invalid integer constants for functions accepting arbitrary arguments.
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp15
1 files changed, 13 insertions, 2 deletions
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<Scanner>(CharStream(_source)));
- NameAndTypeResolver resolver({});
- resolver.registerDeclarations(*sourceUnit);
std::shared_ptr<GlobalContext> globalContext = make_shared<GlobalContext>();
+ NameAndTypeResolver resolver(globalContext->declarations());
+ resolver.registerDeclarations(*sourceUnit);
for (ASTPointer<ASTNode> const& node: sourceUnit->nodes())
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(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"(