mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
New tests for function state variables.
This commit is contained in:
parent
6d289783b4
commit
42b90ad4c3
@ -0,0 +1,11 @@
|
||||
contract C {
|
||||
function (uint) external public x;
|
||||
|
||||
function g(uint) public {
|
||||
x = this.g;
|
||||
}
|
||||
function f() public view returns (function(uint) external) {
|
||||
return this.x();
|
||||
}
|
||||
}
|
||||
// ----
|
@ -0,0 +1,5 @@
|
||||
contract C {
|
||||
function(bytes memory) internal public a;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (17-57): Internal or recursive type is not allowed for public state variables.
|
@ -0,0 +1,6 @@
|
||||
contract test {
|
||||
function fa(bytes memory) { }
|
||||
function(bytes memory) external internal a = fa;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (99-101): Type function (bytes memory) is not implicitly convertible to expected type function (bytes memory) external.
|
@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
// This is an error, you should explicitly use
|
||||
// `external public` to fix it - `internal public` does not exist.
|
||||
function(bytes memory) public a;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (139-170): Invalid visibility, can only be "external" or "internal".
|
@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function(bytes memory) a1;
|
||||
function(bytes memory) internal b1;
|
||||
function(bytes memory) internal internal b2;
|
||||
function(bytes memory) external c1;
|
||||
function(bytes memory) external internal c2;
|
||||
function(bytes memory) external public c3;
|
||||
}
|
||||
// ----
|
@ -0,0 +1,23 @@
|
||||
contract test {
|
||||
function fa(uint) {}
|
||||
function fb(uint) internal {}
|
||||
function fc(uint) internal {}
|
||||
function fd(uint) external {}
|
||||
function fe(uint) external {}
|
||||
function ff(uint) internal {}
|
||||
function fg(uint) internal pure {}
|
||||
function fh(uint) pure internal {}
|
||||
|
||||
function(uint) a = fa;
|
||||
function(uint) internal b = fb; // (explicit internal applies to the function type)
|
||||
function(uint) internal internal c = fc;
|
||||
function(uint) external d = this.fd;
|
||||
function(uint) external internal e = this.fe;
|
||||
function(uint) internal public f = ff;
|
||||
function(uint) internal pure public g = fg;
|
||||
function(uint) pure internal public h = fh;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (545-582): Internal or recursive type is not allowed for public state variables.
|
||||
// TypeError: (588-630): Internal or recursive type is not allowed for public state variables.
|
||||
// TypeError: (636-678): Internal or recursive type is not allowed for public state variables.
|
Loading…
Reference in New Issue
Block a user