aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityOptimizer.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2016-11-18 00:32:21 +0800
committerGitHub <noreply@github.com>2016-11-18 00:32:21 +0800
commitb46a14f4a8e128c08336763abf8bbf7c111f464d (patch)
treeee20fa35cbc19eddcddd1013e745b387e7371be3 /test/libsolidity/SolidityOptimizer.cpp
parentc811691861eb51520d9fd51d56770f14990b0320 (diff)
parent2c14a96820233809db4360b39f5f02039be5730a (diff)
downloaddexon-solidity-b46a14f4a8e128c08336763abf8bbf7c111f464d.tar
dexon-solidity-b46a14f4a8e128c08336763abf8bbf7c111f464d.tar.gz
dexon-solidity-b46a14f4a8e128c08336763abf8bbf7c111f464d.tar.bz2
dexon-solidity-b46a14f4a8e128c08336763abf8bbf7c111f464d.tar.lz
dexon-solidity-b46a14f4a8e128c08336763abf8bbf7c111f464d.tar.xz
dexon-solidity-b46a14f4a8e128c08336763abf8bbf7c111f464d.tar.zst
dexon-solidity-b46a14f4a8e128c08336763abf8bbf7c111f464d.zip
Merge pull request #1122 from ethereum/firstClassFunctions
Functions as first-class types.
Diffstat (limited to 'test/libsolidity/SolidityOptimizer.cpp')
-rw-r--r--test/libsolidity/SolidityOptimizer.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/test/libsolidity/SolidityOptimizer.cpp b/test/libsolidity/SolidityOptimizer.cpp
index 562b7859..4991cf24 100644
--- a/test/libsolidity/SolidityOptimizer.cpp
+++ b/test/libsolidity/SolidityOptimizer.cpp
@@ -365,16 +365,6 @@ BOOST_AUTO_TEST_CASE(store_tags_as_unions)
// BOOST_CHECK_EQUAL(2, numSHA3s);
}
-BOOST_AUTO_TEST_CASE(successor_not_found_bug)
-{
- // This bug was caused because MSVC chose to use the u256->bool conversion
- // instead of u256->unsigned
- char const* sourceCode = R"(
- contract greeter { function greeter() {} }
- )";
- compileBothVersions(sourceCode);
-}
-
BOOST_AUTO_TEST_CASE(incorrect_storage_access_bug)
{
// This bug appeared because a sha3 operation with too low sequence number was used,
@@ -1238,6 +1228,24 @@ BOOST_AUTO_TEST_CASE(inconsistency)
compareVersions("trigger()");
}
+BOOST_AUTO_TEST_CASE(dead_code_elimination_across_assemblies)
+{
+ // This tests that a runtime-function that is stored in storage in the constructor
+ // is not removed as part of dead code elimination.
+ char const* sourceCode = R"(
+ contract DCE {
+ function () internal returns (uint) stored;
+ function DCE() {
+ stored = f;
+ }
+ function f() internal returns (uint) { return 7; }
+ function test() returns (uint) { return stored(); }
+ }
+ )";
+ compileBothVersions(sourceCode);
+ compareVersions("test()");
+}
+
BOOST_AUTO_TEST_SUITE_END()
}