diff options
Diffstat (limited to 'test/libsolidity/syntaxTests/constructor')
8 files changed, 40 insertions, 31 deletions
diff --git a/test/libsolidity/syntaxTests/constructor/constructor_state_mutability_new.sol b/test/libsolidity/syntaxTests/constructor/constructor_state_mutability_new.sol index 78272c98..c247afb9 100644 --- a/test/libsolidity/syntaxTests/constructor/constructor_state_mutability_new.sol +++ b/test/libsolidity/syntaxTests/constructor/constructor_state_mutability_new.sol @@ -1,9 +1,13 @@ contract test1 { - constructor() view {} + constructor() public constant {} } contract test2 { - constructor() pure {} + constructor() public view {} +} +contract test3 { + constructor() public pure {} } // ---- -// TypeError: (19-40): Constructor must be payable or non-payable, but is "view". -// TypeError: (62-83): Constructor must be payable or non-payable, but is "pure". +// TypeError: (19-51): Constructor must be payable or non-payable, but is "view". +// TypeError: (73-101): Constructor must be payable or non-payable, but is "view". +// TypeError: (123-151): Constructor must be payable or non-payable, but is "pure". diff --git a/test/libsolidity/syntaxTests/constructor/constructor_state_mutability_old.sol b/test/libsolidity/syntaxTests/constructor/constructor_state_mutability_old.sol index 1ceaffee..1e3031ec 100644 --- a/test/libsolidity/syntaxTests/constructor/constructor_state_mutability_old.sol +++ b/test/libsolidity/syntaxTests/constructor/constructor_state_mutability_old.sol @@ -1,11 +1,16 @@ contract test1 { - function test1() view {} + function test1() public constant {} } contract test2 { - function test2() pure {} + function test2() public view {} +} +contract test3 { + function test3() public pure {} } // ---- -// Warning: (21-45): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. -// Warning: (69-93): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. -// TypeError: (21-45): Constructor must be payable or non-payable, but is "view". -// TypeError: (69-93): Constructor must be payable or non-payable, but is "pure". +// Warning: (21-56): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. +// Warning: (80-111): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. +// Warning: (135-166): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. +// TypeError: (21-56): Constructor must be payable or non-payable, but is "view". +// TypeError: (80-111): Constructor must be payable or non-payable, but is "view". +// TypeError: (135-166): Constructor must be payable or non-payable, but is "pure". diff --git a/test/libsolidity/syntaxTests/constructor/constructor_without_implementation_new.sol b/test/libsolidity/syntaxTests/constructor/constructor_without_implementation_new.sol index 5e619143..6bbb83ce 100644 --- a/test/libsolidity/syntaxTests/constructor/constructor_without_implementation_new.sol +++ b/test/libsolidity/syntaxTests/constructor/constructor_without_implementation_new.sol @@ -1,5 +1,5 @@ contract C { - constructor(); + constructor() public; } // ---- -// TypeError: (14-28): Constructor must be implemented if declared. +// TypeError: (14-35): Constructor must be implemented if declared. diff --git a/test/libsolidity/syntaxTests/constructor/constructor_without_implementation_old.sol b/test/libsolidity/syntaxTests/constructor/constructor_without_implementation_old.sol index 72458703..12bf6315 100644 --- a/test/libsolidity/syntaxTests/constructor/constructor_without_implementation_old.sol +++ b/test/libsolidity/syntaxTests/constructor/constructor_without_implementation_old.sol @@ -1,6 +1,6 @@ contract C { - function C(); + function C() public; } // ---- -// Warning: (14-27): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. -// TypeError: (14-27): Constructor must be implemented if declared. +// 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. diff --git a/test/libsolidity/syntaxTests/constructor/interface_constructor_new.sol b/test/libsolidity/syntaxTests/constructor/interface_constructor_new.sol index fa5d54c4..2cab1851 100644 --- a/test/libsolidity/syntaxTests/constructor/interface_constructor_new.sol +++ b/test/libsolidity/syntaxTests/constructor/interface_constructor_new.sol @@ -1,7 +1,7 @@ interface I { - constructor(); + constructor() public; } // ---- -// Warning: (15-29): Functions in interfaces should be declared external. -// TypeError: (15-29): Constructor cannot be defined in interfaces. -// TypeError: (15-29): Constructor must be implemented if declared. +// Warning: (15-36): Functions in interfaces should be declared external. +// TypeError: (15-36): Constructor cannot be defined in interfaces. +// TypeError: (15-36): Constructor must be implemented if declared. diff --git a/test/libsolidity/syntaxTests/constructor/interface_constructor_old.sol b/test/libsolidity/syntaxTests/constructor/interface_constructor_old.sol index ddf54977..313d4345 100644 --- a/test/libsolidity/syntaxTests/constructor/interface_constructor_old.sol +++ b/test/libsolidity/syntaxTests/constructor/interface_constructor_old.sol @@ -1,8 +1,8 @@ interface I { - function I(); + function I() public; } // ---- -// Warning: (15-28): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. -// Warning: (15-28): Functions in interfaces should be declared external. -// TypeError: (15-28): Constructor cannot be defined in interfaces. -// TypeError: (15-28): Constructor must be implemented if declared. +// Warning: (15-35): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. +// Warning: (15-35): Functions in interfaces should be declared external. +// TypeError: (15-35): Constructor cannot be defined in interfaces. +// TypeError: (15-35): Constructor must be implemented if declared. diff --git a/test/libsolidity/syntaxTests/constructor/library_constructor_new.sol b/test/libsolidity/syntaxTests/constructor/library_constructor_new.sol index 8db7e62a..38934f8d 100644 --- a/test/libsolidity/syntaxTests/constructor/library_constructor_new.sol +++ b/test/libsolidity/syntaxTests/constructor/library_constructor_new.sol @@ -1,6 +1,6 @@ library Lib { - constructor(); + constructor() public; } // ---- -// TypeError: (15-29): Constructor cannot be defined in libraries. -// TypeError: (15-29): Constructor must be implemented if declared. +// TypeError: (15-36): Constructor cannot be defined in libraries. +// TypeError: (15-36): Constructor must be implemented if declared. diff --git a/test/libsolidity/syntaxTests/constructor/library_constructor_old.sol b/test/libsolidity/syntaxTests/constructor/library_constructor_old.sol index d4499049..271cc790 100644 --- a/test/libsolidity/syntaxTests/constructor/library_constructor_old.sol +++ b/test/libsolidity/syntaxTests/constructor/library_constructor_old.sol @@ -1,7 +1,7 @@ library Lib { - function Lib(); + function Lib() public; } // ---- -// Warning: (15-30): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. -// TypeError: (15-30): Constructor cannot be defined in libraries. -// TypeError: (15-30): Constructor must be implemented if declared. +// 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. |