diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2018-07-26 01:03:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-26 01:03:30 +0800 |
commit | 61b94b7ea4b4a1120649d12193b1ce1f5ade0aa8 (patch) | |
tree | 112b55736df6510603ce91b5c461be514ac109b6 /test | |
parent | 5a1b6856b49cfd5a99294a35cd764fb0053dff60 (diff) | |
parent | ee85430f93e1ec89725246d6067f58dfcc28de7f (diff) | |
download | dexon-solidity-61b94b7ea4b4a1120649d12193b1ce1f5ade0aa8.tar.gz dexon-solidity-61b94b7ea4b4a1120649d12193b1ce1f5ade0aa8.tar.zst dexon-solidity-61b94b7ea4b4a1120649d12193b1ce1f5ade0aa8.zip |
Merge pull request #4556 from ethereum/library-data-locations
Add tests for data locations within libraries
Diffstat (limited to 'test')
6 files changed, 22 insertions, 0 deletions
diff --git a/test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_calldata.sol b/test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_calldata.sol new file mode 100644 index 00000000..d3ac2acc --- /dev/null +++ b/test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_calldata.sol @@ -0,0 +1,3 @@ +library test { + function f(bytes calldata) external; +} diff --git a/test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_memory.sol b/test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_memory.sol new file mode 100644 index 00000000..6fa0a152 --- /dev/null +++ b/test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_memory.sol @@ -0,0 +1,5 @@ +library test { + function f(bytes memory) external; +} +// ---- +// TypeError: (30-35): Location has to be calldata or storage for external library functions (remove the "memory" keyword). diff --git a/test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_storage.sol b/test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_storage.sol new file mode 100644 index 00000000..2ee68ef9 --- /dev/null +++ b/test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_storage.sol @@ -0,0 +1,3 @@ +library test { + function f(bytes storage) external; +} diff --git a/test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_calldata.sol b/test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_calldata.sol new file mode 100644 index 00000000..868c5c30 --- /dev/null +++ b/test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_calldata.sol @@ -0,0 +1,5 @@ +library test { + function f(bytes calldata) internal pure {} +} +// ---- +// TypeError: (30-35): Variable cannot be declared as "calldata" (remove the "calldata" keyword). diff --git a/test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_memory.sol b/test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_memory.sol new file mode 100644 index 00000000..78a30f5b --- /dev/null +++ b/test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_memory.sol @@ -0,0 +1,3 @@ +library test { + function f(bytes memory) internal pure {} +} diff --git a/test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_storage.sol b/test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_storage.sol new file mode 100644 index 00000000..b51f148b --- /dev/null +++ b/test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_storage.sol @@ -0,0 +1,3 @@ +library test { + function f(bytes storage) internal pure {} +} |