diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-06-26 19:18:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-26 19:18:33 +0800 |
commit | 751ba701bca0fbcae6d74cfdc23a4ac4a1c3dfab (patch) | |
tree | 28df091def23265dbc8a29ad3a256f8ae9bd51bc /test/libsolidity | |
parent | a0b0df2d98f7d4c60fe9fb9e79739c0c09b94365 (diff) | |
parent | c33d818a6835b247f41e0e003b3c063329bff862 (diff) | |
download | dexon-solidity-751ba701bca0fbcae6d74cfdc23a4ac4a1c3dfab.tar.gz dexon-solidity-751ba701bca0fbcae6d74cfdc23a4ac4a1c3dfab.tar.zst dexon-solidity-751ba701bca0fbcae6d74cfdc23a4ac4a1c3dfab.zip |
Merge pull request #2450 from ethereum/addressstring
Fix for strings treated as addresses.
Diffstat (limited to 'test/libsolidity')
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 1088b3d5..a6027812 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -5487,6 +5487,25 @@ BOOST_AUTO_TEST_CASE(invalid_address_length) CHECK_WARNING(text, "checksum"); } +BOOST_AUTO_TEST_CASE(address_test_for_bug_in_implementation) +{ + // A previous implementation claimed the string would be an address + char const* text = R"( + contract AddrString { + address public test = "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c"; + } + )"; + CHECK_ERROR(text, TypeError, "is not implicitly convertible to expected type address"); + text = R"( + contract AddrString { + function f() returns (address) { + return "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c"; + } + } + )"; + CHECK_ERROR(text, TypeError, "is not implicitly convertible to expected type"); +} + BOOST_AUTO_TEST_CASE(early_exit_on_fatal_errors) { // This tests a crash that occured because we did not stop for fatal errors. |