aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorFederico Bond <federicobond@gmail.com>2018-01-04 18:24:39 +0800
committerchriseth <chris@ethereum.org>2018-01-04 18:24:39 +0800
commita0771691ff1a8ea8b2dda07ff50e48fc81a2a705 (patch)
treee7ffc52054042274dceb8702f609d1a448173cac /test/libsolidity
parentfdbe78a7693aef51a69ec4399de4f9b919ae1675 (diff)
downloaddexon-solidity-a0771691ff1a8ea8b2dda07ff50e48fc81a2a705.tar.gz
dexon-solidity-a0771691ff1a8ea8b2dda07ff50e48fc81a2a705.tar.zst
dexon-solidity-a0771691ff1a8ea8b2dda07ff50e48fc81a2a705.zip
Improve error message for wrong struct initialization (#3359)
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index 8f58dcb1..eb6a440e 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -3608,6 +3608,20 @@ BOOST_AUTO_TEST_CASE(invalid_args_creating_memory_array)
CHECK_ERROR(text, TypeError, "Wrong argument count for function call: 0 arguments given but expected 1.");
}
+BOOST_AUTO_TEST_CASE(invalid_args_creating_struct)
+{
+ char const* text = R"(
+ contract C {
+ struct S { uint a; uint b; }
+
+ function f() public {
+ var s = S({a: 1});
+ }
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "Wrong argument count for struct constructor: 1 arguments given but expected 2.");
+}
+
BOOST_AUTO_TEST_CASE(function_overload_array_type)
{
char const* text = R"(