aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-09-20 18:14:28 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-09-28 20:57:19 +0800
commit7cb4d714c7e058ab764b14575fc32078a0343fbc (patch)
treecba3bf5b6393316dd39287b0173f7c989d050023 /test/libsolidity/SolidityEndToEndTest.cpp
parent010189d58eca560dd319aab07daa43bda0911a40 (diff)
downloaddexon-solidity-7cb4d714c7e058ab764b14575fc32078a0343fbc.tar.gz
dexon-solidity-7cb4d714c7e058ab764b14575fc32078a0343fbc.tar.zst
dexon-solidity-7cb4d714c7e058ab764b14575fc32078a0343fbc.zip
Fix overload resolution when conflict is with members of address (balance, transfer, etc)
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index df9332c4..35916ec7 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -10151,6 +10151,31 @@ BOOST_AUTO_TEST_CASE(constant_string)
ABI_CHECK(callContractFunction("h()"), encodeDyn(string("hello")));
}
+BOOST_AUTO_TEST_CASE(address_overload_resolution)
+{
+ char const* sourceCode = R"(
+ contract C {
+ function balance() returns (uint) {
+ return 1;
+ }
+ function transfer(uint amount) returns (uint) {
+ return amount;
+ }
+ }
+ contract D {
+ function f() returns (uint) {
+ return (new C()).balance();
+ }
+ function g() returns (uint) {
+ return (new C()).transfer(5);
+ }
+ }
+ )";
+ compileAndRun(sourceCode, 0, "D");
+ BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(1)));
+ BOOST_CHECK(callContractFunction("g()") == encodeArgs(u256(5)));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}