Allow duplicated constructor calls, if no arguments; support for multiple inheritance; backwards compatibility.

# tmp
This commit is contained in:
Daniel Kirchner
2018-04-09 15:26:05 +02:00
parent 4e037281ac
commit b8fdb666e2
10 changed files with 70 additions and 27 deletions
@@ -0,0 +1,3 @@
contract A { constructor() public { } }
contract B1 is A { constructor() A() public { } }
contract B2 is A { constructor() A public { } }
@@ -0,0 +1,9 @@
contract Base {
constructor(uint) public { }
}
contract Base1 is Base(3) {}
contract Derived is Base, Base1 {
constructor(uint i) Base(i) public {}
}
// ----
// Warning: Duplicated super constructor calls are deprecated.
@@ -0,0 +1,5 @@
contract A { constructor(uint) public { } }
contract B is A(2) { constructor() public { } }
contract C is B { constructor() A(3) public { } }
// ----
// Warning: Duplicated super constructor calls are deprecated.
@@ -0,0 +1,7 @@
pragma experimental "v0.5.0";
contract A { constructor(uint) public { } }
contract B is A(2) { constructor() public { } }
contract C is B { constructor() A(3) public { } }
// ----
// DeclarationError: Duplicated super constructor call.
@@ -1,4 +1,4 @@
contract A { constructor(uint) public { } }
contract B is A(2) { constructor() A(3) public { } }
// ----
// DeclarationError: Duplicated super constructor call.
// Warning: Duplicated super constructor calls are deprecated.
@@ -0,0 +1,6 @@
pragma experimental "v0.5.0";
contract A { constructor(uint) public { } }
contract B is A(2) { constructor() A(3) public { } }
// ----
// DeclarationError: Duplicated super constructor call.
@@ -1,4 +0,0 @@
contract A { constructor() public { } }
contract B is A { constructor() A() public { } }
// ----
// DeclarationError: Duplicated super constructor call.
@@ -0,0 +1,7 @@
contract C { constructor(uint) public {} }
contract A is C(2) {}
contract B is C(2) {}
contract D is A, B { constructor() C(3) public {} }
// ----
// Warning: Duplicated super constructor calls are deprecated.
// Warning: Duplicated super constructor calls are deprecated.