diff options
author | chriseth <chris@ethereum.org> | 2018-11-30 02:30:27 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-11-30 02:30:27 +0800 |
commit | 73a64da041efb2b64b1c89ed6012161cb278e24e (patch) | |
tree | 260f3b75dc04b3b684b4818a604bbb606a3a19f9 /test/libsolidity/SolidityEndToEndTest.cpp | |
parent | 124a8def845186ba55ee8566b05cc617554dbcbc (diff) | |
download | dexon-solidity-73a64da041efb2b64b1c89ed6012161cb278e24e.tar.gz dexon-solidity-73a64da041efb2b64b1c89ed6012161cb278e24e.tar.zst dexon-solidity-73a64da041efb2b64b1c89ed6012161cb278e24e.zip |
Fix bug related to state variables of function type accessed via base contract.
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 05bb7446..c6135a72 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -14213,6 +14213,26 @@ BOOST_AUTO_TEST_CASE(external_public_override) ABI_CHECK(callContractFunction("f()"), encodeArgs(2)); ABI_CHECK(callContractFunction("g()"), encodeArgs(2)); } + +BOOST_AUTO_TEST_CASE(base_access_to_function_type_variables) +{ + char const* sourceCode = R"( + contract C { + function () internal returns (uint) x; + function set() public { + C.x = g; + } + function g() public pure returns (uint) { return 2; } + function h() public returns (uint) { return C.x(); } + } + )"; + compileAndRun(sourceCode); + ABI_CHECK(callContractFunction("g()"), encodeArgs(2)); + ABI_CHECK(callContractFunction("h()"), encodeArgs()); + ABI_CHECK(callContractFunction("set()"), encodeArgs()); + ABI_CHECK(callContractFunction("h()"), encodeArgs(2)); +} + BOOST_AUTO_TEST_SUITE_END() } |