mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Adjusts syntax tests to new constructor syntax.
This commit is contained in:
		
							parent
							
								
									182a0a9551
								
							
						
					
					
						commit
						de6cd2425b
					
				| @ -1,9 +0,0 @@ | ||||
| contract C { | ||||
| 	function C() internal {} | ||||
| } | ||||
| contract D is C { | ||||
| 	function D() public {} | ||||
| } | ||||
| // ---- | ||||
| // Warning: (14-38): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. | ||||
| // Warning: (60-82): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. | ||||
| @ -1,3 +1,3 @@ | ||||
| contract A { function A() public {} } | ||||
| // ---- | ||||
| // Warning: (13-35): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. | ||||
| // SyntaxError: (13-35): Functions are not allowed to have the same name as the contract. If you intend this to be a constructor, use "constructor(...) { ... }" to define it. | ||||
|  | ||||
| @ -1,4 +0,0 @@ | ||||
| pragma experimental "v0.5.0"; | ||||
| contract A { function A() public {} } | ||||
| // ---- | ||||
| // SyntaxError: (43-65): Functions are not allowed to have the same name as the contract. If you intend this to be a constructor, use "constructor(...) { ... }" to define it. | ||||
| @ -1,11 +0,0 @@ | ||||
| contract test1 { | ||||
|     function test1() public view {} | ||||
| } | ||||
| contract test2 { | ||||
|     function test2() public pure {} | ||||
| } | ||||
| // ---- | ||||
| // Warning: (21-52): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. | ||||
| // Warning: (76-107): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. | ||||
| // TypeError: (21-52): Constructor must be payable or non-payable, but is "view". | ||||
| // TypeError: (76-107): Constructor must be payable or non-payable, but is "pure". | ||||
| @ -1,13 +0,0 @@ | ||||
| // The constructor of a base class should not be visible in the derived class | ||||
| contract A { function A(string memory s) public { } } | ||||
| contract B is A { | ||||
|   function f() pure public { | ||||
|     A x = A(0); // convert from address | ||||
|     string memory y = "ab"; | ||||
|     A(y); // call as a function is invalid | ||||
|     x; | ||||
|   } | ||||
| } | ||||
| // ---- | ||||
| // Warning: (91-129): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. | ||||
| // TypeError: (251-255): Explicit type conversion not allowed from "string memory" to "contract A". | ||||
| @ -1,6 +0,0 @@ | ||||
| contract C { | ||||
| 	function C() public; | ||||
| } | ||||
| // ---- | ||||
| // Warning: (14-34): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. | ||||
| // TypeError: (14-34): Constructor must be implemented if declared. | ||||
| @ -1,6 +0,0 @@ | ||||
| contract test { | ||||
| 	function test() external {} | ||||
| } | ||||
| // ---- | ||||
| // Warning: (17-44): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. | ||||
| // TypeError: (17-44): Constructor must be public or internal. | ||||
| @ -2,4 +2,4 @@ contract C { | ||||
|     function constructor() public; | ||||
| } | ||||
| // ---- | ||||
| // Warning: (17-47): This function is named "constructor" but is not the constructor of the contract. If you intend this to be a constructor, use "constructor(...) { ... }" without the "function" keyword to define it. | ||||
| // ParserError: (26-37): This function is named "constructor" but is not the constructor of the contract. If you intend this to be a constructor, use "constructor(...) { ... }" without the "function" keyword to define it. | ||||
|  | ||||
| @ -1,15 +0,0 @@ | ||||
| // Previously, the type information for A was not yet available at the point of | ||||
| // "new A". | ||||
| contract B { | ||||
| 	A a; | ||||
| 	function B() public { | ||||
| 		a = new A(this); | ||||
| 	} | ||||
| } | ||||
| contract A { | ||||
| 	function A(address a) internal {} | ||||
| } | ||||
| // ---- | ||||
| // Warning: (112-155): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. | ||||
| // Warning: (172-205): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. | ||||
| // TypeError: (140-145): Contract with internal constructor cannot be created directly. | ||||
| @ -1,9 +0,0 @@ | ||||
| contract C { | ||||
| 	function C() internal {} | ||||
| } | ||||
| contract D { | ||||
| 	function f() public { C x = new C(); x; } | ||||
| } | ||||
| // ---- | ||||
| // Warning: (14-38): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. | ||||
| // TypeError: (83-88): Contract with internal constructor cannot be created directly. | ||||
| @ -1,8 +0,0 @@ | ||||
| interface I { | ||||
| 	function I() public; | ||||
| } | ||||
| // ---- | ||||
| // Warning: (15-35): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. | ||||
| // TypeError: (15-35): Functions in interfaces must be declared external. | ||||
| // TypeError: (15-35): Constructor cannot be defined in interfaces. | ||||
| // TypeError: (15-35): Constructor must be implemented if declared. | ||||
| @ -1,7 +0,0 @@ | ||||
| library Lib { | ||||
| 	function Lib() public; | ||||
| } | ||||
| // ---- | ||||
| // Warning: (15-37): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. | ||||
| // TypeError: (15-37): Constructor cannot be defined in libraries. | ||||
| // TypeError: (15-37): Constructor must be implemented if declared. | ||||
| @ -4,7 +4,3 @@ contract C is A { function A() public pure returns (uint8) {} } | ||||
| contract D is B { function B() public pure returns (uint8) {} } | ||||
| contract E is D { function B() public pure returns (uint8) {} } | ||||
| // ---- | ||||
| // Warning: (57-100): This declaration shadows an existing declaration. | ||||
| // Warning: (121-164): This declaration shadows an existing declaration. | ||||
| // Warning: (185-228): This declaration shadows an existing declaration. | ||||
| // Warning: (249-292): This declaration shadows an existing declaration. | ||||
|  | ||||
| @ -1,6 +0,0 @@ | ||||
| contract test { | ||||
| 	function test() public returns (uint a) { } | ||||
| } | ||||
| // ---- | ||||
| // Warning: (17-60): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. | ||||
| // TypeError: (48-56): Non-empty "returns" directive for constructor. | ||||
| @ -1,7 +0,0 @@ | ||||
| contract test { | ||||
| 	function test(uint) public { } | ||||
| 	constructor() public {} | ||||
| } | ||||
| // ---- | ||||
| // Warning: (17-47): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. | ||||
| // DeclarationError: (49-72): More than one constructor defined. | ||||
| @ -1,8 +0,0 @@ | ||||
| contract test { | ||||
| 	function test(uint a) public { } | ||||
| 	function test() public {} | ||||
| } | ||||
| // ---- | ||||
| // Warning: (17-49): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. | ||||
| // Warning: (51-76): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. | ||||
| // DeclarationError: (51-76): More than one constructor defined. | ||||
| @ -5,4 +5,4 @@ contract C { | ||||
|     } | ||||
| } | ||||
| // ---- | ||||
| // ParserError: (118-119): Expected ';' but got identifier | ||||
| // ParserError: (104-115): Expected primary expression. | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user