Merge pull request #4556 from ethereum/library-data-locations

Add tests for data locations within libraries
This commit is contained in:
Alex Beregszaszi 2018-07-25 18:03:30 +01:00 committed by GitHub
commit 61b94b7ea4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 {}
}