aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/syntaxTests
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2018-07-24 07:50:46 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-07-25 17:55:23 +0800
commitee85430f93e1ec89725246d6067f58dfcc28de7f (patch)
tree3f5e7d8c398c1df1ad519c2f9aebfeb0d340afb3 /test/libsolidity/syntaxTests
parent167fe7c3706ba19713cd5727b62e7f019ad664d6 (diff)
downloaddexon-solidity-ee85430f93e1ec89725246d6067f58dfcc28de7f.tar.gz
dexon-solidity-ee85430f93e1ec89725246d6067f58dfcc28de7f.tar.zst
dexon-solidity-ee85430f93e1ec89725246d6067f58dfcc28de7f.zip
Add tests for data locations within libraries
Diffstat (limited to 'test/libsolidity/syntaxTests')
-rw-r--r--test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_calldata.sol3
-rw-r--r--test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_memory.sol5
-rw-r--r--test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_storage.sol3
-rw-r--r--test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_calldata.sol5
-rw-r--r--test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_memory.sol3
-rw-r--r--test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_storage.sol3
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 {}
+}