From dfcfc4c35bca01b6a70c1a03be3997c37ffb5d35 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Mon, 13 Aug 2018 16:29:47 +0200 Subject: Add tests for mappings in function types. --- .../syntaxTests/types/mapping/function_type_argument_external.sol | 6 ++++++ .../syntaxTests/types/mapping/function_type_argument_internal.sol | 4 ++++ .../syntaxTests/types/mapping/function_type_return_external.sol | 6 ++++++ .../syntaxTests/types/mapping/function_type_return_internal.sol | 4 ++++ 4 files changed, 20 insertions(+) create mode 100644 test/libsolidity/syntaxTests/types/mapping/function_type_argument_external.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/function_type_argument_internal.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/function_type_return_external.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/function_type_return_internal.sol 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 { + } +} -- cgit