Add tests for data locations within libraries

This commit is contained in:
Alex Beregszaszi 2018-07-24 00:50:46 +01:00
parent 167fe7c370
commit ee85430f93
6 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,3 @@
library test {
function f(bytes calldata) external;
}

View File

@ -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).

View File

@ -0,0 +1,3 @@
library test {
function f(bytes storage) external;
}

View File

@ -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).

View File

@ -0,0 +1,3 @@
library test {
function f(bytes memory) internal pure {}
}

View File

@ -0,0 +1,3 @@
library test {
function f(bytes storage) internal pure {}
}