From 7c258873bd3ac21ce2f23ab1682a96953c364a94 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 4 Nov 2019 14:33:33 +0100 Subject: [PATCH] Add some more abstract keywords in test to make sure the correct property is tested. --- docs/050-breaking-changes.rst | 3 ++- docs/060-breaking-changes.rst | 5 ++++ test/libsolidity/SolidityEndToEndTest.cpp | 2 +- .../functions/functions_external_1.sol | 4 ++-- .../functions/functions_external_2.sol | 4 ++-- .../functions/functions_external_3.sol | 4 ++-- .../storageReturn/unimplemented_internal.sol | 3 +-- ...ation_specifier_test_external_calldata.sol | 3 +-- ...ocation_specifier_test_internal_memory.sol | 3 +-- ...cation_specifier_test_internal_storage.sol | 3 +-- ..._location_specifier_test_public_memory.sol | 3 +-- ...t_internal_function_by_public_variable.sol | 5 ++-- ...nt_private_function_by_public_variable.sol | 3 +-- ...ent_public_function_by_public_variable.sol | 5 ++-- .../inheritance/override/override.sol | 6 ++--- .../override/override_ambiguous.sol | 11 ++++----- .../override/override_base_base.sol | 15 ++++-------- .../override/override_multiple.sol | 15 ++++-------- .../override/override_multiple2.sol | 12 ++++------ .../override/override_multiple_duplicated.sol | 23 ++++++++----------- .../override/override_multiple_missing.sol | 19 ++++++--------- .../override/override_return_mismatch.sol | 11 ++++----- .../override/override_type_mismatch.sol | 17 ++++++-------- .../metaTypes/codeAccessAbstractCreation.sol | 3 +-- .../metaTypes/codeAccessAbstractRuntime.sol | 3 +-- ..._on_abstract_functions_no_parser_error.sol | 7 +++--- .../differentNumberOfComponentsFromReturn.sol | 19 ++++++++------- .../disallowWildcardsFromReturn.sol | 23 +++++++++---------- ...lemented_abstract_function_as_abstract.sol | 7 +++--- .../268_function_overload_array_type.sol | 3 +-- .../424_using_interface_complex.sol | 3 +-- ...6_no_unused_warning_abstract_arguments.sol | 3 +-- ...members_that_look_like_address_members.sol | 3 +-- .../natspec/docstring_empty_description.sol | 3 +-- .../natspec/docstring_empty_tag.sol | 3 +-- .../syntaxTests/parsing/function_no_body.sol | 3 +-- .../function_parameter_return_types_fail.sol | 17 +++++++------- .../unimplemented_super_function.sol | 5 ++-- .../unimplemented_super_function_derived.sol | 5 ++-- .../interface_contract_function_default.sol | 5 ++-- 40 files changed, 120 insertions(+), 174 deletions(-) diff --git a/docs/050-breaking-changes.rst b/docs/050-breaking-changes.rst index fd201d77c..fa9540917 100644 --- a/docs/050-breaking-changes.rst +++ b/docs/050-breaking-changes.rst @@ -345,7 +345,8 @@ commandline compiler for linking): :: - pragma solidity >=0.5.0 <0.7.0; + // This will not compile with 0.6.0 anymore. + pragma solidity >=0.5.0 <0.5.99; library OldLibrary { function someFunction(uint8 a) public returns(bool); diff --git a/docs/060-breaking-changes.rst b/docs/060-breaking-changes.rst index ec1526690..0ee96920f 100644 --- a/docs/060-breaking-changes.rst +++ b/docs/060-breaking-changes.rst @@ -21,6 +21,11 @@ This section lists purely syntactic changes that do not affect the behavior of e * Function ``push(value)`` for dynamic storage arrays do not return the new length anymore. +* The new keyword ``abstract`` can be used to mark contracts as abstract. It has to be used + if a contract does not implement all its functions. + +* Libraries have to implement all their functions, not only the internal ones. + * New reserved keywords: ``virtual``. Semantic Only Changes diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 9a4517699..252a60052 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -8538,7 +8538,7 @@ BOOST_AUTO_TEST_CASE(using_library_mappings_external) )"; char const* sourceCode = R"( library Lib { - function set(mapping(uint => uint) storage m, uint key, uint value) external; + function set(mapping(uint => uint) storage m, uint key, uint value) external {} } contract Test { mapping(uint => uint) m1; diff --git a/test/libsolidity/smtCheckerTests/functions/functions_external_1.sol b/test/libsolidity/smtCheckerTests/functions/functions_external_1.sol index ecfc9bbb5..a0eccf3cf 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_external_1.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_external_1.sol @@ -1,6 +1,6 @@ pragma experimental SMTChecker; -contract D +abstract contract D { function g(uint x) public; } @@ -17,4 +17,4 @@ contract C } } // ---- -// TypeError: (33-75): Contract "D" should be marked as abstract. +// Warning: (249-263): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_external_2.sol b/test/libsolidity/smtCheckerTests/functions/functions_external_2.sol index 98bb94457..60795ca7f 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_external_2.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_external_2.sol @@ -1,6 +1,6 @@ pragma experimental SMTChecker; -contract D +abstract contract D { function g(uint x) public; } @@ -17,4 +17,4 @@ contract C } } // ---- -// TypeError: (33-75): Contract "D" should be marked as abstract. +// Warning: (289-313): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/functions/functions_external_3.sol b/test/libsolidity/smtCheckerTests/functions/functions_external_3.sol index b33496642..43745155d 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_external_3.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_external_3.sol @@ -1,6 +1,6 @@ pragma experimental SMTChecker; -contract D +abstract contract D { function g(uint x) public; } @@ -18,4 +18,4 @@ contract C } } // ---- -// TypeError: (33-75): Contract "D" should be marked as abstract. +// Warning: (347-371): Assertion violation happens here diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/unimplemented_internal.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/unimplemented_internal.sol index 21c2a9bff..70cd3fcad 100644 --- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/unimplemented_internal.sol +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/unimplemented_internal.sol @@ -1,6 +1,5 @@ -contract C { +abstract contract C { function f() internal returns(uint[] storage); function g() internal returns(uint[] storage s); } // ---- -// TypeError: (0-118): Contract "C" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_calldata.sol b/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_calldata.sol index b1731a931..cf5839d38 100644 --- a/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_calldata.sol +++ b/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_calldata.sol @@ -1,5 +1,4 @@ -contract test { +abstract contract test { function f(bytes calldata) external; } // ---- -// TypeError: (0-58): Contract "test" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_memory.sol b/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_memory.sol index 65c0563ba..0f1b642cc 100644 --- a/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_memory.sol +++ b/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_memory.sol @@ -1,5 +1,4 @@ -contract test { +abstract contract test { function f(bytes memory) internal; } // ---- -// TypeError: (0-56): Contract "test" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_storage.sol b/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_storage.sol index 9b9a10ea7..fdc07a452 100644 --- a/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_storage.sol +++ b/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_storage.sol @@ -1,5 +1,4 @@ -contract test { +abstract contract test { function f(bytes storage) internal; } // ---- -// TypeError: (0-57): Contract "test" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_memory.sol b/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_memory.sol index ef3fcc0e1..3535d3d97 100644 --- a/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_memory.sol +++ b/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_memory.sol @@ -1,5 +1,4 @@ -contract test { +abstract contract test { function f(bytes memory) public; } // ---- -// TypeError: (0-54): Contract "test" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/inheritance/override/implement_internal_function_by_public_variable.sol b/test/libsolidity/syntaxTests/inheritance/override/implement_internal_function_by_public_variable.sol index 0400b3e53..15b1288b8 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/implement_internal_function_by_public_variable.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/implement_internal_function_by_public_variable.sol @@ -1,4 +1,4 @@ -contract X { function test() internal returns (uint256); } +abstract contract X { function test() internal returns (uint256); } contract Y is X { uint256 public test = 42; } @@ -6,5 +6,4 @@ contract T { constructor() public { new Y(); } } // ---- -// DeclarationError: (81-105): Identifier already declared. -// TypeError: (0-58): Contract "X" should be marked as abstract. +// DeclarationError: (90-114): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/inheritance/override/implement_private_function_by_public_variable.sol b/test/libsolidity/syntaxTests/inheritance/override/implement_private_function_by_public_variable.sol index 5f07af971..979f84f23 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/implement_private_function_by_public_variable.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/implement_private_function_by_public_variable.sol @@ -1,4 +1,4 @@ -contract X { function test() private returns (uint256); } +abstract contract X { function test() private returns (uint256); } contract Y is X { uint256 public test = 42; } @@ -6,4 +6,3 @@ contract T { constructor() public { new Y(); } } // ---- -// TypeError: (0-57): Contract "X" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/inheritance/override/implement_public_function_by_public_variable.sol b/test/libsolidity/syntaxTests/inheritance/override/implement_public_function_by_public_variable.sol index e6613edb7..f70f7608d 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/implement_public_function_by_public_variable.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/implement_public_function_by_public_variable.sol @@ -1,4 +1,4 @@ -contract X { function test() public returns (uint256); } +abstract contract X { function test() public returns (uint256); } contract Y is X { uint256 public test = 42; } @@ -6,5 +6,4 @@ contract T { constructor() public { new Y(); } } // ---- -// DeclarationError: (79-103): Identifier already declared. -// TypeError: (0-56): Contract "X" should be marked as abstract. +// DeclarationError: (88-112): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/inheritance/override/override.sol b/test/libsolidity/syntaxTests/inheritance/override/override.sol index 94df57e9e..c33604ce6 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override.sol @@ -1,13 +1,11 @@ -contract A { +abstract contract A { int public testvar; function test() internal returns (uint256); function test2() internal returns (uint256); } -contract X is A { +abstract contract X is A { int public override testvar; function test() internal override returns (uint256); function test2() internal override(A) returns (uint256); } // ---- -// TypeError: (0-126): Contract "A" should be marked as abstract. -// TypeError: (127-288): Contract "X" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_ambiguous.sol b/test/libsolidity/syntaxTests/inheritance/override/override_ambiguous.sol index 0ac03fe6f..af0995dd7 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_ambiguous.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_ambiguous.sol @@ -1,17 +1,14 @@ -contract A { +abstract contract A { int public testvar; function foo() internal returns (uint256); } -contract B { +abstract contract B { function foo() internal returns (uint256); function test() internal returns (uint256); } -contract X is A, B { +abstract contract X is A, B { int public override testvar; function test() internal override returns (uint256); } // ---- -// TypeError: (0-79): Contract "A" should be marked as abstract. -// TypeError: (80-183): Contract "B" should be marked as abstract. -// TypeError: (184-290): Derived contract must override function "foo". Function with the same name and parameter types defined in two or more base classes. -// TypeError: (184-290): Contract "X" should be marked as abstract. +// TypeError: (202-317): Derived contract must override function "foo". Function with the same name and parameter types defined in two or more base classes. diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_base_base.sol b/test/libsolidity/syntaxTests/inheritance/override/override_base_base.sol index 97c68cca8..8d1ecc90a 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_base_base.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_base_base.sol @@ -1,25 +1,20 @@ -contract A { +abstract contract A { function foo() internal returns (uint256); } -contract B is A { +abstract contract B is A { function foo() internal override returns (uint256); } -contract C is B { +abstract contract C is B { function foo() internal override returns (uint256); } -contract D is C { +abstract contract D is C { function foo() internal override returns (uint256); } -contract X is D { +abstract contract X is D { function foo() internal override returns (uint256); } // ---- -// TypeError: (0-58): Contract "A" should be marked as abstract. -// TypeError: (60-132): Contract "B" should be marked as abstract. -// TypeError: (134-206): Contract "C" should be marked as abstract. -// TypeError: (208-280): Contract "D" should be marked as abstract. -// TypeError: (282-354): Contract "X" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_multiple.sol b/test/libsolidity/syntaxTests/inheritance/override/override_multiple.sol index b3b8252a8..8544db3f0 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_multiple.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_multiple.sol @@ -1,26 +1,21 @@ -contract A { +abstract contract A { int public testvar; function foo() internal returns (uint256); function test(uint8 _a) internal returns (uint256); } -contract B { +abstract contract B { function foo() internal returns (uint256); function test() internal returns (uint256); } -contract C { +abstract contract C { function foo() internal returns (uint256); } -contract D { +abstract contract D { function foo() internal returns (uint256); } -contract X is A, B, C, D { +abstract contract X is A, B, C, D { int public override testvar; function test() internal override returns (uint256); function foo() internal override(A, B, C, D) returns (uint256); } // ---- -// TypeError: (0-132): Contract "A" should be marked as abstract. -// TypeError: (133-236): Contract "B" should be marked as abstract. -// TypeError: (237-295): Contract "C" should be marked as abstract. -// TypeError: (296-354): Contract "D" should be marked as abstract. -// TypeError: (355-532): Contract "X" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_multiple2.sol b/test/libsolidity/syntaxTests/inheritance/override/override_multiple2.sol index fdf4f96d0..eb3e16f4a 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_multiple2.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_multiple2.sol @@ -1,19 +1,15 @@ -contract A { +abstract contract A { int public testvar; function foo() internal returns (uint256); function test(uint8 _a) internal returns (uint256); } -contract B { +abstract contract B { function foo() internal returns (uint256); } -contract C is A { +abstract contract C is A { } -contract D is A, B, C { +abstract contract D is A, B, C { function foo() internal override(A, B) returns (uint256); } // ---- -// TypeError: (0-132): Contract "A" should be marked as abstract. -// TypeError: (133-191): Contract "B" should be marked as abstract. -// TypeError: (193-212): Contract "C" should be marked as abstract. -// TypeError: (213-297): Contract "D" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_multiple_duplicated.sol b/test/libsolidity/syntaxTests/inheritance/override/override_multiple_duplicated.sol index bf65c2d0c..e9c82d3a2 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_multiple_duplicated.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_multiple_duplicated.sol @@ -1,31 +1,26 @@ -contract A { +abstract contract A { int public testvar; function foo() internal returns (uint256); function test(uint8 _a) internal returns (uint256); } -contract B { +abstract contract B { function foo() internal returns (uint256); function test() internal returns (uint256); } -contract C { +abstract contract C { function foo() internal returns (uint256); } -contract D { +abstract contract D { function foo() internal returns (uint256); function test() internal returns (uint256); } -contract X is A, B, C, D { +abstract contract X is A, B, C, D { int public override testvar; function test() internal override(B, D, D) returns (uint256); function foo() internal override(A, C, B, B, B, D ,D) returns (uint256); } // ---- -// TypeError: (0-132): Contract "A" should be marked as abstract. -// TypeError: (133-236): Contract "B" should be marked as abstract. -// TypeError: (237-295): Contract "C" should be marked as abstract. -// TypeError: (296-399): Contract "D" should be marked as abstract. -// TypeError: (498-499): Duplicate contract "D" found in override list of "test". -// TypeError: (563-564): Duplicate contract "B" found in override list of "foo". -// TypeError: (566-567): Duplicate contract "B" found in override list of "foo". -// TypeError: (572-573): Duplicate contract "D" found in override list of "foo". -// TypeError: (400-595): Contract "X" should be marked as abstract. +// TypeError: (543-544): Duplicate contract "D" found in override list of "test". +// TypeError: (608-609): Duplicate contract "B" found in override list of "foo". +// TypeError: (611-612): Duplicate contract "B" found in override list of "foo". +// TypeError: (617-618): Duplicate contract "D" found in override list of "foo". diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_multiple_missing.sol b/test/libsolidity/syntaxTests/inheritance/override/override_multiple_missing.sol index 8905a5209..34085df86 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_multiple_missing.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_multiple_missing.sol @@ -1,29 +1,24 @@ -contract A { +abstract contract A { int public testvar; function foo() internal returns (uint256); function test(uint8 _a) internal returns (uint256); } -contract B { +abstract contract B { function foo() internal returns (uint256); function test() internal returns (uint256); } -contract C { +abstract contract C { function foo() internal returns (uint256); } -contract D { +abstract contract D { function foo() internal returns (uint256); function test() internal returns (uint256); } -contract X is A, B, C, D { +abstract contract X is A, B, C, D { int public override testvar; function test() internal override(B, D, C) returns (uint256); function foo() internal override(A, C) returns (uint256); } // ---- -// TypeError: (0-132): Contract "A" should be marked as abstract. -// TypeError: (133-236): Contract "B" should be marked as abstract. -// TypeError: (237-295): Contract "C" should be marked as abstract. -// TypeError: (296-399): Contract "D" should be marked as abstract. -// TypeError: (483-500): Invalid contract specified in override list: C. -// TypeError: (545-559): Function needs to specify overridden contracts B and D. -// TypeError: (400-580): Contract "X" should be marked as abstract. +// TypeError: (528-545): Invalid contract specified in override list: C. +// TypeError: (590-604): Function needs to specify overridden contracts B and D. diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_return_mismatch.sol b/test/libsolidity/syntaxTests/inheritance/override/override_return_mismatch.sol index 3fc8789e2..8765a03c8 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_return_mismatch.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_return_mismatch.sol @@ -1,17 +1,14 @@ -contract A { +abstract contract A { int public testvar; function foo() internal returns (uint256); } -contract B { +abstract contract B { function foo() internal returns (uint8); function test() internal returns (uint256); } -contract X is A, B { +abstract contract X is A, B { int public override testvar; function test() internal override returns (uint256); } // ---- -// TypeError: (0-79): Contract "A" should be marked as abstract. -// TypeError: (80-181): Contract "B" should be marked as abstract. -// TypeError: (182-288): Derived contract must override function "foo". Function with the same name and parameter types defined in two or more base classes. -// TypeError: (182-288): Contract "X" should be marked as abstract. +// TypeError: (200-315): Derived contract must override function "foo". Function with the same name and parameter types defined in two or more base classes. diff --git a/test/libsolidity/syntaxTests/inheritance/override/override_type_mismatch.sol b/test/libsolidity/syntaxTests/inheritance/override/override_type_mismatch.sol index 6d9aef306..b5d3ada81 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/override_type_mismatch.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/override_type_mismatch.sol @@ -1,19 +1,19 @@ -contract A { +abstract contract A { int public testvar; function foo() internal returns (uint256); function test(uint8 _a) internal returns (uint256); } -contract B { +abstract contract B { function foo() internal returns (uint256); function test() internal returns (uint256); } -contract C { +abstract contract C { function foo() internal returns (uint256); } -contract D { +abstract contract D { function foo() internal returns (uint256); } -contract X is A, B, C, D { +abstract contract X is A, B, C, D { struct MyStruct { int abc; } enum ENUM { F,G,H } @@ -22,8 +22,5 @@ contract X is A, B, C, D { function foo() internal override(MyStruct, ENUM, A, B, C, D) returns (uint256); } // ---- -// TypeError: (0-132): Contract "A" should be marked as abstract. -// TypeError: (133-236): Contract "B" should be marked as abstract. -// TypeError: (237-295): Contract "C" should be marked as abstract. -// TypeError: (296-354): Contract "D" should be marked as abstract. -// TypeError: (355-600): Contract "X" should be marked as abstract. +// TypeError: (597-605): Expected contract but got struct X.MyStruct. +// TypeError: (607-611): Expected contract but got enum X.ENUM. diff --git a/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractCreation.sol b/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractCreation.sol index b0b2874ec..b48a63abf 100644 --- a/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractCreation.sol +++ b/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractCreation.sol @@ -3,9 +3,8 @@ contract Test { return type(Other).creationCode; } } -contract Other { +abstract contract Other { function f(uint) public returns (uint); } // ---- -// TypeError: (131-193): Contract "Other" should be marked as abstract. // TypeError: (97-121): Member "creationCode" not found or not visible after argument-dependent lookup in type(contract Other). diff --git a/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractRuntime.sol b/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractRuntime.sol index d258005ff..4ff08b3fc 100644 --- a/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractRuntime.sol +++ b/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractRuntime.sol @@ -3,9 +3,8 @@ contract Test { return type(Other).runtimeCode; } } -contract Other { +abstract contract Other { function f(uint) public returns (uint); } // ---- -// TypeError: (124-186): Contract "Other" should be marked as abstract. // TypeError: (91-114): Member "runtimeCode" not found or not visible after argument-dependent lookup in type(contract Other). diff --git a/test/libsolidity/syntaxTests/modifiers/modifiers_on_abstract_functions_no_parser_error.sol b/test/libsolidity/syntaxTests/modifiers/modifiers_on_abstract_functions_no_parser_error.sol index 54bc3f0e2..534a4d1a8 100644 --- a/test/libsolidity/syntaxTests/modifiers/modifiers_on_abstract_functions_no_parser_error.sol +++ b/test/libsolidity/syntaxTests/modifiers/modifiers_on_abstract_functions_no_parser_error.sol @@ -2,13 +2,12 @@ // into a parser error (they wrongly recognized // these functions as state variables of // function type). -contract C +abstract contract C { modifier only_owner() { _; } function foo() only_owner public; function bar() public only_owner; } // ---- -// SyntaxError: (203-236): Functions without implementation cannot have modifiers. -// SyntaxError: (241-274): Functions without implementation cannot have modifiers. -// TypeError: (153-276): Contract "C" should be marked as abstract. +// SyntaxError: (212-245): Functions without implementation cannot have modifiers. +// SyntaxError: (250-283): Functions without implementation cannot have modifiers. diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/differentNumberOfComponentsFromReturn.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/differentNumberOfComponentsFromReturn.sol index f041a614f..332ac6b14 100644 --- a/test/libsolidity/syntaxTests/multiVariableDeclaration/differentNumberOfComponentsFromReturn.sol +++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/differentNumberOfComponentsFromReturn.sol @@ -1,4 +1,4 @@ -contract C { +abstract contract C { function f() public { uint a = two(); uint b = three(); @@ -19,12 +19,11 @@ contract C { function four() public pure returns (uint, uint, uint, uint); } // ---- -// TypeError: (0-649): Contract "C" should be marked as abstract. -// TypeError: (47-61): Different number of components on the left hand side (1) than on the right hand side (2). -// TypeError: (71-87): Different number of components on the left hand side (1) than on the right hand side (3). -// TypeError: (97-112): Different number of components on the left hand side (1) than on the right hand side (4). -// TypeError: (154-198): Different number of components on the left hand side (4) than on the right hand side (1). -// TypeError: (208-243): Different number of components on the left hand side (3) than on the right hand side (1). -// TypeError: (253-279): Different number of components on the left hand side (2) than on the right hand side (1). -// TypeError: (321-367): Different number of components on the left hand side (4) than on the right hand side (3). -// TypeError: (377-413): Different number of components on the left hand side (3) than on the right hand side (4). +// TypeError: (56-70): Different number of components on the left hand side (1) than on the right hand side (2). +// TypeError: (80-96): Different number of components on the left hand side (1) than on the right hand side (3). +// TypeError: (106-121): Different number of components on the left hand side (1) than on the right hand side (4). +// TypeError: (163-207): Different number of components on the left hand side (4) than on the right hand side (1). +// TypeError: (217-252): Different number of components on the left hand side (3) than on the right hand side (1). +// TypeError: (262-288): Different number of components on the left hand side (2) than on the right hand side (1). +// TypeError: (330-376): Different number of components on the left hand side (4) than on the right hand side (3). +// TypeError: (386-422): Different number of components on the left hand side (3) than on the right hand side (4). diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/disallowWildcardsFromReturn.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/disallowWildcardsFromReturn.sol index 483fac20e..969b6883a 100644 --- a/test/libsolidity/syntaxTests/multiVariableDeclaration/disallowWildcardsFromReturn.sol +++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/disallowWildcardsFromReturn.sol @@ -1,4 +1,4 @@ -contract C { +abstract contract C { function fn() public pure { (uint a,) = three(); (,uint b) = three(); @@ -19,14 +19,13 @@ contract C { function five() public pure returns (uint, uint, uint, uint, uint); } // ---- -// TypeError: (0-704): Contract "C" should be marked as abstract. -// TypeError: (53-72): Different number of components on the left hand side (2) than on the right hand side (3). -// TypeError: (82-101): Different number of components on the left hand side (2) than on the right hand side (3). -// TypeError: (111-130): Different number of components on the left hand side (3) than on the right hand side (5). -// TypeError: (140-166): Different number of components on the left hand side (3) than on the right hand side (4). -// TypeError: (176-202): Different number of components on the left hand side (3) than on the right hand side (4). -// TypeError: (212-240): Different number of components on the left hand side (4) than on the right hand side (3). -// TypeError: (250-267): Different number of components on the left hand side (2) than on the right hand side (1). -// TypeError: (277-294): Different number of components on the left hand side (2) than on the right hand side (1). -// TypeError: (304-322): Different number of components on the left hand side (3) than on the right hand side (1). -// TypeError: (332-359): Different number of components on the left hand side (4) than on the right hand side (5). +// TypeError: (62-81): Different number of components on the left hand side (2) than on the right hand side (3). +// TypeError: (91-110): Different number of components on the left hand side (2) than on the right hand side (3). +// TypeError: (120-139): Different number of components on the left hand side (3) than on the right hand side (5). +// TypeError: (149-175): Different number of components on the left hand side (3) than on the right hand side (4). +// TypeError: (185-211): Different number of components on the left hand side (3) than on the right hand side (4). +// TypeError: (221-249): Different number of components on the left hand side (4) than on the right hand side (3). +// TypeError: (259-276): Different number of components on the left hand side (2) than on the right hand side (1). +// TypeError: (286-303): Different number of components on the left hand side (2) than on the right hand side (1). +// TypeError: (313-331): Different number of components on the left hand side (3) than on the right hand side (1). +// TypeError: (341-368): Different number of components on the left hand side (4) than on the right hand side (5). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/030_redeclare_implemented_abstract_function_as_abstract.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/030_redeclare_implemented_abstract_function_as_abstract.sol index 4c22ac7b2..a772cd8d6 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/030_redeclare_implemented_abstract_function_as_abstract.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/030_redeclare_implemented_abstract_function_as_abstract.sol @@ -1,7 +1,6 @@ -contract base { function foo() public; } +abstract contract base { function foo() public; } contract derived is base { function foo() public override {} } contract wrong is derived { function foo() public; } // ---- -// TypeError: (0-40): Contract "base" should be marked as abstract. -// TypeError: (132-154): Overriding function is missing 'override' specifier. -// TypeError: (132-154): Redeclaring an already implemented function as abstract +// TypeError: (141-163): Overriding function is missing 'override' specifier. +// TypeError: (141-163): Redeclaring an already implemented function as abstract diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/268_function_overload_array_type.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/268_function_overload_array_type.sol index 3027f8ec3..659928277 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/268_function_overload_array_type.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/268_function_overload_array_type.sol @@ -1,6 +1,5 @@ -contract M { +abstract contract M { function f(uint[] memory) public; function f(int[] memory) public; } // ---- -// TypeError: (0-89): Contract "M" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/424_using_interface_complex.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/424_using_interface_complex.sol index 5e28a193e..6d1415a5c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/424_using_interface_complex.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/424_using_interface_complex.sol @@ -4,9 +4,8 @@ interface I { function g() external; function() external; } -contract C is I { +abstract contract C is I { function f() public override { } } // ---- -// TypeError: (110-170): Contract "C" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/446_no_unused_warning_abstract_arguments.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/446_no_unused_warning_abstract_arguments.sol index edfbf79da..e6ae44ea7 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/446_no_unused_warning_abstract_arguments.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/446_no_unused_warning_abstract_arguments.sol @@ -1,5 +1,4 @@ -contract C { +abstract contract C { function f(uint a) pure public returns (uint b); } // ---- -// TypeError: (0-67): Contract "C" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/559_no_warning_for_using_members_that_look_like_address_members.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/559_no_warning_for_using_members_that_look_like_address_members.sol index 8c7f3b003..a49a5e358 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/559_no_warning_for_using_members_that_look_like_address_members.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/559_no_warning_for_using_members_that_look_like_address_members.sol @@ -1,8 +1,7 @@ -contract C { +abstract contract C { function transfer(uint) public; function f() public { this.transfer(10); } } // ---- -// TypeError: (0-109): Contract "C" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/natspec/docstring_empty_description.sol b/test/libsolidity/syntaxTests/natspec/docstring_empty_description.sol index 4b91af746..da36f419f 100644 --- a/test/libsolidity/syntaxTests/natspec/docstring_empty_description.sol +++ b/test/libsolidity/syntaxTests/natspec/docstring_empty_description.sol @@ -1,7 +1,6 @@ -contract C { +abstract contract C { /// @param id function vote(uint id) public; } // ---- // DocstringParsingError: No description given for param id -// TypeError: (0-67): Contract "C" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/natspec/docstring_empty_tag.sol b/test/libsolidity/syntaxTests/natspec/docstring_empty_tag.sol index 605d17d5e..e822e89b1 100644 --- a/test/libsolidity/syntaxTests/natspec/docstring_empty_tag.sol +++ b/test/libsolidity/syntaxTests/natspec/docstring_empty_tag.sol @@ -1,7 +1,6 @@ -contract C { +abstract contract C { /// @param function vote(uint id) public; } // ---- // DocstringParsingError: End of tag @param not found -// TypeError: (0-64): Contract "C" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/parsing/function_no_body.sol b/test/libsolidity/syntaxTests/parsing/function_no_body.sol index 7db2af379..1de881264 100644 --- a/test/libsolidity/syntaxTests/parsing/function_no_body.sol +++ b/test/libsolidity/syntaxTests/parsing/function_no_body.sol @@ -1,5 +1,4 @@ -contract test { +abstract contract test { function functionName(bytes32 input) public returns (bytes32 out); } // ---- -// TypeError: (0-85): Contract "test" should be marked as abstract. diff --git a/test/libsolidity/syntaxTests/types/function_types/function_parameter_return_types_fail.sol b/test/libsolidity/syntaxTests/types/function_types/function_parameter_return_types_fail.sol index 9a911af09..692bcf5a0 100644 --- a/test/libsolidity/syntaxTests/types/function_types/function_parameter_return_types_fail.sol +++ b/test/libsolidity/syntaxTests/types/function_types/function_parameter_return_types_fail.sol @@ -1,4 +1,4 @@ -contract Test +abstract contract Test { function uint256_to_uint256(uint256 x) internal pure returns (uint256) { return x; } function uint256_to_string(uint256 x) internal pure returns (string memory) { return x == 0 ? "a" : "b"; } @@ -33,11 +33,10 @@ contract Test } } // ---- -// TypeError: (0-2300): Contract "Test" should be marked as abstract. -// TypeError: (1218-1311): Type function (uint256) pure returns (string memory) is not implicitly convertible to expected type function (uint256) pure returns (uint256). -// TypeError: (1319-1425): Type function (uint256) pure returns (string storage pointer) is not implicitly convertible to expected type function (uint256) pure returns (string memory). -// TypeError: (1433-1531): Type function (uint256) pure returns (string memory) is not implicitly convertible to expected type function (string memory) pure returns (uint256). -// TypeError: (1539-1646): Type function (uint256) pure returns (string memory) is not implicitly convertible to expected type function (string memory) pure returns (string memory). -// TypeError: (1655-1766): Type function (uint256) pure returns (uint256) is not implicitly convertible to expected type function (uint256,uint256) pure returns (uint256). -// TypeError: (1774-1893): Type function (string memory) pure returns (string memory) is not implicitly convertible to expected type function (string memory,uint256) pure returns (string memory). -// TypeError: (1901-2025): Type function (string memory) pure returns (string memory) is not implicitly convertible to expected type function (string memory,string memory) pure returns (string memory). +// TypeError: (1227-1320): Type function (uint256) pure returns (string memory) is not implicitly convertible to expected type function (uint256) pure returns (uint256). +// TypeError: (1328-1434): Type function (uint256) pure returns (string storage pointer) is not implicitly convertible to expected type function (uint256) pure returns (string memory). +// TypeError: (1442-1540): Type function (uint256) pure returns (string memory) is not implicitly convertible to expected type function (string memory) pure returns (uint256). +// TypeError: (1548-1655): Type function (uint256) pure returns (string memory) is not implicitly convertible to expected type function (string memory) pure returns (string memory). +// TypeError: (1664-1775): Type function (uint256) pure returns (uint256) is not implicitly convertible to expected type function (uint256,uint256) pure returns (uint256). +// TypeError: (1783-1902): Type function (string memory) pure returns (string memory) is not implicitly convertible to expected type function (string memory,uint256) pure returns (string memory). +// TypeError: (1910-2034): Type function (string memory) pure returns (string memory) is not implicitly convertible to expected type function (string memory,string memory) pure returns (string memory). diff --git a/test/libsolidity/syntaxTests/unimplemented_super_function.sol b/test/libsolidity/syntaxTests/unimplemented_super_function.sol index be09dbca6..1c6887f87 100644 --- a/test/libsolidity/syntaxTests/unimplemented_super_function.sol +++ b/test/libsolidity/syntaxTests/unimplemented_super_function.sol @@ -1,9 +1,8 @@ -contract a { +abstract contract a { function f() public; } contract b is a { function f() public override { super.f(); } } // ---- -// TypeError: (0-39): Contract "a" should be marked as abstract. -// TypeError: (93-100): Member "f" not found or not visible after argument-dependent lookup in contract super b. +// TypeError: (102-109): Member "f" not found or not visible after argument-dependent lookup in contract super b. diff --git a/test/libsolidity/syntaxTests/unimplemented_super_function_derived.sol b/test/libsolidity/syntaxTests/unimplemented_super_function_derived.sol index d6d75d54b..badfd31cb 100644 --- a/test/libsolidity/syntaxTests/unimplemented_super_function_derived.sol +++ b/test/libsolidity/syntaxTests/unimplemented_super_function_derived.sol @@ -1,4 +1,4 @@ -contract a { +abstract contract a { function f() public; } contract b is a { @@ -9,5 +9,4 @@ contract c is a,b { function f() public override(a, b) { super.f(); } } // ---- -// TypeError: (0-39): Contract "a" should be marked as abstract. -// TypeError: (93-100): Member "f" not found or not visible after argument-dependent lookup in contract super b. +// TypeError: (102-109): Member "f" not found or not visible after argument-dependent lookup in contract super b. diff --git a/test/libsolidity/syntaxTests/visibility/interface/interface_contract_function_default.sol b/test/libsolidity/syntaxTests/visibility/interface/interface_contract_function_default.sol index 904641c34..8c1aa0fda 100644 --- a/test/libsolidity/syntaxTests/visibility/interface/interface_contract_function_default.sol +++ b/test/libsolidity/syntaxTests/visibility/interface/interface_contract_function_default.sol @@ -3,11 +3,10 @@ interface I { function f(); } -contract C { +abstract contract C { function g(); } // ---- // SyntaxError: (158-171): No visibility specified. Did you intend to add "external"? -// SyntaxError: (191-204): No visibility specified. Did you intend to add "public"? -// TypeError: (174-206): Contract "C" should be marked as abstract. +// SyntaxError: (200-213): No visibility specified. Did you intend to add "public"? // TypeError: (158-171): Functions in interfaces must be declared external.