aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-03-16 18:33:05 +0800
committerchriseth <chris@ethereum.org>2018-04-12 04:00:04 +0800
commit08e807aea01a443419dc82e159776899d96441ec (patch)
tree7cf573ac419423c4297925467d17e7fff584e847
parentbd27ce0e25d298e075de6c77318e7a8df2e27f6d (diff)
downloaddexon-solidity-08e807aea01a443419dc82e159776899d96441ec.tar
dexon-solidity-08e807aea01a443419dc82e159776899d96441ec.tar.gz
dexon-solidity-08e807aea01a443419dc82e159776899d96441ec.tar.bz2
dexon-solidity-08e807aea01a443419dc82e159776899d96441ec.tar.lz
dexon-solidity-08e807aea01a443419dc82e159776899d96441ec.tar.xz
dexon-solidity-08e807aea01a443419dc82e159776899d96441ec.tar.zst
dexon-solidity-08e807aea01a443419dc82e159776899d96441ec.zip
Add expectations.
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/call_value_on_non_payable_function_type.sol2
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/delete_external_function_type_invalid.sol2
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/delete_function_type.sol3
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/delete_function_type_invalid.sol2
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/external_function_to_function_type_calldata_parameter.sol9
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/external_function_type_returning_internal.sol2
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/external_function_type_taking_internal.sol2
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/external_function_type_to_address.sol2
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/external_function_type_to_uint.sol2
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/function_type.sol3
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/function_type_arrays.sol2
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/function_type_parameter.sol2
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/function_type_returned.sol2
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter.sol4
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter_in_library_external.sol2
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter_in_library_internal.sol2
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/internal_function_returned_from_public_function.sol3
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/internal_function_type_to_address.sol2
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/payable_internal_function_type.sol2
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/payable_internal_function_type_is_not_fatal.sol4
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/private_function_type.sol2
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/public_function_type.sol2
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/warn_function_type_parameters_with_names.sol2
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/warn_function_type_return_parameters_with_names.sol2
24 files changed, 53 insertions, 9 deletions
diff --git a/test/libsolidity/syntaxTests/functionTypes/call_value_on_non_payable_function_type.sol b/test/libsolidity/syntaxTests/functionTypes/call_value_on_non_payable_function_type.sol
index dac7908f..87c3b05b 100644
--- a/test/libsolidity/syntaxTests/functionTypes/call_value_on_non_payable_function_type.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/call_value_on_non_payable_function_type.sol
@@ -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?
diff --git a/test/libsolidity/syntaxTests/functionTypes/delete_external_function_type_invalid.sol b/test/libsolidity/syntaxTests/functionTypes/delete_external_function_type_invalid.sol
index e3bf2dee..2711dae8 100644
--- a/test/libsolidity/syntaxTests/functionTypes/delete_external_function_type_invalid.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/delete_external_function_type_invalid.sol
@@ -3,3 +3,5 @@ contract C {
delete this.f;
}
}
+// ----
+// TypeError: (54-60): Expression has to be an lvalue.
diff --git a/test/libsolidity/syntaxTests/functionTypes/delete_function_type.sol b/test/libsolidity/syntaxTests/functionTypes/delete_function_type.sol
index 40c0c86f..a6fe6c22 100644
--- a/test/libsolidity/syntaxTests/functionTypes/delete_function_type.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/delete_function_type.sol
@@ -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.
diff --git a/test/libsolidity/syntaxTests/functionTypes/delete_function_type_invalid.sol b/test/libsolidity/syntaxTests/functionTypes/delete_function_type_invalid.sol
index c2c77be0..60da19e4 100644
--- a/test/libsolidity/syntaxTests/functionTypes/delete_function_type_invalid.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/delete_function_type_invalid.sol
@@ -3,3 +3,5 @@ contract C {
delete f;
}
}
+// ----
+// TypeError: (54-55): Expression has to be an lvalue.
diff --git a/test/libsolidity/syntaxTests/functionTypes/external_function_to_function_type_calldata_parameter.sol b/test/libsolidity/syntaxTests/functionTypes/external_function_to_function_type_calldata_parameter.sol
index cbf90e40..eb4f0693 100644
--- a/test/libsolidity/syntaxTests/functionTypes/external_function_to_function_type_calldata_parameter.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/external_function_to_function_type_calldata_parameter.sol
@@ -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);
}
}
diff --git a/test/libsolidity/syntaxTests/functionTypes/external_function_type_returning_internal.sol b/test/libsolidity/syntaxTests/functionTypes/external_function_type_returning_internal.sol
index c4f56b41..8b14d3dc 100644
--- a/test/libsolidity/syntaxTests/functionTypes/external_function_type_returning_internal.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/external_function_type_returning_internal.sol
@@ -1,3 +1,5 @@
contract C {
function() external returns (function () internal) x;
}
+// ----
+// TypeError: (46-67): Internal type cannot be used for external function type.
diff --git a/test/libsolidity/syntaxTests/functionTypes/external_function_type_taking_internal.sol b/test/libsolidity/syntaxTests/functionTypes/external_function_type_taking_internal.sol
index c3ba80a3..3e264c8c 100644
--- a/test/libsolidity/syntaxTests/functionTypes/external_function_type_taking_internal.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/external_function_type_taking_internal.sol
@@ -1,3 +1,5 @@
contract C {
function(function () internal) external x;
}
+// ----
+// TypeError: (26-47): Internal type cannot be used for external function type.
diff --git a/test/libsolidity/syntaxTests/functionTypes/external_function_type_to_address.sol b/test/libsolidity/syntaxTests/functionTypes/external_function_type_to_address.sol
index 5f4d4065..b86425db 100644
--- a/test/libsolidity/syntaxTests/functionTypes/external_function_type_to_address.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/external_function_type_to_address.sol
@@ -1,5 +1,5 @@
contract C {
- function f() public returns (address) {
+ function f() public view returns (address) {
return address(this.f);
}
}
diff --git a/test/libsolidity/syntaxTests/functionTypes/external_function_type_to_uint.sol b/test/libsolidity/syntaxTests/functionTypes/external_function_type_to_uint.sol
index e47abefb..f4287223 100644
--- a/test/libsolidity/syntaxTests/functionTypes/external_function_type_to_uint.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/external_function_type_to_uint.sol
@@ -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".
diff --git a/test/libsolidity/syntaxTests/functionTypes/function_type.sol b/test/libsolidity/syntaxTests/functionTypes/function_type.sol
index a879e351..23d50136 100644
--- a/test/libsolidity/syntaxTests/functionTypes/function_type.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/function_type.sol
@@ -1,5 +1,6 @@
contract C {
- function f() public {
+ function f() pure public {
function(uint) returns (uint) x;
+ x;
}
}
diff --git a/test/libsolidity/syntaxTests/functionTypes/function_type_arrays.sol b/test/libsolidity/syntaxTests/functionTypes/function_type_arrays.sol
index c402dbff..ec23d637 100644
--- a/test/libsolidity/syntaxTests/functionTypes/function_type_arrays.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/function_type_arrays.sol
@@ -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;
diff --git a/test/libsolidity/syntaxTests/functionTypes/function_type_parameter.sol b/test/libsolidity/syntaxTests/functionTypes/function_type_parameter.sol
index c787e6f0..da66ec8a 100644
--- a/test/libsolidity/syntaxTests/functionTypes/function_type_parameter.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/function_type_parameter.sol
@@ -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;
}
}
diff --git a/test/libsolidity/syntaxTests/functionTypes/function_type_returned.sol b/test/libsolidity/syntaxTests/functionTypes/function_type_returned.sol
index 0590fad4..9cd313c8 100644
--- a/test/libsolidity/syntaxTests/functionTypes/function_type_returned.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/function_type_returned.sol
@@ -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;
}
}
diff --git a/test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter.sol b/test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter.sol
index 3103001d..fa92d559 100644
--- a/test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter.sol
@@ -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.
diff --git a/test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter_in_library_external.sol b/test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter_in_library_external.sol
index 7856d62d..b37fb285 100644
--- a/test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter_in_library_external.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter_in_library_external.sol
@@ -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.
diff --git a/test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter_in_library_internal.sol b/test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter_in_library_internal.sol
index 13d6d03d..7ffa447e 100644
--- a/test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter_in_library_internal.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter_in_library_internal.sol
@@ -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 {
}
}
diff --git a/test/libsolidity/syntaxTests/functionTypes/internal_function_returned_from_public_function.sol b/test/libsolidity/syntaxTests/functionTypes/internal_function_returned_from_public_function.sol
index e836a6cc..41fcd0a4 100644
--- a/test/libsolidity/syntaxTests/functionTypes/internal_function_returned_from_public_function.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/internal_function_returned_from_public_function.sol
@@ -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.
diff --git a/test/libsolidity/syntaxTests/functionTypes/internal_function_type_to_address.sol b/test/libsolidity/syntaxTests/functionTypes/internal_function_type_to_address.sol
index 4a3f02c1..b75a0d43 100644
--- a/test/libsolidity/syntaxTests/functionTypes/internal_function_type_to_address.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/internal_function_type_to_address.sol
@@ -3,3 +3,5 @@ contract C {
return address(f);
}
}
+// ----
+// TypeError: (72-82): Explicit type conversion not allowed from "function () returns (address)" to "address".
diff --git a/test/libsolidity/syntaxTests/functionTypes/payable_internal_function_type.sol b/test/libsolidity/syntaxTests/functionTypes/payable_internal_function_type.sol
index 69efaad4..a7cb9d92 100644
--- a/test/libsolidity/syntaxTests/functionTypes/payable_internal_function_type.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/payable_internal_function_type.sol
@@ -1,3 +1,5 @@
contract C {
function (uint) internal payable returns (uint) x;
}
+// ----
+// TypeError: (17-66): Only external function types can be payable.
diff --git a/test/libsolidity/syntaxTests/functionTypes/payable_internal_function_type_is_not_fatal.sol b/test/libsolidity/syntaxTests/functionTypes/payable_internal_function_type_is_not_fatal.sol
index fb84f9ca..5c6dc056 100644
--- a/test/libsolidity/syntaxTests/functionTypes/payable_internal_function_type_is_not_fatal.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/payable_internal_function_type_is_not_fatal.sol
@@ -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.
diff --git a/test/libsolidity/syntaxTests/functionTypes/private_function_type.sol b/test/libsolidity/syntaxTests/functionTypes/private_function_type.sol
index d15430d2..9d4f0a09 100644
--- a/test/libsolidity/syntaxTests/functionTypes/private_function_type.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/private_function_type.sol
@@ -3,3 +3,5 @@ contract C {
function(uint) private returns (uint) x;
}
}
+// ----
+// TypeError: (47-86): Invalid visibility, can only be "external" or "internal".
diff --git a/test/libsolidity/syntaxTests/functionTypes/public_function_type.sol b/test/libsolidity/syntaxTests/functionTypes/public_function_type.sol
index ecc2493a..756766d3 100644
--- a/test/libsolidity/syntaxTests/functionTypes/public_function_type.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/public_function_type.sol
@@ -3,3 +3,5 @@ contract C {
function(uint) public returns (uint) x;
}
}
+// ----
+// TypeError: (47-85): Invalid visibility, can only be "external" or "internal".
diff --git a/test/libsolidity/syntaxTests/functionTypes/warn_function_type_parameters_with_names.sol b/test/libsolidity/syntaxTests/functionTypes/warn_function_type_parameters_with_names.sol
index 44417f25..072c7eb7 100644
--- a/test/libsolidity/syntaxTests/functionTypes/warn_function_type_parameters_with_names.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/warn_function_type_parameters_with_names.sol
@@ -1,3 +1,5 @@
contract C {
function(uint a) f;
}
+// ----
+// Warning: (26-32): Naming function type parameters is deprecated.
diff --git a/test/libsolidity/syntaxTests/functionTypes/warn_function_type_return_parameters_with_names.sol b/test/libsolidity/syntaxTests/functionTypes/warn_function_type_return_parameters_with_names.sol
index f8c21fa8..67a74e54 100644
--- a/test/libsolidity/syntaxTests/functionTypes/warn_function_type_return_parameters_with_names.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/warn_function_type_return_parameters_with_names.sol
@@ -1,3 +1,5 @@
contract C {
function(uint) returns (bool ret) f;
}
+// ----
+// Warning: (41-49): Naming function type return parameters is deprecated.