aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorFederico Bond <federicobond@gmail.com>2017-12-12 05:00:15 +0800
committerDaniel Kirchner <daniel@ekpyron.org>2018-04-09 17:22:35 +0800
commit4e037281acaf74c907f68e6227d6aa1b8847c78d (patch)
tree1317b5018a7b91d24578d16d1f6f6a2780c01771 /test/libsolidity
parentfe61435c273bf43ac1a20d8bc97b6935a54b7117 (diff)
downloaddexon-solidity-4e037281acaf74c907f68e6227d6aa1b8847c78d.tar.gz
dexon-solidity-4e037281acaf74c907f68e6227d6aa1b8847c78d.tar.zst
dexon-solidity-4e037281acaf74c907f68e6227d6aa1b8847c78d.zip
Error on duplicated super constructor calls
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp8
-rw-r--r--test/libsolidity/syntaxTests/inheritance/duplicated_super_constructor_call.sol4
-rw-r--r--test/libsolidity/syntaxTests/inheritance/duplicated_super_constructor_call_empty.sol4
3 files changed, 12 insertions, 4 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index beeae786..5ed53a2f 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -5191,7 +5191,7 @@ BOOST_AUTO_TEST_CASE(pass_dynamic_arguments_to_the_base)
}
uint public m_i;
}
- contract Derived is Base(2) {
+ contract Derived is Base {
function Derived(uint i) Base(i)
{}
}
@@ -5211,10 +5211,10 @@ BOOST_AUTO_TEST_CASE(pass_dynamic_arguments_to_the_base_base)
}
uint public m_i;
}
- contract Base1 is Base(3) {
+ contract Base1 is Base {
function Base1(uint k) Base(k*k) {}
}
- contract Derived is Base(3), Base1(2) {
+ contract Derived is Base, Base1 {
function Derived(uint i) Base(i) Base1(i)
{}
}
@@ -5235,7 +5235,7 @@ BOOST_AUTO_TEST_CASE(pass_dynamic_arguments_to_the_base_base_with_gap)
uint public m_i;
}
contract Base1 is Base(3) {}
- contract Derived is Base(2), Base1 {
+ contract Derived is Base, Base1 {
function Derived(uint i) Base(i) {}
}
contract Final is Derived(4) {
diff --git a/test/libsolidity/syntaxTests/inheritance/duplicated_super_constructor_call.sol b/test/libsolidity/syntaxTests/inheritance/duplicated_super_constructor_call.sol
new file mode 100644
index 00000000..95df1040
--- /dev/null
+++ b/test/libsolidity/syntaxTests/inheritance/duplicated_super_constructor_call.sol
@@ -0,0 +1,4 @@
+contract A { constructor(uint) public { } }
+contract B is A(2) { constructor() A(3) public { } }
+// ----
+// DeclarationError: Duplicated super constructor call.
diff --git a/test/libsolidity/syntaxTests/inheritance/duplicated_super_constructor_call_empty.sol b/test/libsolidity/syntaxTests/inheritance/duplicated_super_constructor_call_empty.sol
new file mode 100644
index 00000000..f8024ad6
--- /dev/null
+++ b/test/libsolidity/syntaxTests/inheritance/duplicated_super_constructor_call_empty.sol
@@ -0,0 +1,4 @@
+contract A { constructor() public { } }
+contract B is A { constructor() A() public { } }
+// ----
+// DeclarationError: Duplicated super constructor call.