From 57ada1d69e311f847b4581a0e487aebd1b0e468f Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Fri, 10 Aug 2018 15:13:12 +0200 Subject: Allow mapping arguments and return values in internal library functions. --- .../syntaxTests/types/mapping/argument_external.sol | 7 +++++++ .../syntaxTests/types/mapping/argument_internal.sol | 7 +++++++ .../libsolidity/syntaxTests/types/mapping/argument_private.sol | 7 +++++++ test/libsolidity/syntaxTests/types/mapping/argument_public.sol | 7 +++++++ .../syntaxTests/types/mapping/library_argument_external.sol | 6 ++++++ .../syntaxTests/types/mapping/library_argument_internal.sol | 4 ++++ .../syntaxTests/types/mapping/library_argument_private.sol | 4 ++++ .../syntaxTests/types/mapping/library_argument_public.sol | 6 ++++++ .../syntaxTests/types/mapping/library_return_external.sol | 10 ++++++++++ .../syntaxTests/types/mapping/library_return_internal.sol | 6 ++++++ .../syntaxTests/types/mapping/library_return_private.sol | 6 ++++++ .../syntaxTests/types/mapping/library_return_public.sol | 10 ++++++++++ 12 files changed, 80 insertions(+) create mode 100644 test/libsolidity/syntaxTests/types/mapping/argument_external.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/argument_internal.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/argument_private.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/argument_public.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/library_argument_external.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/library_argument_internal.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/library_argument_private.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/library_argument_public.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/library_return_external.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/library_return_internal.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/library_return_private.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/library_return_public.sol (limited to 'test/libsolidity/syntaxTests') diff --git a/test/libsolidity/syntaxTests/types/mapping/argument_external.sol b/test/libsolidity/syntaxTests/types/mapping/argument_external.sol new file mode 100644 index 00000000..0354893f --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/argument_external.sol @@ -0,0 +1,7 @@ +contract C { + function f(mapping(uint => uint) storage) external pure { + } +} +// ---- +// TypeError: (28-49): Type is required to live outside storage. +// TypeError: (28-49): Internal or recursive type is not allowed for public or external functions. diff --git a/test/libsolidity/syntaxTests/types/mapping/argument_internal.sol b/test/libsolidity/syntaxTests/types/mapping/argument_internal.sol new file mode 100644 index 00000000..395f5808 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/argument_internal.sol @@ -0,0 +1,7 @@ +// This is expected to fail now, but may work in the future. +contract C { + function f(mapping(uint => uint) storage) internal pure { + } +} +// ---- +// TypeError: (89-110): Type is required to live outside storage. diff --git a/test/libsolidity/syntaxTests/types/mapping/argument_private.sol b/test/libsolidity/syntaxTests/types/mapping/argument_private.sol new file mode 100644 index 00000000..0360514e --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/argument_private.sol @@ -0,0 +1,7 @@ +// This is expected to fail now, but may work in the future. +contract C { + function f(mapping(uint => uint) storage) private pure { + } +} +// ---- +// TypeError: (89-110): Type is required to live outside storage. diff --git a/test/libsolidity/syntaxTests/types/mapping/argument_public.sol b/test/libsolidity/syntaxTests/types/mapping/argument_public.sol new file mode 100644 index 00000000..e4121c7f --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/argument_public.sol @@ -0,0 +1,7 @@ +contract C { + function f(mapping(uint => uint) storage) public pure { + } +} +// ---- +// TypeError: (28-49): Type is required to live outside storage. +// TypeError: (28-49): Internal or recursive type is not allowed for public or external functions. diff --git a/test/libsolidity/syntaxTests/types/mapping/library_argument_external.sol b/test/libsolidity/syntaxTests/types/mapping/library_argument_external.sol new file mode 100644 index 00000000..e78c6930 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/library_argument_external.sol @@ -0,0 +1,6 @@ +library L { + function f(mapping(uint => uint) storage) external pure { + } +} +// ---- +// TypeError: (27-48): Type is required to live outside storage. diff --git a/test/libsolidity/syntaxTests/types/mapping/library_argument_internal.sol b/test/libsolidity/syntaxTests/types/mapping/library_argument_internal.sol new file mode 100644 index 00000000..1228b6b6 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/library_argument_internal.sol @@ -0,0 +1,4 @@ +library L { + function f(mapping(uint => uint) storage) internal pure { + } +} diff --git a/test/libsolidity/syntaxTests/types/mapping/library_argument_private.sol b/test/libsolidity/syntaxTests/types/mapping/library_argument_private.sol new file mode 100644 index 00000000..5eaff16b --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/library_argument_private.sol @@ -0,0 +1,4 @@ +library L { + function f(mapping(uint => uint) storage) private pure { + } +} diff --git a/test/libsolidity/syntaxTests/types/mapping/library_argument_public.sol b/test/libsolidity/syntaxTests/types/mapping/library_argument_public.sol new file mode 100644 index 00000000..56393b68 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/library_argument_public.sol @@ -0,0 +1,6 @@ +library L { + function f(mapping(uint => uint) storage) public pure { + } +} +// ---- +// TypeError: (27-48): Type is required to live outside storage. diff --git a/test/libsolidity/syntaxTests/types/mapping/library_return_external.sol b/test/libsolidity/syntaxTests/types/mapping/library_return_external.sol new file mode 100644 index 00000000..a3bb1c32 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/library_return_external.sol @@ -0,0 +1,10 @@ +library L +{ + function f(mapping(uint => uint) storage a, mapping(uint => uint) storage b, bool c) external pure returns(mapping(uint => uint) storage) { + return c ? a : b; + } +} +// ---- +// TypeError: (27-58): Type is required to live outside storage. +// TypeError: (60-91): Type is required to live outside storage. +// TypeError: (123-144): Type is required to live outside storage. diff --git a/test/libsolidity/syntaxTests/types/mapping/library_return_internal.sol b/test/libsolidity/syntaxTests/types/mapping/library_return_internal.sol new file mode 100644 index 00000000..d0fca6bf --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/library_return_internal.sol @@ -0,0 +1,6 @@ +library L +{ + function f(mapping(uint => uint) storage a, mapping(uint => uint) storage b, bool c) internal pure returns(mapping(uint => uint) storage) { + return c ? a : b; + } +} diff --git a/test/libsolidity/syntaxTests/types/mapping/library_return_private.sol b/test/libsolidity/syntaxTests/types/mapping/library_return_private.sol new file mode 100644 index 00000000..13c2000f --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/library_return_private.sol @@ -0,0 +1,6 @@ +library L +{ + function f(mapping(uint => uint) storage a, mapping(uint => uint) storage b, bool c) private pure returns(mapping(uint => uint) storage) { + return c ? a : b; + } +} diff --git a/test/libsolidity/syntaxTests/types/mapping/library_return_public.sol b/test/libsolidity/syntaxTests/types/mapping/library_return_public.sol new file mode 100644 index 00000000..ac52d677 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/library_return_public.sol @@ -0,0 +1,10 @@ +library L +{ + function f(mapping(uint => uint) storage a, mapping(uint => uint) storage b, bool c) public pure returns(mapping(uint => uint) storage) { + return c ? a : b; + } +} +// ---- +// TypeError: (27-58): Type is required to live outside storage. +// TypeError: (60-91): Type is required to live outside storage. +// TypeError: (121-142): Type is required to live outside storage. -- cgit From a9f31da41146221c674356d5678030616110d471 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Fri, 10 Aug 2018 15:56:29 +0200 Subject: Allow mapping arguments and return values in all internal functions. --- test/libsolidity/syntaxTests/types/mapping/argument_internal.sol | 2 -- test/libsolidity/syntaxTests/types/mapping/argument_private.sol | 2 -- .../syntaxTests/types/mapping/mapping_return_internal.sol | 5 ----- 3 files changed, 9 deletions(-) (limited to 'test/libsolidity/syntaxTests') diff --git a/test/libsolidity/syntaxTests/types/mapping/argument_internal.sol b/test/libsolidity/syntaxTests/types/mapping/argument_internal.sol index 395f5808..3c021515 100644 --- a/test/libsolidity/syntaxTests/types/mapping/argument_internal.sol +++ b/test/libsolidity/syntaxTests/types/mapping/argument_internal.sol @@ -1,7 +1,5 @@ -// This is expected to fail now, but may work in the future. contract C { function f(mapping(uint => uint) storage) internal pure { } } // ---- -// TypeError: (89-110): Type is required to live outside storage. diff --git a/test/libsolidity/syntaxTests/types/mapping/argument_private.sol b/test/libsolidity/syntaxTests/types/mapping/argument_private.sol index 0360514e..63733d71 100644 --- a/test/libsolidity/syntaxTests/types/mapping/argument_private.sol +++ b/test/libsolidity/syntaxTests/types/mapping/argument_private.sol @@ -1,7 +1,5 @@ -// This is expected to fail now, but may work in the future. contract C { function f(mapping(uint => uint) storage) private pure { } } // ---- -// TypeError: (89-110): Type is required to live outside storage. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_return_internal.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_return_internal.sol index a46003f8..4912836e 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_return_internal.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_return_internal.sol @@ -1,4 +1,3 @@ -// This should be allowed in a future release. contract C { mapping(uint=>uint) m; function f() internal view returns (mapping(uint=>uint) storage) { @@ -15,7 +14,3 @@ contract C { } } // ---- -// TypeError: (127-146): Type is required to live outside storage. -// TypeError: (221-240): Type is required to live outside storage. -// TypeError: (316-345): Type is required to live outside storage. -// TypeError: (409-438): Type is required to live outside storage. -- cgit From 4ae59acc098c2ede9a2dc44e741a28df49cc59d2 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Fri, 10 Aug 2018 16:15:39 +0200 Subject: Consider mappings return values in control flow analysis. --- test/libsolidity/syntaxTests/controlFlow/mappingReturn/named_err.sol | 5 +++++ .../libsolidity/syntaxTests/controlFlow/mappingReturn/named_fine.sol | 5 +++++ .../syntaxTests/controlFlow/mappingReturn/unnamed_err.sol | 5 +++++ .../syntaxTests/controlFlow/mappingReturn/unnamed_fine.sol | 5 +++++ 4 files changed, 20 insertions(+) create mode 100644 test/libsolidity/syntaxTests/controlFlow/mappingReturn/named_err.sol create mode 100644 test/libsolidity/syntaxTests/controlFlow/mappingReturn/named_fine.sol create mode 100644 test/libsolidity/syntaxTests/controlFlow/mappingReturn/unnamed_err.sol create mode 100644 test/libsolidity/syntaxTests/controlFlow/mappingReturn/unnamed_fine.sol (limited to 'test/libsolidity/syntaxTests') diff --git a/test/libsolidity/syntaxTests/controlFlow/mappingReturn/named_err.sol b/test/libsolidity/syntaxTests/controlFlow/mappingReturn/named_err.sol new file mode 100644 index 00000000..35420b6d --- /dev/null +++ b/test/libsolidity/syntaxTests/controlFlow/mappingReturn/named_err.sol @@ -0,0 +1,5 @@ +contract C { + function f() internal pure returns (mapping(uint=>uint) storage r) { } +} +// ---- +// TypeError: (53-82): This variable is of storage pointer type and might be returned without assignment and could be used uninitialized. Assign the variable (potentially from itself) to fix this error. diff --git a/test/libsolidity/syntaxTests/controlFlow/mappingReturn/named_fine.sol b/test/libsolidity/syntaxTests/controlFlow/mappingReturn/named_fine.sol new file mode 100644 index 00000000..4146192f --- /dev/null +++ b/test/libsolidity/syntaxTests/controlFlow/mappingReturn/named_fine.sol @@ -0,0 +1,5 @@ +contract C { + mapping(uint=>uint) m; + function f() internal view returns (mapping(uint=>uint) storage r) { r = m; } +} +// ---- diff --git a/test/libsolidity/syntaxTests/controlFlow/mappingReturn/unnamed_err.sol b/test/libsolidity/syntaxTests/controlFlow/mappingReturn/unnamed_err.sol new file mode 100644 index 00000000..7e8c4501 --- /dev/null +++ b/test/libsolidity/syntaxTests/controlFlow/mappingReturn/unnamed_err.sol @@ -0,0 +1,5 @@ +contract C { + function f() internal pure returns (mapping(uint=>uint) storage) {} +} +// ---- +// TypeError: (53-72): This variable is of storage pointer type and might be returned without assignment and could be used uninitialized. Assign the variable (potentially from itself) to fix this error. diff --git a/test/libsolidity/syntaxTests/controlFlow/mappingReturn/unnamed_fine.sol b/test/libsolidity/syntaxTests/controlFlow/mappingReturn/unnamed_fine.sol new file mode 100644 index 00000000..9c5e3149 --- /dev/null +++ b/test/libsolidity/syntaxTests/controlFlow/mappingReturn/unnamed_fine.sol @@ -0,0 +1,5 @@ +contract C { + mapping(uint=>uint) m; + function f() internal view returns (mapping(uint=>uint) storage) { return m; } +} +// ---- -- cgit From 341128962f001eb78e5e3e3a83beadbef8d697b0 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Mon, 13 Aug 2018 16:25:28 +0200 Subject: Allow mappings of arrays as arguments and return values of internal functions. --- .../types/mapping/array_argument_external.sol | 6 ++++++ .../types/mapping/array_argument_internal.sol | 5 +++++ .../syntaxTests/types/mapping/array_argument_private.sol | 5 +++++ .../syntaxTests/types/mapping/array_argument_public.sol | 6 ++++++ .../types/mapping/library_array_argument_external.sol | 6 ++++++ .../types/mapping/library_array_argument_internal.sol | 4 ++++ .../types/mapping/library_array_argument_private.sol | 4 ++++ .../types/mapping/library_array_argument_public.sol | 6 ++++++ .../types/mapping/mapping_array_return_external.sol | 6 ++++++ .../types/mapping/mapping_array_return_internal.sol | 16 ++++++++++++++++ .../types/mapping/mapping_array_return_public.sol | 6 ++++++ 11 files changed, 70 insertions(+) create mode 100644 test/libsolidity/syntaxTests/types/mapping/array_argument_external.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/array_argument_internal.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/array_argument_private.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/array_argument_public.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/library_array_argument_external.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/library_array_argument_internal.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/library_array_argument_private.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/library_array_argument_public.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/mapping_array_return_external.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/mapping_array_return_internal.sol create mode 100644 test/libsolidity/syntaxTests/types/mapping/mapping_array_return_public.sol (limited to 'test/libsolidity/syntaxTests') diff --git a/test/libsolidity/syntaxTests/types/mapping/array_argument_external.sol b/test/libsolidity/syntaxTests/types/mapping/array_argument_external.sol new file mode 100644 index 00000000..8dea6907 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/array_argument_external.sol @@ -0,0 +1,6 @@ +contract C { + function f(mapping(uint => uint)[] storage) external pure { + } +} +// ---- +// TypeError: (28-51): Location has to be calldata for external functions (remove the "memory" or "storage" keyword). diff --git a/test/libsolidity/syntaxTests/types/mapping/array_argument_internal.sol b/test/libsolidity/syntaxTests/types/mapping/array_argument_internal.sol new file mode 100644 index 00000000..352d0982 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/array_argument_internal.sol @@ -0,0 +1,5 @@ +contract C { + function f(mapping(uint => uint)[] storage) internal pure { + } +} +// ---- diff --git a/test/libsolidity/syntaxTests/types/mapping/array_argument_private.sol b/test/libsolidity/syntaxTests/types/mapping/array_argument_private.sol new file mode 100644 index 00000000..332dbe6c --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/array_argument_private.sol @@ -0,0 +1,5 @@ +contract C { + function f(mapping(uint => uint)[] storage) private pure { + } +} +// ---- diff --git a/test/libsolidity/syntaxTests/types/mapping/array_argument_public.sol b/test/libsolidity/syntaxTests/types/mapping/array_argument_public.sol new file mode 100644 index 00000000..69dcec01 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/array_argument_public.sol @@ -0,0 +1,6 @@ +contract C { + function f(mapping(uint => uint)[] storage) public pure { + } +} +// ---- +// TypeError: (28-51): Location has to be memory for publicly visible functions (remove the "storage" or "calldata" keyword). diff --git a/test/libsolidity/syntaxTests/types/mapping/library_array_argument_external.sol b/test/libsolidity/syntaxTests/types/mapping/library_array_argument_external.sol new file mode 100644 index 00000000..f5691675 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/library_array_argument_external.sol @@ -0,0 +1,6 @@ +library L { + function f(mapping(uint => uint)[] storage) external pure { + } +} +// ---- +// TypeError: (27-50): Type is required to live outside storage. diff --git a/test/libsolidity/syntaxTests/types/mapping/library_array_argument_internal.sol b/test/libsolidity/syntaxTests/types/mapping/library_array_argument_internal.sol new file mode 100644 index 00000000..55c1cea0 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/library_array_argument_internal.sol @@ -0,0 +1,4 @@ +library L { + function f(mapping(uint => uint)[] storage) internal pure { + } +} diff --git a/test/libsolidity/syntaxTests/types/mapping/library_array_argument_private.sol b/test/libsolidity/syntaxTests/types/mapping/library_array_argument_private.sol new file mode 100644 index 00000000..d37d6504 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/library_array_argument_private.sol @@ -0,0 +1,4 @@ +library L { + function f(mapping(uint => uint)[] storage) private pure { + } +} diff --git a/test/libsolidity/syntaxTests/types/mapping/library_array_argument_public.sol b/test/libsolidity/syntaxTests/types/mapping/library_array_argument_public.sol new file mode 100644 index 00000000..bb06d4bc --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/library_array_argument_public.sol @@ -0,0 +1,6 @@ +library L { + function f(mapping(uint => uint)[] storage) public pure { + } +} +// ---- +// TypeError: (27-50): Type is required to live outside storage. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_external.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_external.sol new file mode 100644 index 00000000..dbe030fb --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_external.sol @@ -0,0 +1,6 @@ +contract C { + function f() external pure returns (mapping(uint=>uint)[] storage m) { + } +} +// ---- +// TypeError: (53-84): Location has to be memory for publicly visible functions (remove the "storage" or "calldata" keyword). diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_internal.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_internal.sol new file mode 100644 index 00000000..8837c745 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_internal.sol @@ -0,0 +1,16 @@ +contract C { + mapping(uint=>uint)[] m; + function f() internal view returns (mapping(uint=>uint)[] storage) { + return m; + } + function g() private view returns (mapping(uint=>uint)[] storage) { + return m; + } + function h() internal view returns (mapping(uint=>uint)[] storage r) { + r = m; + } + function i() private view returns (mapping(uint=>uint)[] storage r) { + (r,r) = (m,m); + } +} +// ---- diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_public.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_public.sol new file mode 100644 index 00000000..7dfecf19 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_public.sol @@ -0,0 +1,6 @@ +contract C { + function f() public pure returns (mapping(uint=>uint)[] storage m) { + } +} +// ---- +// TypeError: (51-82): Location has to be memory for publicly visible functions (remove the "storage" or "calldata" keyword). -- cgit 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 (limited to 'test/libsolidity/syntaxTests') 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