Fix check that mappings can only have storage location

This commit is contained in:
Mathias Baumann
2019-02-05 18:06:42 +01:00
parent d7e2838702
commit 77f407d450
6 changed files with 19 additions and 9 deletions
@@ -2,5 +2,5 @@ contract c {
function f1(mapping(uint => uint) calldata) pure external returns (mapping(uint => uint) memory) {}
}
// ----
// TypeError: (29-59): Mapping types for parameters or return variables can only be used in internal or library functions.
// TypeError: (84-112): Mapping types for parameters or return variables can only be used in internal or library functions.
// TypeError: (29-59): Mapping types can only have a data location of "storage" and thus only be parameters or return variables for internal or library functions.
// TypeError: (84-112): Mapping types can only have a data location of "storage" and thus only be parameters or return variables for internal or library functions.
@@ -1,4 +1,6 @@
contract c {
function f4(mapping(uint => uint) memory) pure internal {}
function f4(mapping(uint => uint) storage) pure internal {}
function f5(mapping(uint => uint) memory) pure internal {}
}
// ----
// TypeError: (93-121): Mapping types can only have a data location of "storage".
@@ -2,4 +2,4 @@ contract c {
function f3(mapping(uint => uint) memory) view public {}
}
// ----
// TypeError: (29-57): Mapping types for parameters or return variables can only be used in internal or library functions.
// TypeError: (29-57): Mapping types can only have a data location of "storage" and thus only be parameters or return variables for internal or library functions.
@@ -3,4 +3,4 @@ contract C {
}
}
// ----
// TypeError: (51-79): Mapping types for parameters or return variables can only be used in internal or library functions.
// TypeError: (51-79): Mapping types can only have a data location of "storage" and thus only be parameters or return variables for internal or library functions.