mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add expectations.
This commit is contained in:
parent
bd27ce0e25
commit
08e807aea0
@ -4,3 +4,5 @@ contract C {
|
||||
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?
|
||||
|
@ -3,3 +3,5 @@ contract C {
|
||||
delete this.f;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (54-60): Expression has to be an lvalue.
|
||||
|
@ -12,3 +12,6 @@ contract C {
|
||||
delete g;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (157-162): Use of the "var" keyword is deprecated.
|
||||
// Warning: (212-217): Use of the "var" keyword is deprecated.
|
||||
|
@ -3,3 +3,5 @@ contract C {
|
||||
delete f;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (54-55): Expression has to be an lvalue.
|
||||
|
@ -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 {
|
||||
function f(function(bytes memory) external g) public { }
|
||||
function callback(bytes) external {}
|
||||
function g() public {
|
||||
function f(function(bytes memory) pure external /*g*/) pure public { }
|
||||
function callback(bytes) pure external {}
|
||||
function g() view public {
|
||||
f(this.callback);
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
contract C {
|
||||
function() external returns (function () internal) x;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (46-67): Internal type cannot be used for external function type.
|
||||
|
@ -1,3 +1,5 @@
|
||||
contract C {
|
||||
function(function () internal) external x;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (26-47): Internal type cannot be used for external function type.
|
||||
|
@ -1,5 +1,5 @@
|
||||
contract C {
|
||||
function f() public returns (address) {
|
||||
function f() public view returns (address) {
|
||||
return address(this.f);
|
||||
}
|
||||
}
|
||||
|
@ -3,3 +3,5 @@ contract C {
|
||||
return uint(this.f);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (69-81): Explicit type conversion not allowed from "function () external returns (uint256)" to "uint256".
|
||||
|
@ -1,5 +1,6 @@
|
||||
contract C {
|
||||
function f() public {
|
||||
function f() pure public {
|
||||
function(uint) returns (uint) x;
|
||||
x;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
contract C {
|
||||
function(uint) external returns (uint)[] public x;
|
||||
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] storage b = y;
|
||||
function(uint) external returns (uint)[] memory c;
|
||||
|
@ -1,5 +1,7 @@
|
||||
contract C {
|
||||
uint x;
|
||||
function f(function(uint) external returns (uint) g) public returns (function(uint) external returns (uint)) {
|
||||
x = 2;
|
||||
return g;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,8 @@
|
||||
// It should not be possible to give internal functions
|
||||
// as parameters to external functions.
|
||||
contract C {
|
||||
function f(function(uint) internal returns (uint) x) public {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (124-164): Internal or recursive type is not allowed for public or external functions.
|
||||
|
@ -2,3 +2,5 @@ library L {
|
||||
function f(function(uint) internal returns (uint) x) public {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (27-67): Internal or recursive type is not allowed for public or external functions.
|
||||
|
@ -1,4 +1,4 @@
|
||||
library L {
|
||||
function f(function(uint) internal returns (uint) x) internal {
|
||||
function f(function(uint) internal returns (uint) /*x*/) pure internal {
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,7 @@
|
||||
// It should not be possible to return internal functions from external functions.
|
||||
contract C {
|
||||
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.
|
||||
|
@ -3,3 +3,5 @@ contract C {
|
||||
return address(f);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (72-82): Explicit type conversion not allowed from "function () returns (address)" to "address".
|
||||
|
@ -1,3 +1,5 @@
|
||||
contract C {
|
||||
function (uint) internal payable returns (uint) x;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (17-66): Only external function types can be payable.
|
||||
|
@ -1,7 +1,9 @@
|
||||
contract C {
|
||||
function (uint) internal payable returns (uint) x;
|
||||
|
||||
function g() {
|
||||
function g() public {
|
||||
x = g;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (17-66): Only external function types can be payable.
|
||||
|
@ -3,3 +3,5 @@ contract C {
|
||||
function(uint) private returns (uint) x;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (47-86): Invalid visibility, can only be "external" or "internal".
|
||||
|
@ -3,3 +3,5 @@ contract C {
|
||||
function(uint) public returns (uint) x;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (47-85): Invalid visibility, can only be "external" or "internal".
|
||||
|
@ -1,3 +1,5 @@
|
||||
contract C {
|
||||
function(uint a) f;
|
||||
}
|
||||
// ----
|
||||
// Warning: (26-32): Naming function type parameters is deprecated.
|
||||
|
@ -1,3 +1,5 @@
|
||||
contract C {
|
||||
function(uint) returns (bool ret) f;
|
||||
}
|
||||
// ----
|
||||
// Warning: (41-49): Naming function type return parameters is deprecated.
|
||||
|
Loading…
Reference in New Issue
Block a user