Add some more abstract keywords in test to make sure the correct property is tested.

This commit is contained in:
chriseth 2019-11-04 14:33:33 +01:00
parent 3d625cc239
commit 7c258873bd
40 changed files with 120 additions and 174 deletions

View File

@ -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 { library OldLibrary {
function someFunction(uint8 a) public returns(bool); function someFunction(uint8 a) public returns(bool);

View File

@ -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. * 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``. * New reserved keywords: ``virtual``.
Semantic Only Changes Semantic Only Changes

View File

@ -8538,7 +8538,7 @@ BOOST_AUTO_TEST_CASE(using_library_mappings_external)
)"; )";
char const* sourceCode = R"( char const* sourceCode = R"(
library Lib { 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 { contract Test {
mapping(uint => uint) m1; mapping(uint => uint) m1;

View File

@ -1,6 +1,6 @@
pragma experimental SMTChecker; pragma experimental SMTChecker;
contract D abstract contract D
{ {
function g(uint x) public; 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

View File

@ -1,6 +1,6 @@
pragma experimental SMTChecker; pragma experimental SMTChecker;
contract D abstract contract D
{ {
function g(uint x) public; 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

View File

@ -1,6 +1,6 @@
pragma experimental SMTChecker; pragma experimental SMTChecker;
contract D abstract contract D
{ {
function g(uint x) public; 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

View File

@ -1,6 +1,5 @@
contract C { abstract contract C {
function f() internal returns(uint[] storage); function f() internal returns(uint[] storage);
function g() internal returns(uint[] storage s); function g() internal returns(uint[] storage s);
} }
// ---- // ----
// TypeError: (0-118): Contract "C" should be marked as abstract.

View File

@ -1,5 +1,4 @@
contract test { abstract contract test {
function f(bytes calldata) external; function f(bytes calldata) external;
} }
// ---- // ----
// TypeError: (0-58): Contract "test" should be marked as abstract.

View File

@ -1,5 +1,4 @@
contract test { abstract contract test {
function f(bytes memory) internal; function f(bytes memory) internal;
} }
// ---- // ----
// TypeError: (0-56): Contract "test" should be marked as abstract.

View File

@ -1,5 +1,4 @@
contract test { abstract contract test {
function f(bytes storage) internal; function f(bytes storage) internal;
} }
// ---- // ----
// TypeError: (0-57): Contract "test" should be marked as abstract.

View File

@ -1,5 +1,4 @@
contract test { abstract contract test {
function f(bytes memory) public; function f(bytes memory) public;
} }
// ---- // ----
// TypeError: (0-54): Contract "test" should be marked as abstract.

View File

@ -1,4 +1,4 @@
contract X { function test() internal returns (uint256); } abstract contract X { function test() internal returns (uint256); }
contract Y is X { contract Y is X {
uint256 public test = 42; uint256 public test = 42;
} }
@ -6,5 +6,4 @@ contract T {
constructor() public { new Y(); } constructor() public { new Y(); }
} }
// ---- // ----
// DeclarationError: (81-105): Identifier already declared. // DeclarationError: (90-114): Identifier already declared.
// TypeError: (0-58): Contract "X" should be marked as abstract.

View File

@ -1,4 +1,4 @@
contract X { function test() private returns (uint256); } abstract contract X { function test() private returns (uint256); }
contract Y is X { contract Y is X {
uint256 public test = 42; uint256 public test = 42;
} }
@ -6,4 +6,3 @@ contract T {
constructor() public { new Y(); } constructor() public { new Y(); }
} }
// ---- // ----
// TypeError: (0-57): Contract "X" should be marked as abstract.

View File

@ -1,4 +1,4 @@
contract X { function test() public returns (uint256); } abstract contract X { function test() public returns (uint256); }
contract Y is X { contract Y is X {
uint256 public test = 42; uint256 public test = 42;
} }
@ -6,5 +6,4 @@ contract T {
constructor() public { new Y(); } constructor() public { new Y(); }
} }
// ---- // ----
// DeclarationError: (79-103): Identifier already declared. // DeclarationError: (88-112): Identifier already declared.
// TypeError: (0-56): Contract "X" should be marked as abstract.

View File

@ -1,13 +1,11 @@
contract A { abstract contract A {
int public testvar; int public testvar;
function test() internal returns (uint256); function test() internal returns (uint256);
function test2() internal returns (uint256); function test2() internal returns (uint256);
} }
contract X is A { abstract contract X is A {
int public override testvar; int public override testvar;
function test() internal override returns (uint256); function test() internal override returns (uint256);
function test2() internal override(A) 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.

View File

@ -1,17 +1,14 @@
contract A { abstract contract A {
int public testvar; int public testvar;
function foo() internal returns (uint256); function foo() internal returns (uint256);
} }
contract B { abstract contract B {
function foo() internal returns (uint256); function foo() internal returns (uint256);
function test() internal returns (uint256); function test() internal returns (uint256);
} }
contract X is A, B { abstract contract X is A, B {
int public override testvar; int public override testvar;
function test() internal override returns (uint256); function test() internal override returns (uint256);
} }
// ---- // ----
// TypeError: (0-79): Contract "A" 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.
// 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.

View File

@ -1,25 +1,20 @@
contract A { abstract contract A {
function foo() internal returns (uint256); function foo() internal returns (uint256);
} }
contract B is A { abstract contract B is A {
function foo() internal override returns (uint256); function foo() internal override returns (uint256);
} }
contract C is B { abstract contract C is B {
function foo() internal override returns (uint256); function foo() internal override returns (uint256);
} }
contract D is C { abstract contract D is C {
function foo() internal override returns (uint256); function foo() internal override returns (uint256);
} }
contract X is D { abstract contract X is D {
function foo() internal override returns (uint256); 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.

View File

@ -1,26 +1,21 @@
contract A { abstract contract A {
int public testvar; int public testvar;
function foo() internal returns (uint256); function foo() internal returns (uint256);
function test(uint8 _a) internal returns (uint256); function test(uint8 _a) internal returns (uint256);
} }
contract B { abstract contract B {
function foo() internal returns (uint256); function foo() internal returns (uint256);
function test() internal returns (uint256); function test() internal returns (uint256);
} }
contract C { abstract contract C {
function foo() internal returns (uint256); function foo() internal returns (uint256);
} }
contract D { abstract contract D {
function foo() internal returns (uint256); function foo() internal returns (uint256);
} }
contract X is A, B, C, D { abstract contract X is A, B, C, D {
int public override testvar; int public override testvar;
function test() internal override returns (uint256); function test() internal override returns (uint256);
function foo() internal override(A, B, C, D) 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.

View File

@ -1,19 +1,15 @@
contract A { abstract contract A {
int public testvar; int public testvar;
function foo() internal returns (uint256); function foo() internal returns (uint256);
function test(uint8 _a) internal returns (uint256); function test(uint8 _a) internal returns (uint256);
} }
contract B { abstract contract B {
function foo() internal returns (uint256); 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); 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.

View File

@ -1,31 +1,26 @@
contract A { abstract contract A {
int public testvar; int public testvar;
function foo() internal returns (uint256); function foo() internal returns (uint256);
function test(uint8 _a) internal returns (uint256); function test(uint8 _a) internal returns (uint256);
} }
contract B { abstract contract B {
function foo() internal returns (uint256); function foo() internal returns (uint256);
function test() internal returns (uint256); function test() internal returns (uint256);
} }
contract C { abstract contract C {
function foo() internal returns (uint256); function foo() internal returns (uint256);
} }
contract D { abstract contract D {
function foo() internal returns (uint256); function foo() internal returns (uint256);
function test() 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; int public override testvar;
function test() internal override(B, D, D) returns (uint256); function test() internal override(B, D, D) returns (uint256);
function foo() internal override(A, C, B, B, 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: (543-544): Duplicate contract "D" found in override list of "test".
// TypeError: (133-236): Contract "B" should be marked as abstract. // TypeError: (608-609): Duplicate contract "B" found in override list of "foo".
// TypeError: (237-295): Contract "C" should be marked as abstract. // TypeError: (611-612): Duplicate contract "B" found in override list of "foo".
// TypeError: (296-399): Contract "D" should be marked as abstract. // TypeError: (617-618): Duplicate contract "D" found in override list of "foo".
// 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.

View File

@ -1,29 +1,24 @@
contract A { abstract contract A {
int public testvar; int public testvar;
function foo() internal returns (uint256); function foo() internal returns (uint256);
function test(uint8 _a) internal returns (uint256); function test(uint8 _a) internal returns (uint256);
} }
contract B { abstract contract B {
function foo() internal returns (uint256); function foo() internal returns (uint256);
function test() internal returns (uint256); function test() internal returns (uint256);
} }
contract C { abstract contract C {
function foo() internal returns (uint256); function foo() internal returns (uint256);
} }
contract D { abstract contract D {
function foo() internal returns (uint256); function foo() internal returns (uint256);
function test() 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; int public override testvar;
function test() internal override(B, D, C) returns (uint256); function test() internal override(B, D, C) returns (uint256);
function foo() internal override(A, C) returns (uint256); function foo() internal override(A, C) returns (uint256);
} }
// ---- // ----
// TypeError: (0-132): Contract "A" should be marked as abstract. // TypeError: (528-545): Invalid contract specified in override list: C.
// TypeError: (133-236): Contract "B" should be marked as abstract. // TypeError: (590-604): Function needs to specify overridden contracts B and D.
// 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.

View File

@ -1,17 +1,14 @@
contract A { abstract contract A {
int public testvar; int public testvar;
function foo() internal returns (uint256); function foo() internal returns (uint256);
} }
contract B { abstract contract B {
function foo() internal returns (uint8); function foo() internal returns (uint8);
function test() internal returns (uint256); function test() internal returns (uint256);
} }
contract X is A, B { abstract contract X is A, B {
int public override testvar; int public override testvar;
function test() internal override returns (uint256); function test() internal override returns (uint256);
} }
// ---- // ----
// TypeError: (0-79): Contract "A" 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.
// 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.

View File

@ -1,19 +1,19 @@
contract A { abstract contract A {
int public testvar; int public testvar;
function foo() internal returns (uint256); function foo() internal returns (uint256);
function test(uint8 _a) internal returns (uint256); function test(uint8 _a) internal returns (uint256);
} }
contract B { abstract contract B {
function foo() internal returns (uint256); function foo() internal returns (uint256);
function test() internal returns (uint256); function test() internal returns (uint256);
} }
contract C { abstract contract C {
function foo() internal returns (uint256); function foo() internal returns (uint256);
} }
contract D { abstract contract D {
function foo() internal returns (uint256); function foo() internal returns (uint256);
} }
contract X is A, B, C, D { abstract contract X is A, B, C, D {
struct MyStruct { int abc; } struct MyStruct { int abc; }
enum ENUM { F,G,H } 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); function foo() internal override(MyStruct, ENUM, A, B, C, D) returns (uint256);
} }
// ---- // ----
// TypeError: (0-132): Contract "A" should be marked as abstract. // TypeError: (597-605): Expected contract but got struct X.MyStruct.
// TypeError: (133-236): Contract "B" should be marked as abstract. // TypeError: (607-611): Expected contract but got enum X.ENUM.
// 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.

View File

@ -3,9 +3,8 @@ contract Test {
return type(Other).creationCode; return type(Other).creationCode;
} }
} }
contract Other { abstract contract Other {
function f(uint) public returns (uint); 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). // TypeError: (97-121): Member "creationCode" not found or not visible after argument-dependent lookup in type(contract Other).

View File

@ -3,9 +3,8 @@ contract Test {
return type(Other).runtimeCode; return type(Other).runtimeCode;
} }
} }
contract Other { abstract contract Other {
function f(uint) public returns (uint); 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). // TypeError: (91-114): Member "runtimeCode" not found or not visible after argument-dependent lookup in type(contract Other).

View File

@ -2,13 +2,12 @@
// into a parser error (they wrongly recognized // into a parser error (they wrongly recognized
// these functions as state variables of // these functions as state variables of
// function type). // function type).
contract C abstract contract C
{ {
modifier only_owner() { _; } modifier only_owner() { _; }
function foo() only_owner public; function foo() only_owner public;
function bar() public only_owner; function bar() public only_owner;
} }
// ---- // ----
// SyntaxError: (203-236): Functions without implementation cannot have modifiers. // SyntaxError: (212-245): Functions without implementation cannot have modifiers.
// SyntaxError: (241-274): Functions without implementation cannot have modifiers. // SyntaxError: (250-283): Functions without implementation cannot have modifiers.
// TypeError: (153-276): Contract "C" should be marked as abstract.

View File

@ -1,4 +1,4 @@
contract C { abstract contract C {
function f() public { function f() public {
uint a = two(); uint a = two();
uint b = three(); uint b = three();
@ -19,12 +19,11 @@ contract C {
function four() public pure returns (uint, uint, uint, uint); function four() public pure returns (uint, uint, uint, uint);
} }
// ---- // ----
// TypeError: (0-649): Contract "C" should be marked as abstract. // TypeError: (56-70): Different number of components on the left hand side (1) than on the right hand side (2).
// TypeError: (47-61): 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: (71-87): 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: (97-112): 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: (154-198): 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: (208-243): 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: (253-279): 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: (321-367): 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).
// TypeError: (377-413): Different number of components on the left hand side (3) than on the right hand side (4).

View File

@ -1,4 +1,4 @@
contract C { abstract contract C {
function fn() public pure { function fn() public pure {
(uint a,) = three(); (uint a,) = three();
(,uint b) = three(); (,uint b) = three();
@ -19,14 +19,13 @@ contract C {
function five() public pure returns (uint, uint, uint, uint, uint); function five() public pure returns (uint, uint, uint, uint, uint);
} }
// ---- // ----
// TypeError: (0-704): Contract "C" should be marked as abstract. // TypeError: (62-81): Different number of components on the left hand side (2) than on the right hand side (3).
// TypeError: (53-72): 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: (82-101): 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: (111-130): 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: (140-166): 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: (176-202): 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: (212-240): 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: (250-267): 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: (277-294): 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: (304-322): 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).
// TypeError: (332-359): Different number of components on the left hand side (4) than on the right hand side (5).

View File

@ -1,7 +1,6 @@
contract base { function foo() public; } abstract contract base { function foo() public; }
contract derived is base { function foo() public override {} } contract derived is base { function foo() public override {} }
contract wrong is derived { function foo() public; } contract wrong is derived { function foo() public; }
// ---- // ----
// TypeError: (0-40): Contract "base" should be marked as abstract. // TypeError: (141-163): Overriding function is missing 'override' specifier.
// TypeError: (132-154): Overriding function is missing 'override' specifier. // TypeError: (141-163): Redeclaring an already implemented function as abstract
// TypeError: (132-154): Redeclaring an already implemented function as abstract

View File

@ -1,6 +1,5 @@
contract M { abstract contract M {
function f(uint[] memory) public; function f(uint[] memory) public;
function f(int[] memory) public; function f(int[] memory) public;
} }
// ---- // ----
// TypeError: (0-89): Contract "M" should be marked as abstract.

View File

@ -4,9 +4,8 @@ interface I {
function g() external; function g() external;
function() external; function() external;
} }
contract C is I { abstract contract C is I {
function f() public override { function f() public override {
} }
} }
// ---- // ----
// TypeError: (110-170): Contract "C" should be marked as abstract.

View File

@ -1,5 +1,4 @@
contract C { abstract contract C {
function f(uint a) pure public returns (uint b); function f(uint a) pure public returns (uint b);
} }
// ---- // ----
// TypeError: (0-67): Contract "C" should be marked as abstract.

View File

@ -1,8 +1,7 @@
contract C { abstract contract C {
function transfer(uint) public; function transfer(uint) public;
function f() public { function f() public {
this.transfer(10); this.transfer(10);
} }
} }
// ---- // ----
// TypeError: (0-109): Contract "C" should be marked as abstract.

View File

@ -1,7 +1,6 @@
contract C { abstract contract C {
/// @param id /// @param id
function vote(uint id) public; function vote(uint id) public;
} }
// ---- // ----
// DocstringParsingError: No description given for param id // DocstringParsingError: No description given for param id
// TypeError: (0-67): Contract "C" should be marked as abstract.

View File

@ -1,7 +1,6 @@
contract C { abstract contract C {
/// @param /// @param
function vote(uint id) public; function vote(uint id) public;
} }
// ---- // ----
// DocstringParsingError: End of tag @param not found // DocstringParsingError: End of tag @param not found
// TypeError: (0-64): Contract "C" should be marked as abstract.

View File

@ -1,5 +1,4 @@
contract test { abstract contract test {
function functionName(bytes32 input) public returns (bytes32 out); function functionName(bytes32 input) public returns (bytes32 out);
} }
// ---- // ----
// TypeError: (0-85): Contract "test" should be marked as abstract.

View File

@ -1,4 +1,4 @@
contract Test abstract contract Test
{ {
function uint256_to_uint256(uint256 x) internal pure returns (uint256) { return x; } 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"; } 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: (1227-1320): Type function (uint256) pure returns (string memory) is not implicitly convertible to expected type function (uint256) pure returns (uint256).
// TypeError: (1218-1311): 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: (1319-1425): 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: (1433-1531): 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: (1539-1646): 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: (1655-1766): 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: (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: (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).
// 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).

View File

@ -1,9 +1,8 @@
contract a { abstract contract a {
function f() public; function f() public;
} }
contract b is a { contract b is a {
function f() public override { super.f(); } function f() public override { super.f(); }
} }
// ---- // ----
// TypeError: (0-39): Contract "a" should be marked as abstract. // TypeError: (102-109): Member "f" not found or not visible after argument-dependent lookup in contract super b.
// TypeError: (93-100): Member "f" not found or not visible after argument-dependent lookup in contract super b.

View File

@ -1,4 +1,4 @@
contract a { abstract contract a {
function f() public; function f() public;
} }
contract b is a { contract b is a {
@ -9,5 +9,4 @@ contract c is a,b {
function f() public override(a, b) { super.f(); } function f() public override(a, b) { super.f(); }
} }
// ---- // ----
// TypeError: (0-39): Contract "a" should be marked as abstract. // TypeError: (102-109): Member "f" not found or not visible after argument-dependent lookup in contract super b.
// TypeError: (93-100): Member "f" not found or not visible after argument-dependent lookup in contract super b.

View File

@ -3,11 +3,10 @@
interface I { interface I {
function f(); function f();
} }
contract C { abstract contract C {
function g(); function g();
} }
// ---- // ----
// SyntaxError: (158-171): No visibility specified. Did you intend to add "external"? // SyntaxError: (158-171): No visibility specified. Did you intend to add "external"?
// SyntaxError: (191-204): No visibility specified. Did you intend to add "public"? // SyntaxError: (200-213): No visibility specified. Did you intend to add "public"?
// TypeError: (174-206): Contract "C" should be marked as abstract.
// TypeError: (158-171): Functions in interfaces must be declared external. // TypeError: (158-171): Functions in interfaces must be declared external.