Add expectations.

This commit is contained in:
chriseth 2018-03-16 11:33:05 +01:00
parent bd27ce0e25
commit 08e807aea0
24 changed files with 53 additions and 9 deletions

View File

@ -4,3 +4,5 @@ contract C {
x.value(2)(); x.value(2)();
} }
} }
// ----
// TypeError: (94-101): Member "value" not found or not visible after argument-dependent lookup in function (uint256) external returns (uint256) - did you forget the "payable" modifier?

View File

@ -3,3 +3,5 @@ contract C {
delete this.f; delete this.f;
} }
} }
// ----
// TypeError: (54-60): Expression has to be an lvalue.

View File

@ -12,3 +12,6 @@ contract C {
delete g; delete g;
} }
} }
// ----
// Warning: (157-162): Use of the "var" keyword is deprecated.
// Warning: (212-217): Use of the "var" keyword is deprecated.

View File

@ -3,3 +3,5 @@ contract C {
delete f; delete f;
} }
} }
// ----
// TypeError: (54-55): Expression has to be an lvalue.

View File

@ -1,7 +1,10 @@
// This is a test that checks that the type of the `bytes` parameter is
// correctly changed from its own type `bytes calldata` to `bytes memory`
// when converting to a function type.
contract C { contract C {
function f(function(bytes memory) external g) public { } function f(function(bytes memory) pure external /*g*/) pure public { }
function callback(bytes) external {} function callback(bytes) pure external {}
function g() public { function g() view public {
f(this.callback); f(this.callback);
} }
} }

View File

@ -1,3 +1,5 @@
contract C { contract C {
function() external returns (function () internal) x; function() external returns (function () internal) x;
} }
// ----
// TypeError: (46-67): Internal type cannot be used for external function type.

View File

@ -1,3 +1,5 @@
contract C { contract C {
function(function () internal) external x; function(function () internal) external x;
} }
// ----
// TypeError: (26-47): Internal type cannot be used for external function type.

View File

@ -1,5 +1,5 @@
contract C { contract C {
function f() public returns (address) { function f() public view returns (address) {
return address(this.f); return address(this.f);
} }
} }

View File

@ -3,3 +3,5 @@ contract C {
return uint(this.f); return uint(this.f);
} }
} }
// ----
// TypeError: (69-81): Explicit type conversion not allowed from "function () external returns (uint256)" to "uint256".

View File

@ -1,5 +1,6 @@
contract C { contract C {
function f() public { function f() pure public {
function(uint) returns (uint) x; function(uint) returns (uint) x;
x;
} }
} }

View File

@ -1,7 +1,7 @@
contract C { contract C {
function(uint) external returns (uint)[] public x; function(uint) external returns (uint)[] public x;
function(uint) internal returns (uint)[10] y; function(uint) internal returns (uint)[10] y;
function f() public { function f() view public {
function(uint) returns (uint)[10] memory a; function(uint) returns (uint)[10] memory a;
function(uint) returns (uint)[10] storage b = y; function(uint) returns (uint)[10] storage b = y;
function(uint) external returns (uint)[] memory c; function(uint) external returns (uint)[] memory c;

View File

@ -1,5 +1,7 @@
contract C { contract C {
uint x;
function f(function(uint) external returns (uint) g) public returns (function(uint) external returns (uint)) { function f(function(uint) external returns (uint) g) public returns (function(uint) external returns (uint)) {
x = 2;
return g; return g;
} }
} }

View File

@ -1,5 +1,5 @@
contract C { contract C {
function f() public returns (function(uint) external returns (uint) g) { function f() public pure returns (function(uint) pure external returns (uint) g) {
return g; return g;
} }
} }

View File

@ -1,4 +1,8 @@
// It should not be possible to give internal functions
// as parameters to external functions.
contract C { contract C {
function f(function(uint) internal returns (uint) x) public { function f(function(uint) internal returns (uint) x) public {
} }
} }
// ----
// TypeError: (124-164): Internal or recursive type is not allowed for public or external functions.

View File

@ -2,3 +2,5 @@ library L {
function f(function(uint) internal returns (uint) x) public { function f(function(uint) internal returns (uint) x) public {
} }
} }
// ----
// TypeError: (27-67): Internal or recursive type is not allowed for public or external functions.

View File

@ -1,4 +1,4 @@
library L { library L {
function f(function(uint) internal returns (uint) x) internal { function f(function(uint) internal returns (uint) /*x*/) pure internal {
} }
} }

View File

@ -1,4 +1,7 @@
// It should not be possible to return internal functions from external functions.
contract C { contract C {
function f() public returns (function(uint) internal returns (uint) x) { function f() public returns (function(uint) internal returns (uint) x) {
} }
} }
// ----
// TypeError: (129-169): Internal or recursive type is not allowed for public or external functions.

View File

@ -3,3 +3,5 @@ contract C {
return address(f); return address(f);
} }
} }
// ----
// TypeError: (72-82): Explicit type conversion not allowed from "function () returns (address)" to "address".

View File

@ -1,3 +1,5 @@
contract C { contract C {
function (uint) internal payable returns (uint) x; function (uint) internal payable returns (uint) x;
} }
// ----
// TypeError: (17-66): Only external function types can be payable.

View File

@ -1,7 +1,9 @@
contract C { contract C {
function (uint) internal payable returns (uint) x; function (uint) internal payable returns (uint) x;
function g() { function g() public {
x = g; x = g;
} }
} }
// ----
// TypeError: (17-66): Only external function types can be payable.

View File

@ -3,3 +3,5 @@ contract C {
function(uint) private returns (uint) x; function(uint) private returns (uint) x;
} }
} }
// ----
// TypeError: (47-86): Invalid visibility, can only be "external" or "internal".

View File

@ -3,3 +3,5 @@ contract C {
function(uint) public returns (uint) x; function(uint) public returns (uint) x;
} }
} }
// ----
// TypeError: (47-85): Invalid visibility, can only be "external" or "internal".

View File

@ -1,3 +1,5 @@
contract C { contract C {
function(uint a) f; function(uint a) f;
} }
// ----
// Warning: (26-32): Naming function type parameters is deprecated.

View File

@ -1,3 +1,5 @@
contract C { contract C {
function(uint) returns (bool ret) f; function(uint) returns (bool ret) f;
} }
// ----
// Warning: (41-49): Naming function type return parameters is deprecated.