aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorDaniel Kirchner <daniel@ekpyron.org>2018-08-13 22:29:47 +0800
committerDaniel Kirchner <daniel@ekpyron.org>2018-08-13 22:33:37 +0800
commitdfcfc4c35bca01b6a70c1a03be3997c37ffb5d35 (patch)
tree027cfe23d49870840bc2f6d7a0aa7d4daf239891 /test/libsolidity
parent341128962f001eb78e5e3e3a83beadbef8d697b0 (diff)
downloaddexon-solidity-dfcfc4c35bca01b6a70c1a03be3997c37ffb5d35.tar.gz
dexon-solidity-dfcfc4c35bca01b6a70c1a03be3997c37ffb5d35.tar.zst
dexon-solidity-dfcfc4c35bca01b6a70c1a03be3997c37ffb5d35.zip
Add tests for mappings in function types.
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/syntaxTests/types/mapping/function_type_argument_external.sol6
-rw-r--r--test/libsolidity/syntaxTests/types/mapping/function_type_argument_internal.sol4
-rw-r--r--test/libsolidity/syntaxTests/types/mapping/function_type_return_external.sol6
-rw-r--r--test/libsolidity/syntaxTests/types/mapping/function_type_return_internal.sol4
4 files changed, 20 insertions, 0 deletions
diff --git a/test/libsolidity/syntaxTests/types/mapping/function_type_argument_external.sol b/test/libsolidity/syntaxTests/types/mapping/function_type_argument_external.sol
new file mode 100644
index 00000000..7fe74fb6
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/mapping/function_type_argument_external.sol
@@ -0,0 +1,6 @@
+contract C {
+ function f(function(mapping(uint=>uint) storage) external) public pure {
+ }
+}
+// ----
+// TypeError: (37-56): Internal type cannot be used for external function type.
diff --git a/test/libsolidity/syntaxTests/types/mapping/function_type_argument_internal.sol b/test/libsolidity/syntaxTests/types/mapping/function_type_argument_internal.sol
new file mode 100644
index 00000000..01e2322e
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/mapping/function_type_argument_internal.sol
@@ -0,0 +1,4 @@
+contract C {
+ function f(function(mapping(uint=>uint) storage) internal) internal pure {
+ }
+}
diff --git a/test/libsolidity/syntaxTests/types/mapping/function_type_return_external.sol b/test/libsolidity/syntaxTests/types/mapping/function_type_return_external.sol
new file mode 100644
index 00000000..f0f8dea6
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/mapping/function_type_return_external.sol
@@ -0,0 +1,6 @@
+contract C {
+ function f(function() external returns (mapping(uint=>uint) storage)) public pure {
+ }
+}
+// ----
+// TypeError: (57-76): Internal type cannot be used for external function type.
diff --git a/test/libsolidity/syntaxTests/types/mapping/function_type_return_internal.sol b/test/libsolidity/syntaxTests/types/mapping/function_type_return_internal.sol
new file mode 100644
index 00000000..bd298e5d
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/mapping/function_type_return_internal.sol
@@ -0,0 +1,4 @@
+contract C {
+ function f(function() internal returns (mapping(uint=>uint) storage)) internal pure {
+ }
+}