diff --git a/test/libsolidity/syntaxTests/constructor/constructor_no_visibility.sol b/test/libsolidity/syntaxTests/constructor/constructor_no_visibility.sol new file mode 100644 index 000000000..df67c9fae --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/constructor_no_visibility.sol @@ -0,0 +1,2 @@ +contract A { constructor() public {} } +// ---- diff --git a/test/libsolidity/syntaxTests/constructor/constructor_no_visibility_050.sol b/test/libsolidity/syntaxTests/constructor/constructor_no_visibility_050.sol new file mode 100644 index 000000000..0f57a41fb --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/constructor_no_visibility_050.sol @@ -0,0 +1,4 @@ +pragma experimental "v0.5.0"; +contract A { constructor() {} } +// ---- +// SyntaxError: (43-59): No visibility specified. diff --git a/test/libsolidity/syntaxTests/constructor/overriding_constructor.sol b/test/libsolidity/syntaxTests/constructor/overriding_constructor.sol index 3290a33b3..5fb3a189c 100644 --- a/test/libsolidity/syntaxTests/constructor/overriding_constructor.sol +++ b/test/libsolidity/syntaxTests/constructor/overriding_constructor.sol @@ -1,6 +1,10 @@ -// It is fine to "override" constructor of a base class since it is invisible -contract A { function A() public { } } +contract A { constructor() public {} } contract B is A { function A() public pure returns (uint8) {} } +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: (91-114): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. -// Warning: (135-178): This declaration shadows an existing declaration. +// 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. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/061_missing_base_constructor_arguments.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/061_missing_base_constructor_arguments.sol index 0ac48ecf9..8ebb46aa2 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/061_missing_base_constructor_arguments.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/061_missing_base_constructor_arguments.sol @@ -1,5 +1,4 @@ -contract A { function A(uint a) public { } } +contract A { constructor(uint a) public { } } contract B is A { } // ---- -// Warning: (13-42): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. -// Warning: (24-30): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning: (25-31): Unused function parameter. Remove or comment out the variable name to silence this warning. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/062_base_constructor_arguments_override.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/062_base_constructor_arguments_override.sol index 0ac48ecf9..8ebb46aa2 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/062_base_constructor_arguments_override.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/062_base_constructor_arguments_override.sol @@ -1,5 +1,4 @@ -contract A { function A(uint a) public { } } +contract A { constructor(uint a) public { } } contract B is A { } // ---- -// Warning: (13-42): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. -// Warning: (24-30): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning: (25-31): Unused function parameter. Remove or comment out the variable name to silence this warning. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/110_no_overflow_with_large_literal.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/110_no_overflow_with_large_literal.sol index c3399ddff..9b36fa70b 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/110_no_overflow_with_large_literal.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/110_no_overflow_with_large_literal.sol @@ -1,8 +1,7 @@ contract c { - function c () public { + constructor() public { a = 115792089237316195423570985008687907853269984665640564039458; } uint256 a; } // ---- -// Warning: (17-119): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/111_overflow_caused_by_ether_units.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/111_overflow_caused_by_ether_units.sol index 88dc1a314..dc4cab8af 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/111_overflow_caused_by_ether_units.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/111_overflow_caused_by_ether_units.sol @@ -1,9 +1,8 @@ contract c { - function c () public { + constructor() public { a = 115792089237316195423570985008687907853269984665640564039458 ether; } uint256 a; } // ---- -// Warning: (17-125): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. // TypeError: (52-118): Type int_const 1157...(70 digits omitted)...0000 is not implicitly convertible to expected type uint256. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/124_enum_member_access.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/124_enum_member_access.sol index c428bea7c..3fd7a0cba 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/124_enum_member_access.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/124_enum_member_access.sol @@ -1,11 +1,10 @@ contract test { enum ActionChoices { GoLeft, GoRight, GoStraight, Sit } - function test() + constructor() { choices = ActionChoices.GoStraight; } ActionChoices choices; } // ---- -// Warning: (80-151): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. -// Warning: (80-151): No visibility specified. Defaulting to "public". +// Warning: (80-149): No visibility specified. Defaulting to "public". diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/126_enum_invalid_member_access.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/126_enum_invalid_member_access.sol index 32df613ef..079bf0c8a 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/126_enum_invalid_member_access.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/126_enum_invalid_member_access.sol @@ -1,10 +1,9 @@ contract test { enum ActionChoices { GoLeft, GoRight, GoStraight, Sit } - function test() public { + constructor() public { choices = ActionChoices.RunAroundWavingYourHands; } ActionChoices choices; } // ---- -// Warning: (80-168): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. -// TypeError: (123-161): Member "RunAroundWavingYourHands" not found or not visible after argument-dependent lookup in type(enum test.ActionChoices) +// TypeError: (121-159): Member "RunAroundWavingYourHands" not found or not visible after argument-dependent lookup in type(enum test.ActionChoices) diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/127_enum_invalid_direct_member_access.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/127_enum_invalid_direct_member_access.sol index f5bd888ae..68510a0a9 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/127_enum_invalid_direct_member_access.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/127_enum_invalid_direct_member_access.sol @@ -1,10 +1,9 @@ contract test { enum ActionChoices { GoLeft, GoRight, GoStraight, Sit } - function test() public { + constructor() public { choices = Sit; } ActionChoices choices; } // ---- -// Warning: (80-133): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. -// DeclarationError: (123-126): Undeclared identifier. +// DeclarationError: (121-124): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/128_enum_explicit_conversion_is_okay.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/128_enum_explicit_conversion_is_okay.sol index ed6a1d041..0948d5505 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/128_enum_explicit_conversion_is_okay.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/128_enum_explicit_conversion_is_okay.sol @@ -1,6 +1,6 @@ contract test { enum ActionChoices { GoLeft, GoRight, GoStraight, Sit } - function test() public { + constructor() public { a = uint256(ActionChoices.GoStraight); b = uint64(ActionChoices.Sit); } @@ -8,4 +8,3 @@ contract test { uint64 b; } // ---- -// Warning: (80-196): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/129_int_to_enum_explicit_conversion_is_okay.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/129_int_to_enum_explicit_conversion_is_okay.sol index 2f3a4cdc8..2639decf5 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/129_int_to_enum_explicit_conversion_is_okay.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/129_int_to_enum_explicit_conversion_is_okay.sol @@ -1,6 +1,6 @@ contract test { enum ActionChoices { GoLeft, GoRight, GoStraight, Sit } - function test() public { + constructor() public { a = 2; b = ActionChoices(a); } @@ -8,4 +8,3 @@ contract test { ActionChoices b; } // ---- -// Warning: (80-155): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/130_enum_implicit_conversion_is_not_okay_256.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/130_enum_implicit_conversion_is_not_okay_256.sol index 359deba58..01c5e93fc 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/130_enum_implicit_conversion_is_not_okay_256.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/130_enum_implicit_conversion_is_not_okay_256.sol @@ -1,10 +1,9 @@ contract test { enum ActionChoices { GoLeft, GoRight, GoStraight, Sit } - function test() public { + constructor() public { a = ActionChoices.GoStraight; } uint256 a; } // ---- -// Warning: (80-148): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. -// TypeError: (117-141): Type enum test.ActionChoices is not implicitly convertible to expected type uint256. +// TypeError: (115-139): Type enum test.ActionChoices is not implicitly convertible to expected type uint256. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/131_enum_implicit_conversion_is_not_okay_64.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/131_enum_implicit_conversion_is_not_okay_64.sol index af02b2db1..4e21b9aad 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/131_enum_implicit_conversion_is_not_okay_64.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/131_enum_implicit_conversion_is_not_okay_64.sol @@ -1,10 +1,9 @@ contract test { enum ActionChoices { GoLeft, GoRight, GoStraight, Sit } - function test() public { + constructor() public { b = ActionChoices.Sit; } uint64 b; } // ---- -// Warning: (80-141): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. -// TypeError: (117-134): Type enum test.ActionChoices is not implicitly convertible to expected type uint64. +// TypeError: (115-132): Type enum test.ActionChoices is not implicitly convertible to expected type uint64. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/132_enum_to_enum_conversion_is_not_okay.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/132_enum_to_enum_conversion_is_not_okay.sol index 054cb34f6..5b9ba813a 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/132_enum_to_enum_conversion_is_not_okay.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/132_enum_to_enum_conversion_is_not_okay.sol @@ -1,10 +1,9 @@ contract test { enum Paper { Up, Down, Left, Right } enum Ground { North, South, West, East } - function test() public { + constructor() public { Ground(Paper.Up); } } // ---- -// Warning: (106-162): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. -// TypeError: (139-155): Explicit type conversion not allowed from "enum test.Paper" to "enum test.Ground". +// TypeError: (137-153): Explicit type conversion not allowed from "enum test.Paper" to "enum test.Ground". diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/363_non_payable_constructor.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/363_non_payable_constructor.sol index 5a6b7b11f..4cd1fcae7 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/363_non_payable_constructor.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/363_non_payable_constructor.sol @@ -1,5 +1,5 @@ contract C { - function C() { } + constructor() { } } contract D { function f() public returns (uint) { @@ -8,5 +8,4 @@ contract D { } } // ---- -// Warning: (17-33): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. -// TypeError: (98-111): Member "value" not found or not visible after argument-dependent lookup in function () returns (contract C) - did you forget the "payable" modifier? +// TypeError: (99-112): Member "value" not found or not visible after argument-dependent lookup in function () returns (contract C) - did you forget the "payable" modifier? diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/366_invalid_array_as_statement.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/366_invalid_array_as_statement.sol index 150ba9ca7..cc2839cd2 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/366_invalid_array_as_statement.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/366_invalid_array_as_statement.sol @@ -1,7 +1,6 @@ contract test { struct S { uint x; } - function test(uint k) public { S[k]; } + constructor(uint k) public { S[k]; } } // ---- -// Warning: (45-83): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. -// TypeError: (78-79): Integer constant expected. +// TypeError: (76-77): Integer constant expected. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/462_callable_crash.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/462_callable_crash.sol index 94e81de60..188d00e0f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/462_callable_crash.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/462_callable_crash.sol @@ -1,10 +1,9 @@ contract C { struct S { uint a; bool x; } S public s; - function C() public { + constructor() public { 3({a: 1, x: true}); } } // ---- -// Warning: (66-121): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. -// TypeError: (96-114): Type is not callable +// TypeError: (97-115): Type is not callable diff --git a/test/libsolidity/syntaxTests/parsing/enum_valid_declaration.sol b/test/libsolidity/syntaxTests/parsing/enum_valid_declaration.sol index 4c4a1217e..602c26ed3 100644 --- a/test/libsolidity/syntaxTests/parsing/enum_valid_declaration.sol +++ b/test/libsolidity/syntaxTests/parsing/enum_valid_declaration.sol @@ -1,10 +1,9 @@ contract c { enum validEnum { Value1, Value2, Value3, Value4 } - function c() { + constructor() { a = validEnum.Value3; } validEnum a; } // ---- -// Warning: (71-121): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. -// Warning: (71-121): No visibility specified. Defaulting to "public". +// Warning: (71-122): No visibility specified. Defaulting to "public". diff --git a/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations_in_expressions.sol b/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations_in_expressions.sol index d2cdc8753..e0f49fbf2 100644 --- a/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations_in_expressions.sol +++ b/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations_in_expressions.sol @@ -1,10 +1,9 @@ contract c { - function c () + constructor() { a = 1 wei * 100 wei + 7 szabo - 3; } uint256 a; } // ---- -// Warning: (17-86): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. // Warning: (17-86): No visibility specified. Defaulting to "public".