mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4738 from ethereum/dataloc_merged
Enforce data location.
This commit is contained in:
@@ -140,7 +140,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
||||
}
|
||||
return (true, false, 0);
|
||||
}
|
||||
function replaceModule(string name, address addr, bool callCallback) external returns (bool success) {
|
||||
function replaceModule(string calldata name, address addr, bool callCallback) external returns (bool success) {
|
||||
/*
|
||||
Module replace, can be called only by the Publisher contract.
|
||||
|
||||
@@ -167,7 +167,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
||||
return true;
|
||||
}
|
||||
|
||||
function callReplaceCallback(string moduleName, address newModule) external returns (bool success) {
|
||||
function callReplaceCallback(string calldata moduleName, address newModule) external returns (bool success) {
|
||||
require( block.number < debugModeUntil );
|
||||
if ( ! insertAndCheckDo(calcDoHash("callReplaceCallback", keccak256(abi.encodePacked(moduleName, newModule)))) ) {
|
||||
return true;
|
||||
@@ -178,7 +178,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
||||
return true;
|
||||
}
|
||||
|
||||
function newModule(string name, address addr, bool schellingEvent, bool transferEvent) external returns (bool success) {
|
||||
function newModule(string calldata name, address addr, bool schellingEvent, bool transferEvent) external returns (bool success) {
|
||||
/*
|
||||
Adding new module to the database. Can be called only by the Publisher contract.
|
||||
|
||||
@@ -199,7 +199,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
||||
addModule( modules_s(addr, keccak256(bytes(name)), schellingEvent, transferEvent), true);
|
||||
return true;
|
||||
}
|
||||
function dropModule(string name, bool callCallback) external returns (bool success) {
|
||||
function dropModule(string calldata name, bool callCallback) external returns (bool success) {
|
||||
/*
|
||||
Deleting module from the database. Can be called only by the Publisher contract.
|
||||
|
||||
@@ -224,7 +224,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
||||
return true;
|
||||
}
|
||||
|
||||
function callDisableCallback(string moduleName) external returns (bool success) {
|
||||
function callDisableCallback(string calldata moduleName) external returns (bool success) {
|
||||
require( block.number < debugModeUntil );
|
||||
if ( ! insertAndCheckDo(calcDoHash("callDisableCallback", keccak256(bytes(moduleName)))) ) {
|
||||
return true;
|
||||
@@ -406,7 +406,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
||||
require( token(modules[_id].addr).burn(from, value) );
|
||||
return true;
|
||||
}
|
||||
function configureModule(string moduleName, announcementType aType, uint256 value) external returns (bool success) {
|
||||
function configureModule(string calldata moduleName, announcementType aType, uint256 value) external returns (bool success) {
|
||||
/*
|
||||
Changing configuration of a module. Can be called only by Publisher or while debug mode by owners.
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ import "./tokenDB.sol";
|
||||
import "./module.sol";
|
||||
|
||||
contract thirdPartyPContractAbstract {
|
||||
function receiveCorionPremiumToken(address, uint256, bytes) external returns (bool, uint256) {}
|
||||
function approvedCorionPremiumToken(address, uint256, bytes) external returns (bool) {}
|
||||
function receiveCorionPremiumToken(address, uint256, bytes calldata) external returns (bool, uint256) {}
|
||||
function approvedCorionPremiumToken(address, uint256, bytes calldata) external returns (bool) {}
|
||||
}
|
||||
|
||||
contract ptokenDB is tokenDB {}
|
||||
@@ -108,7 +108,7 @@ contract premium is module, safeMath {
|
||||
* @param extraData Data to give forward to the receiver
|
||||
* @return True if the approval was successful
|
||||
*/
|
||||
function approveAndCall(address spender, uint256 amount, uint256 nonce, bytes extraData) isReady external returns (bool success) {
|
||||
function approveAndCall(address spender, uint256 amount, uint256 nonce, bytes calldata extraData) isReady external returns (bool success) {
|
||||
/*
|
||||
Authorize another address to use an exact amount of the principal’s balance.
|
||||
After the transaction the approvedCorionPremiumToken function of the address will be called with the given data.
|
||||
@@ -226,7 +226,7 @@ contract premium is module, safeMath {
|
||||
* @param extraData Data to give forward to the receiver
|
||||
* @return Whether the transfer was successful or not
|
||||
*/
|
||||
function transfer(address to, uint256 amount, bytes extraData) isReady external returns (bool success) {
|
||||
function transfer(address to, uint256 amount, bytes calldata extraData) isReady external returns (bool success) {
|
||||
/*
|
||||
Launch a transaction where we transfer from a given address to another one.
|
||||
After thetransaction the approvedCorionPremiumToken function of the receiver’s address is going to be called with the given data.
|
||||
|
||||
@@ -213,7 +213,7 @@ contract provider is module, safeMath, announcementTypes {
|
||||
return ( ! priv && ( rate >= publicMinRate && rate <= publicMaxRate ) ) ||
|
||||
( priv && ( rate >= privateMinRate && rate <= privateMaxRate ) );
|
||||
}
|
||||
function createProvider(bool priv, string name, string website, string country, string info, uint8 rate, bool isForRent, address admin) isReady external {
|
||||
function createProvider(bool priv, string calldata name, string calldata website, string calldata country, string calldata info, uint8 rate, bool isForRent, address admin) isReady external {
|
||||
/*
|
||||
Creating a provider.
|
||||
During the ICO its not allowed to create provider.
|
||||
@@ -270,7 +270,7 @@ contract provider is module, safeMath, announcementTypes {
|
||||
}
|
||||
emit EProviderOpen(msg.sender, currHeight);
|
||||
}
|
||||
function setProviderDetails(address addr, string website, string country, string info, uint8 rate, address admin) isReady external {
|
||||
function setProviderDetails(address addr, string calldata website, string calldata country, string calldata info, uint8 rate, address admin) isReady external {
|
||||
/*
|
||||
Modifying the datas of the provider.
|
||||
This can only be invited by the provider’s admin.
|
||||
@@ -369,7 +369,7 @@ contract provider is module, safeMath, announcementTypes {
|
||||
setRightForInterest(getProviderCurrentSupply(msg.sender), 0, providers[msg.sender].data[currHeight].priv);
|
||||
emit EProviderClose(msg.sender, currHeight);
|
||||
}
|
||||
function allowUsers(address provider, address[] addr) isReady external {
|
||||
function allowUsers(address provider, address[] calldata addr) isReady external {
|
||||
/*
|
||||
Permition of the user to be able to connect to the provider.
|
||||
This can only be invited by the provider’s admin.
|
||||
@@ -387,7 +387,7 @@ contract provider is module, safeMath, announcementTypes {
|
||||
providers[provider].data[currHeight].allowedUsers[addr[a]] = true;
|
||||
}
|
||||
}
|
||||
function disallowUsers(address provider, address[] addr) isReady external {
|
||||
function disallowUsers(address provider, address[] calldata addr) isReady external {
|
||||
/*
|
||||
Disable of the user not to be able to connect to the provider.
|
||||
It is can called only for the admin of the provider.
|
||||
|
||||
@@ -116,7 +116,7 @@ contract publisher is announcementTypes, module, safeMath {
|
||||
return _amount * oppositeRate / 100 > weight;
|
||||
}
|
||||
|
||||
function newAnnouncement(announcementType Type, string Announcement, string Link, bool Oppositable, string _str, uint256 _uint, address _addr) onlyOwner external {
|
||||
function newAnnouncement(announcementType Type, string calldata Announcement, string calldata Link, bool Oppositable, string calldata _str, uint256 _uint, address _addr) onlyOwner external {
|
||||
/*
|
||||
New announcement. Can be called only by those in the admin list
|
||||
|
||||
|
||||
@@ -310,7 +310,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
||||
|
||||
setRound(currentRound, round);
|
||||
}
|
||||
function sendVote(string vote) isReady noContract external {
|
||||
function sendVote(string calldata vote) isReady noContract external {
|
||||
/*
|
||||
Check vote (Envelope opening)
|
||||
Only the sent “envelopes” can be opened.
|
||||
|
||||
@@ -7,8 +7,8 @@ import "./moduleHandler.sol";
|
||||
import "./tokenDB.sol";
|
||||
|
||||
contract thirdPartyContractAbstract {
|
||||
function receiveCorionToken(address, uint256, bytes) external returns (bool, uint256) {}
|
||||
function approvedCorionToken(address, uint256, bytes) external returns (bool) {}
|
||||
function receiveCorionToken(address, uint256, bytes calldata) external returns (bool, uint256) {}
|
||||
function approvedCorionToken(address, uint256, bytes calldata) external returns (bool) {}
|
||||
}
|
||||
|
||||
contract token is safeMath, module, announcementTypes {
|
||||
@@ -123,7 +123,7 @@ contract token is safeMath, module, announcementTypes {
|
||||
* @param extraData Data to give forward to the receiver
|
||||
* @return True if the approval was successful
|
||||
*/
|
||||
function approveAndCall(address spender, uint256 amount, uint256 nonce, bytes extraData) isReady external returns (bool success) {
|
||||
function approveAndCall(address spender, uint256 amount, uint256 nonce, bytes calldata extraData) isReady external returns (bool success) {
|
||||
/*
|
||||
Authorise another address to use a certain quantity of the authorising owner’s balance
|
||||
Following the transaction the receiver address `approvedCorionToken` function is called by the given data
|
||||
@@ -267,7 +267,7 @@ contract token is safeMath, module, announcementTypes {
|
||||
* @param extraData Data to give forward to the receiver
|
||||
* @return Whether the transfer was successful or not
|
||||
*/
|
||||
function transfer(address to, uint256 amount, bytes extraData) isReady external returns (bool success) {
|
||||
function transfer(address to, uint256 amount, bytes calldata extraData) isReady external returns (bool success) {
|
||||
/*
|
||||
Start transaction to send a quantity from a given address to another address
|
||||
After transaction the function `receiveCorionToken`of the receiver is called by the given data
|
||||
|
||||
@@ -55,7 +55,7 @@ contract MultisigWallet is Multisig, Shareable, DayLimit {
|
||||
* @param _value The value to send
|
||||
* @param _data The data part of the transaction
|
||||
*/
|
||||
function execute(address _to, uint256 _value, bytes _data) external onlyOwner returns (bytes32 _r) {
|
||||
function execute(address _to, uint256 _value, bytes calldata _data) external onlyOwner returns (bytes32 _r) {
|
||||
// first, take the opportunity to check that we're under the daily limit.
|
||||
if (underLimit(_value)) {
|
||||
emit SingleTransact(msg.sender, _value, _to, _data);
|
||||
|
||||
@@ -18,7 +18,7 @@ contract HasNoTokens is Ownable {
|
||||
* @param value_ uint256 the amount of the specified token
|
||||
* @param data_ Bytes The data passed from the caller.
|
||||
*/
|
||||
function tokenFallback(address from_, uint256 value_, bytes data_) external {
|
||||
function tokenFallback(address from_, uint256 value_, bytes calldata data_) external {
|
||||
revert();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,6 @@ contract Multisig {
|
||||
|
||||
// TODO: document
|
||||
function changeOwner(address _from, address _to) external;
|
||||
function execute(address _to, uint256 _value, bytes _data) external returns (bytes32);
|
||||
function execute(address _to, uint256 _value, bytes calldata _data) external returns (bytes32);
|
||||
function confirm(bytes32 _h) public returns (bool);
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ contract GlobalRegistrar is Registrar, AuctionSystem {
|
||||
}
|
||||
}
|
||||
|
||||
function reserve(string _name) external payable {
|
||||
function reserve(string calldata _name) external payable {
|
||||
if (bytes(_name).length == 0)
|
||||
revert();
|
||||
bool needAuction = requiresAuction(_name);
|
||||
|
||||
@@ -348,7 +348,7 @@ contract multisig {
|
||||
|
||||
// TODO: document
|
||||
function changeOwner(address _from, address _to) external;
|
||||
function execute(address _to, uint _value, bytes _data) external returns (bytes32);
|
||||
function execute(address _to, uint _value, bytes calldata _data) external returns (bytes32);
|
||||
function confirm(bytes32 _h) public returns (bool);
|
||||
}
|
||||
|
||||
@@ -390,7 +390,7 @@ contract Wallet is multisig, multiowned, daylimit {
|
||||
// If not, goes into multisig process. We provide a hash on return to allow the sender to provide
|
||||
// shortcuts for the other confirmations (allowing them to avoid replicating the _to, _value
|
||||
// and _data arguments). They still get the option of using them if they want, anyways.
|
||||
function execute(address _to, uint _value, bytes _data) external onlyowner returns (bytes32 _r) {
|
||||
function execute(address _to, uint _value, bytes calldata _data) external onlyowner returns (bytes32 _r) {
|
||||
// first, take the opportunity to check that we're under the daily limit.
|
||||
if (underLimit(_value)) {
|
||||
emit SingleTransact(msg.sender, _value, _to, _data);
|
||||
|
||||
@@ -234,7 +234,7 @@ BOOST_AUTO_TEST_CASE(byte_arrays)
|
||||
return (a, b.length, b[3], c);
|
||||
}
|
||||
|
||||
function f_external(uint a, bytes b, uint c)
|
||||
function f_external(uint a, bytes calldata b, uint c)
|
||||
external pure returns (uint, uint, byte, uint) {
|
||||
return (a, b.length, b[3], c);
|
||||
}
|
||||
@@ -261,7 +261,7 @@ BOOST_AUTO_TEST_CASE(calldata_arrays_too_large)
|
||||
{
|
||||
string sourceCode = R"(
|
||||
contract C {
|
||||
function f(uint a, uint[] b, uint c) external pure returns (uint) {
|
||||
function f(uint a, uint[] calldata b, uint c) external pure returns (uint) {
|
||||
return 7;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,7 +367,7 @@ BOOST_AUTO_TEST_CASE(calldata)
|
||||
string sourceCode = R"(
|
||||
contract C {
|
||||
event E(bytes);
|
||||
function f(bytes a) external {
|
||||
function f(bytes calldata a) external {
|
||||
emit E(a);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
"id" : 3,
|
||||
"name" : "",
|
||||
"nodeType" : "VariableDeclaration",
|
||||
"scope" : 16,
|
||||
"scope" : 5,
|
||||
"src" : "61:4:1",
|
||||
"stateVariable" : false,
|
||||
"storageLocation" : "default",
|
||||
@@ -167,7 +167,7 @@
|
||||
"id" : 10,
|
||||
"name" : "",
|
||||
"nodeType" : "VariableDeclaration",
|
||||
"scope" : 16,
|
||||
"scope" : 12,
|
||||
"src" : "113:4:1",
|
||||
"stateVariable" : false,
|
||||
"storageLocation" : "default",
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
contract C { function f(function() external payable returns (uint) x) returns (function() external view returns (uint)) {} }
|
||||
|
||||
// ----
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
{
|
||||
"constant" : false,
|
||||
"name" : "",
|
||||
"scope" : 16,
|
||||
"scope" : 5,
|
||||
"stateVariable" : false,
|
||||
"storageLocation" : "default",
|
||||
"type" : "uint256",
|
||||
@@ -191,7 +191,7 @@
|
||||
{
|
||||
"constant" : false,
|
||||
"name" : "",
|
||||
"scope" : 16,
|
||||
"scope" : 12,
|
||||
"stateVariable" : false,
|
||||
"storageLocation" : "default",
|
||||
"type" : "uint256",
|
||||
|
||||
@@ -727,7 +727,7 @@ BOOST_AUTO_TEST_CASE(strings_and_arrays)
|
||||
// bug #1801
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function f(string a, bytes b, uint[] c) external {}
|
||||
function f(string calldata a, bytes calldata b, uint[] calldata c) external {}
|
||||
}
|
||||
)";
|
||||
|
||||
|
||||
@@ -526,7 +526,7 @@ BOOST_AUTO_TEST_CASE(array_multiple_local_vars)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function f(uint256[] seq) external pure returns (uint256) {
|
||||
function f(uint256[] calldata seq) external pure returns (uint256) {
|
||||
uint i = 0;
|
||||
uint sum = 0;
|
||||
while (i < seq.length)
|
||||
@@ -4540,7 +4540,7 @@ BOOST_AUTO_TEST_CASE(struct_containing_bytes_copy_and_delete)
|
||||
struct Struct { uint a; bytes data; uint b; }
|
||||
Struct data1;
|
||||
Struct data2;
|
||||
function set(uint _a, bytes _data, uint _b) external returns (bool) {
|
||||
function set(uint _a, bytes calldata _data, uint _b) external returns (bool) {
|
||||
data1.a = _a;
|
||||
data1.b = _b;
|
||||
data1.data = _data;
|
||||
@@ -4764,12 +4764,12 @@ BOOST_AUTO_TEST_CASE(struct_referencing)
|
||||
}
|
||||
library L {
|
||||
struct S { uint b; uint a; }
|
||||
function f() public pure returns (S) {
|
||||
function f() public pure returns (S memory) {
|
||||
S memory s;
|
||||
s.a = 3;
|
||||
return s;
|
||||
}
|
||||
function g() public pure returns (I.S) {
|
||||
function g() public pure returns (I.S memory) {
|
||||
I.S memory s;
|
||||
s.a = 4;
|
||||
return s;
|
||||
@@ -4779,25 +4779,25 @@ BOOST_AUTO_TEST_CASE(struct_referencing)
|
||||
function a(S memory) public pure returns (uint) { return 2; }
|
||||
}
|
||||
contract C is I {
|
||||
function f() public pure returns (S) {
|
||||
function f() public pure returns (S memory) {
|
||||
S memory s;
|
||||
s.a = 1;
|
||||
return s;
|
||||
}
|
||||
function g() public pure returns (I.S) {
|
||||
function g() public pure returns (I.S memory) {
|
||||
I.S memory s;
|
||||
s.a = 2;
|
||||
return s;
|
||||
}
|
||||
function h() public pure returns (L.S) {
|
||||
function h() public pure returns (L.S memory) {
|
||||
L.S memory s;
|
||||
s.a = 5;
|
||||
return s;
|
||||
}
|
||||
function x() public pure returns (L.S) {
|
||||
function x() public pure returns (L.S memory) {
|
||||
return L.f();
|
||||
}
|
||||
function y() public pure returns (I.S) {
|
||||
function y() public pure returns (I.S memory) {
|
||||
return L.g();
|
||||
}
|
||||
function a1() public pure returns (uint) { S memory s; return L.a(s); }
|
||||
@@ -4941,7 +4941,7 @@ BOOST_AUTO_TEST_CASE(bytes_in_arguments)
|
||||
uint result;
|
||||
function f(uint a, uint b) public { result += a + b; }
|
||||
function g(uint a) public { result *= a; }
|
||||
function test(uint a, bytes data1, bytes data2, uint b) external returns (uint r_a, uint r, uint r_b, uint l) {
|
||||
function test(uint a, bytes calldata data1, bytes calldata data2, uint b) external returns (uint r_a, uint r, uint r_b, uint l) {
|
||||
r_a = a;
|
||||
address(this).call(data1);
|
||||
address(this).call(data2);
|
||||
@@ -5876,7 +5876,7 @@ BOOST_AUTO_TEST_CASE(external_array_args)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract c {
|
||||
function test(uint[8] a, uint[] b, uint[5] c, uint a_index, uint b_index, uint c_index)
|
||||
function test(uint[8] calldata a, uint[] calldata b, uint[5] calldata c, uint a_index, uint b_index, uint c_index)
|
||||
external returns (uint av, uint bv, uint cv) {
|
||||
av = a[a_index];
|
||||
bv = b[b_index];
|
||||
@@ -5901,10 +5901,10 @@ BOOST_AUTO_TEST_CASE(bytes_index_access)
|
||||
char const* sourceCode = R"(
|
||||
contract c {
|
||||
bytes data;
|
||||
function direct(bytes arg, uint index) external returns (uint) {
|
||||
function direct(bytes calldata arg, uint index) external returns (uint) {
|
||||
return uint(uint8(arg[index]));
|
||||
}
|
||||
function storageCopyRead(bytes arg, uint index) external returns (uint) {
|
||||
function storageCopyRead(bytes calldata arg, uint index) external returns (uint) {
|
||||
data = arg;
|
||||
return uint(uint8(data[index]));
|
||||
}
|
||||
@@ -5959,7 +5959,7 @@ BOOST_AUTO_TEST_CASE(array_copy_calldata_storage)
|
||||
uint[9] m_data;
|
||||
uint[] m_data_dyn;
|
||||
uint8[][] m_byte_data;
|
||||
function store(uint[9] a, uint8[3][] b) external returns (uint8) {
|
||||
function store(uint[9] calldata a, uint8[3][] calldata b) external returns (uint8) {
|
||||
m_data = a;
|
||||
m_data_dyn = a;
|
||||
m_byte_data = b;
|
||||
@@ -5998,7 +5998,7 @@ BOOST_AUTO_TEST_CASE(array_copy_nested_array)
|
||||
uint[4][] a;
|
||||
uint[10][] b;
|
||||
uint[][] c;
|
||||
function test(uint[2][] d) external returns (uint) {
|
||||
function test(uint[2][] calldata d) external returns (uint) {
|
||||
a = d;
|
||||
b = a;
|
||||
c = b;
|
||||
@@ -6949,7 +6949,7 @@ BOOST_AUTO_TEST_CASE(return_string)
|
||||
char const* sourceCode = R"(
|
||||
contract Main {
|
||||
string public s;
|
||||
function set(string _s) external {
|
||||
function set(string calldata _s) external {
|
||||
s = _s;
|
||||
}
|
||||
function get1() public returns (string memory r) {
|
||||
@@ -6975,7 +6975,7 @@ BOOST_AUTO_TEST_CASE(return_multiple_strings_of_various_sizes)
|
||||
contract Main {
|
||||
string public s1;
|
||||
string public s2;
|
||||
function set(string _s1, uint x, string _s2) external returns (uint) {
|
||||
function set(string calldata _s1, uint x, string calldata _s2) external returns (uint) {
|
||||
s1 = _s1;
|
||||
s2 = _s2;
|
||||
return x;
|
||||
@@ -7024,7 +7024,7 @@ BOOST_AUTO_TEST_CASE(accessor_involving_strings)
|
||||
contract Main {
|
||||
struct stringData { string a; uint b; string c; }
|
||||
mapping(uint => stringData[]) public data;
|
||||
function set(uint x, uint y, string a, uint b, string c) external returns (bool) {
|
||||
function set(uint x, uint y, string calldata a, uint b, string calldata c) external returns (bool) {
|
||||
data[x].length = y + 1;
|
||||
data[x][y].a = a;
|
||||
data[x][y].b = b;
|
||||
@@ -7061,7 +7061,7 @@ BOOST_AUTO_TEST_CASE(bytes_in_function_calls)
|
||||
function setIndirectFromMemory(string memory _s1, uint x, string memory _s2) public returns (uint) {
|
||||
return this.set(_s1, x, _s2);
|
||||
}
|
||||
function setIndirectFromCalldata(string _s1, uint x, string _s2) external returns (uint) {
|
||||
function setIndirectFromCalldata(string calldata _s1, uint x, string calldata _s2) external returns (uint) {
|
||||
return this.set(_s1, x, _s2);
|
||||
}
|
||||
}
|
||||
@@ -7102,7 +7102,7 @@ BOOST_AUTO_TEST_CASE(return_bytes_internal)
|
||||
s1 = _s1;
|
||||
_r1 = s1;
|
||||
}
|
||||
function set(bytes _s1) external returns (uint _r, bytes memory _r1) {
|
||||
function set(bytes calldata _s1) external returns (uint _r, bytes memory _r1) {
|
||||
_r1 = doSet(_s1);
|
||||
_r = _r1.length;
|
||||
}
|
||||
@@ -8040,7 +8040,7 @@ BOOST_AUTO_TEST_CASE(library_call)
|
||||
BOOST_AUTO_TEST_CASE(library_function_external)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
library Lib { function m(bytes b) external pure returns (byte) { return b[2]; } }
|
||||
library Lib { function m(bytes calldata b) external pure returns (byte) { return b[2]; } }
|
||||
contract Test {
|
||||
function f(bytes memory b) public pure returns (byte) {
|
||||
return Lib.m(b);
|
||||
|
||||
@@ -158,7 +158,7 @@ BOOST_AUTO_TEST_CASE(function_external_types)
|
||||
uint a;
|
||||
}
|
||||
contract Test {
|
||||
function boo(uint, bool, bytes8, bool[2], uint[], C, address[]) external returns (uint ret) {
|
||||
function boo(uint, bool, bytes8, bool[2] calldata, uint[] calldata, C, address[] calldata) external returns (uint ret) {
|
||||
ret = 5;
|
||||
}
|
||||
}
|
||||
@@ -206,10 +206,10 @@ BOOST_AUTO_TEST_CASE(external_structs)
|
||||
struct Simple { uint i; }
|
||||
struct Nested { X[2][] a; uint y; }
|
||||
struct X { bytes32 x; Test t; Simple[] s; }
|
||||
function f(ActionChoices, uint, Simple) external {}
|
||||
function g(Test, Nested) external {}
|
||||
function h(function(Nested memory) external returns (uint)[]) external {}
|
||||
function i(Nested[]) external {}
|
||||
function f(ActionChoices, uint, Simple calldata) external {}
|
||||
function g(Test, Nested calldata) external {}
|
||||
function h(function(Nested memory) external returns (uint)[] calldata) external {}
|
||||
function i(Nested[] calldata) external {}
|
||||
}
|
||||
)";
|
||||
SourceUnit const* sourceUnit = parseAndAnalyse(text);
|
||||
@@ -234,10 +234,10 @@ BOOST_AUTO_TEST_CASE(external_structs_in_libraries)
|
||||
struct Simple { uint i; }
|
||||
struct Nested { X[2][] a; uint y; }
|
||||
struct X { bytes32 x; Test t; Simple[] s; }
|
||||
function f(ActionChoices, uint, Simple) external {}
|
||||
function g(Test, Nested) external {}
|
||||
function h(function(Nested memory) external returns (uint)[]) external {}
|
||||
function i(Nested[]) external {}
|
||||
function f(ActionChoices, uint, Simple calldata) external {}
|
||||
function g(Test, Nested calldata) external {}
|
||||
function h(function(Nested memory) external returns (uint)[] calldata) external {}
|
||||
function i(Nested[] calldata) external {}
|
||||
}
|
||||
)";
|
||||
SourceUnit const* sourceUnit = parseAndAnalyse(text);
|
||||
@@ -340,7 +340,7 @@ BOOST_AUTO_TEST_CASE(string)
|
||||
char const* sourceCode = R"(
|
||||
contract C {
|
||||
string s;
|
||||
function f(string x) external { s = x; }
|
||||
function f(string calldata x) external { s = x; }
|
||||
}
|
||||
)";
|
||||
BOOST_CHECK_NO_THROW(parseAndAnalyse(sourceCode));
|
||||
|
||||
+1
@@ -4,4 +4,5 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// DeclarationError: (28-45): The "constant" keyword can only be used for state variables.
|
||||
// TypeError: (69-72): Invalid array length, expected integer literal or constant expression.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
contract test {
|
||||
function f() public pure returns (bytes) {
|
||||
function f() public pure returns (bytes memory) {
|
||||
return bytes("abc");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
library L {
|
||||
struct Nested { uint y; }
|
||||
function c(function(Nested memory) external returns (uint)[] storage) external pure {}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
library L {
|
||||
struct Nested { uint y; }
|
||||
function b(function(Nested calldata) external returns (uint)[] storage) external pure {}
|
||||
function d(function(Nested storage) external returns (uint)[] storage) external pure {}
|
||||
}
|
||||
|
||||
// ----
|
||||
// TypeError: (66-72): Data location must be "memory" for parameter in function, but "calldata" was given.
|
||||
// TypeError: (159-165): Data location must be "memory" for parameter in function, but "storage" was given.
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
contract C {
|
||||
function i() external pure returns(uint[]) {}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (52-58): Data location must be "memory" for return parameter in function, but none was given.
|
||||
+1
-1
@@ -2,4 +2,4 @@ contract test {
|
||||
function f(bytes memory) external;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (31-36): Location has to be calldata for external functions (remove the "memory" or "storage" keyword).
|
||||
// TypeError: (31-36): Data location must be "calldata" for parameter in external function, but "memory" was given.
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@ contract test {
|
||||
function f(bytes storage) external;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (31-36): Location has to be calldata for external functions (remove the "memory" or "storage" keyword).
|
||||
// TypeError: (31-36): Data location must be "calldata" for parameter in external function, but "storage" was given.
|
||||
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
library test {
|
||||
function f(bytes calldata) public;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (30-35): Location cannot be calldata for non-external functions (remove the "calldata" keyword).
|
||||
+1
-1
@@ -2,4 +2,4 @@ contract test {
|
||||
function f(bytes4 memory) public;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (31-37): Data location can only be given for array or struct types.
|
||||
// TypeError: (31-37): Data location can only be specified for array, struct or mapping types, but "memory" was given.
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
function f(uint[] memory, uint[] storage) private pure {}
|
||||
function g(uint[] memory, uint[] storage) internal pure {}
|
||||
function h(uint[] memory) public pure {}
|
||||
function i(uint[] calldata) external pure {}
|
||||
// No data location for events.
|
||||
event e(uint[]);
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
contract C {
|
||||
function f() private pure returns(uint[] memory, uint[] storage b) { b = b; }
|
||||
function g() internal pure returns(uint[] memory, uint[] storage b) { b = b; }
|
||||
function h() public pure returns(uint[] memory) {}
|
||||
function i() external pure returns(uint[] memory) {}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
struct Nested { uint y; }
|
||||
// ensure that we consider array of function pointers as reference type
|
||||
function b(function(Nested memory) external returns (uint)[] storage) internal pure {}
|
||||
function c(function(Nested memory) external returns (uint)[] memory) public pure {}
|
||||
function d(function(Nested memory) external returns (uint)[] calldata) external pure {}
|
||||
}
|
||||
// ----
|
||||
+1
-1
@@ -2,4 +2,4 @@ contract test {
|
||||
function f(bytes calldata) internal;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (31-36): Variable cannot be declared as "calldata" (remove the "calldata" keyword).
|
||||
// TypeError: (31-36): Data location must be "storage" or "memory" for parameter in function, but "calldata" was given.
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
contract C {
|
||||
function g(uint[]) internal pure {}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (28-34): Data location must be "storage" or "memory" for parameter in function, but none was given.
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
contract C {
|
||||
function g() internal pure returns(uint[]) {}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (52-58): Data location must be "storage" or "memory" for return parameter in function, but none was given.
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
library L {
|
||||
struct S { uint x; }
|
||||
function g(uint[2]) external pure {}
|
||||
function h(uint[]) external pure {}
|
||||
function i(S) external pure {}
|
||||
function j(mapping(uint => uint)) external pure {}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (52-59): Data location must be "storage" or "calldata" for parameter in external function, but none was given.
|
||||
// TypeError: (93-99): Data location must be "storage" or "calldata" for parameter in external function, but none was given.
|
||||
// TypeError: (133-134): Data location must be "storage" or "calldata" for parameter in external function, but none was given.
|
||||
// TypeError: (168-189): Data location must be "storage" or "calldata" for parameter in external function, but none was given.
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
library L {
|
||||
struct S { uint x; }
|
||||
function g() external pure returns (uint[2]) {}
|
||||
function h() external pure returns (uint[]) {}
|
||||
function i() external pure returns (S) {}
|
||||
function j() external pure returns (mapping(uint => uint)) {}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (77-84): Data location must be "storage" or "memory" for return parameter in function, but none was given.
|
||||
// TypeError: (129-135): Data location must be "storage" or "memory" for return parameter in function, but none was given.
|
||||
// TypeError: (180-181): Data location must be "storage" or "memory" for return parameter in function, but none was given.
|
||||
// TypeError: (226-247): Data location must be "storage" or "memory" for return parameter in function, but none was given.
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
library L {
|
||||
struct S { uint x; }
|
||||
function f(uint[] memory, uint[] storage, S storage) private pure
|
||||
returns (mapping(uint => uint) storage a, S memory b, uint[] storage c) { return (a, b, c); }
|
||||
function g(uint[] memory, uint[] storage) internal pure
|
||||
returns (mapping(uint => uint) storage a, S memory b, uint[] storage c) { return (a, b, c); }
|
||||
function h(uint[] memory, uint[] storage) public pure returns (S storage x) { return x; }
|
||||
function i(uint[] calldata, uint[] storage) external pure returns (S storage x) {return x; }
|
||||
}
|
||||
// ----
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
library L {
|
||||
struct S { uint x; }
|
||||
function g() internal pure returns (uint[2]) {}
|
||||
function h() internal pure returns (uint[]) {}
|
||||
function i() internal pure returns (S) {}
|
||||
function j() internal pure returns (mapping(uint => uint)) {}
|
||||
function gp(uint[2]) internal pure {}
|
||||
function hp(uint[]) internal pure {}
|
||||
function ip(S) internal pure {}
|
||||
function jp(mapping(uint => uint)) internal pure {}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (77-84): Data location must be "storage" or "memory" for return parameter in function, but none was given.
|
||||
// TypeError: (129-135): Data location must be "storage" or "memory" for return parameter in function, but none was given.
|
||||
// TypeError: (180-181): Data location must be "storage" or "memory" for return parameter in function, but none was given.
|
||||
// TypeError: (226-247): Data location must be "storage" or "memory" for return parameter in function, but none was given.
|
||||
// TypeError: (268-275): Data location must be "storage" or "memory" for parameter in function, but none was given.
|
||||
// TypeError: (310-316): Data location must be "storage" or "memory" for parameter in function, but none was given.
|
||||
// TypeError: (351-352): Data location must be "storage" or "memory" for parameter in function, but none was given.
|
||||
// TypeError: (387-408): Data location must be "storage" or "memory" for parameter in function, but none was given.
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
library L {
|
||||
struct S { uint x; }
|
||||
function g() private pure returns (uint[2]) {}
|
||||
function h() private pure returns (uint[]) {}
|
||||
function i() private pure returns (S) {}
|
||||
function j() private pure returns (mapping(uint => uint)) {}
|
||||
function gp(uint[2]) private pure {}
|
||||
function hp(uint[]) private pure {}
|
||||
function ip(S) private pure {}
|
||||
function jp(mapping(uint => uint)) private pure {}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (76-83): Data location must be "storage" or "memory" for return parameter in function, but none was given.
|
||||
// TypeError: (127-133): Data location must be "storage" or "memory" for return parameter in function, but none was given.
|
||||
// TypeError: (177-178): Data location must be "storage" or "memory" for return parameter in function, but none was given.
|
||||
// TypeError: (222-243): Data location must be "storage" or "memory" for return parameter in function, but none was given.
|
||||
// TypeError: (264-271): Data location must be "storage" or "memory" for parameter in function, but none was given.
|
||||
// TypeError: (305-311): Data location must be "storage" or "memory" for parameter in function, but none was given.
|
||||
// TypeError: (345-346): Data location must be "storage" or "memory" for parameter in function, but none was given.
|
||||
// TypeError: (380-401): Data location must be "storage" or "memory" for parameter in function, but none was given.
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
library L {
|
||||
struct S { uint x; }
|
||||
function g() private pure returns (uint[2]) {}
|
||||
function h() private pure returns (uint[]) {}
|
||||
function i() private pure returns (S) {}
|
||||
function j() private pure returns (mapping(uint => uint)) {}
|
||||
function gp(uint[2]) private pure {}
|
||||
function hp(uint[]) private pure {}
|
||||
function ip(S) private pure {}
|
||||
function jp(mapping(uint => uint)) private pure {}}
|
||||
// ----
|
||||
// TypeError: (76-83): Data location must be "storage" or "memory" for return parameter in function, but none was given.
|
||||
// TypeError: (127-133): Data location must be "storage" or "memory" for return parameter in function, but none was given.
|
||||
// TypeError: (177-178): Data location must be "storage" or "memory" for return parameter in function, but none was given.
|
||||
// TypeError: (222-243): Data location must be "storage" or "memory" for return parameter in function, but none was given.
|
||||
// TypeError: (264-271): Data location must be "storage" or "memory" for parameter in function, but none was given.
|
||||
// TypeError: (305-311): Data location must be "storage" or "memory" for parameter in function, but none was given.
|
||||
// TypeError: (345-346): Data location must be "storage" or "memory" for parameter in function, but none was given.
|
||||
// TypeError: (380-401): Data location must be "storage" or "memory" for parameter in function, but none was given.
|
||||
+1
-1
@@ -2,4 +2,4 @@ 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).
|
||||
// TypeError: (30-35): Data location must be "storage" or "calldata" for parameter in external function, but "memory" was given.
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@ library test {
|
||||
function f(bytes calldata) internal pure {}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (30-35): Variable cannot be declared as "calldata" (remove the "calldata" keyword).
|
||||
// TypeError: (30-35): Data location must be "storage" or "memory" for parameter in function, but "calldata" was given.
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
contract C {
|
||||
function f(uint[]) private pure {}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (28-34): Data location must be "storage" or "memory" for parameter in function, but none was given.
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
contract C {
|
||||
function f() private pure returns(uint[]) {}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (51-57): Data location must be "storage" or "memory" for return parameter in function, but none was given.
|
||||
+1
-1
@@ -2,4 +2,4 @@ contract test {
|
||||
function f(bytes calldata) public;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (31-36): Location has to be memory for publicly visible functions (remove the "storage" or "calldata" keyword).
|
||||
// TypeError: (31-36): Data location must be "memory" for parameter in function, but "calldata" was given.
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@ contract test {
|
||||
function f(bytes storage) public;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (31-36): Location has to be memory for publicly visible functions (remove the "storage" or "calldata" keyword).
|
||||
// TypeError: (31-36): Data location must be "memory" for parameter in function, but "storage" was given.
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
contract C {
|
||||
function h(uint[]) public pure {}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (28-34): Data location must be "memory" for parameter in function, but none was given.
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
contract C {
|
||||
function h() public pure returns(uint[]) {}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (50-56): Data location must be "memory" for return parameter in function, but none was given.
|
||||
+4
-4
@@ -7,7 +7,7 @@ contract test {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (48-63): Data location can only be given for array or struct types.
|
||||
// TypeError: (71-89): Data location can only be given for array or struct types.
|
||||
// TypeError: (97-111): Data location can only be given for array or struct types.
|
||||
// TypeError: (119-136): Data location can only be given for array or struct types.
|
||||
// TypeError: (48-63): Data location can only be specified for array, struct or mapping types, but "storage" was given.
|
||||
// TypeError: (71-89): Data location can only be specified for array, struct or mapping types, but "storage" was given.
|
||||
// TypeError: (97-111): Data location can only be specified for array, struct or mapping types, but "memory" was given.
|
||||
// TypeError: (119-136): Data location can only be specified for array, struct or mapping types, but "memory" was given.
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
// when converting to a function type.
|
||||
contract C {
|
||||
function f(function(bytes memory) pure external /*g*/) pure public { }
|
||||
function callback(bytes) pure external {}
|
||||
function callback(bytes calldata) pure external {}
|
||||
function g() view public {
|
||||
f(this.callback);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,6 @@ contract test {
|
||||
function f(uint[] memory constant a) public { }
|
||||
}
|
||||
// ----
|
||||
// TypeError: (31-55): Illegal use of "constant" specifier.
|
||||
// DeclarationError: (31-55): The "constant" keyword can only be used for state variables.
|
||||
// TypeError: (31-55): Constants of non-value type not yet implemented.
|
||||
// TypeError: (31-55): Uninitialized "constant" variable.
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
contract Vehicle {
|
||||
function f(bytes) external returns (uint256 r) {r = 1;}
|
||||
function f(bytes calldata) external returns (uint256 r) {r = 1;}
|
||||
}
|
||||
contract Bike is Vehicle {
|
||||
function f(bytes) external returns (uint256 r) {r = 42;}
|
||||
function f(bytes calldata) external returns (uint256 r) {r = 42;}
|
||||
}
|
||||
// ----
|
||||
// Warning: (23-78): Function state mutability can be restricted to pure
|
||||
// Warning: (23-87): Function state mutability can be restricted to pure
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@ contract C {
|
||||
function f(uint[] memory a) external {}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (28-43): Location has to be calldata for external functions (remove the "memory" or "storage" keyword).
|
||||
// TypeError: (28-43): Data location must be "calldata" for parameter in external function, but "memory" was given.
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@ contract C {
|
||||
function f(uint[] storage a) external {}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (28-44): Location has to be calldata for external functions (remove the "memory" or "storage" keyword).
|
||||
// TypeError: (28-44): Data location must be "calldata" for parameter in external function, but "storage" was given.
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
contract Test {
|
||||
string s;
|
||||
bytes b;
|
||||
function h(string _s) external { bytes(_s).length; }
|
||||
function i(string memory _s) internal { bytes(_s).length; }
|
||||
function j() internal { bytes(s).length; }
|
||||
function k(bytes _b) external { string(_b); }
|
||||
function l(bytes memory _b) internal { string(_b); }
|
||||
function m() internal { string(b); }
|
||||
function h(string calldata _s) pure external { bytes(_s).length; }
|
||||
function i(string memory _s) pure internal { bytes(_s).length; }
|
||||
function j() view internal { bytes(s).length; }
|
||||
function k(bytes calldata _b) pure external { string(_b); }
|
||||
function l(bytes memory _b) pure internal { string(_b); }
|
||||
function m() view internal { string(b); }
|
||||
}
|
||||
// ----
|
||||
// Warning: (47-99): Function state mutability can be restricted to pure
|
||||
// Warning: (104-163): Function state mutability can be restricted to pure
|
||||
// Warning: (168-210): Function state mutability can be restricted to view
|
||||
// Warning: (215-260): Function state mutability can be restricted to pure
|
||||
// Warning: (265-317): Function state mutability can be restricted to pure
|
||||
// Warning: (322-358): Function state mutability can be restricted to view
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
contract C {
|
||||
function f(bytes bytesAsCalldata) external {
|
||||
function f(bytes calldata bytesAsCalldata) external {
|
||||
assembly {
|
||||
let x := bytesAsCalldata
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (102-117): Call data elements cannot be accessed directly. Copy to a local variable first or use "calldataload" or "calldatacopy" with manually determined offsets and sizes.
|
||||
// TypeError: (111-126): Call data elements cannot be accessed directly. Copy to a local variable first or use "calldataload" or "calldatacopy" with manually determined offsets and sizes.
|
||||
|
||||
@@ -9,5 +9,5 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (104-107): Data location must be specified as either "memory" or "storage".
|
||||
// TypeError: (123-131): Data location must be specified as either "memory" or "storage".
|
||||
// TypeError: (104-107): Data location must be "storage" or "memory" for variable, but none was given.
|
||||
// TypeError: (123-131): Data location must be "storage" or "memory" for variable, but none was given.
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@ contract C {
|
||||
function f(uint storage a) public { }
|
||||
}
|
||||
// ----
|
||||
// TypeError: (28-42): Data location can only be given for array or struct types.
|
||||
// TypeError: (28-42): Data location can only be specified for array, struct or mapping types, but "storage" was given.
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (28-42): Data location can only be given for array or struct types.
|
||||
// TypeError: (28-42): Data location can only be specified for array, struct or mapping types, but "storage" was given.
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
contract C {
|
||||
function f(uint[85678901234] a) pure external {
|
||||
function f(uint[85678901234] calldata a) pure external {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (28-47): Array is too large to be encoded.
|
||||
// TypeError: (28-56): Array is too large to be encoded.
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
// This should probably have a better error message at some point.
|
||||
// Constant mappings should not be possible in general.
|
||||
mapping(uint => uint) constant x;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (148-180): Constants of non-value type not yet implemented.
|
||||
// TypeError: (148-180): Uninitialized "constant" variable.
|
||||
@@ -2,4 +2,6 @@ contract Foo {
|
||||
function f(uint[] storage constant x, uint[] memory y) internal { }
|
||||
}
|
||||
// ----
|
||||
// TypeError: (30-55): Data location has to be "memory" (or unspecified) for constants.
|
||||
// DeclarationError: (30-55): The "constant" keyword can only be used for state variables.
|
||||
// TypeError: (30-55): Constants of non-value type not yet implemented.
|
||||
// TypeError: (30-55): Uninitialized "constant" variable.
|
||||
|
||||
@@ -3,5 +3,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (28-49): Type is required to live outside storage.
|
||||
// TypeError: (28-49): Internal or recursive type is not allowed for public or external functions.
|
||||
// TypeError: (28-49): Data location must be "calldata" for parameter in external function, but "storage" was given.
|
||||
|
||||
@@ -3,5 +3,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (28-49): Type is required to live outside storage.
|
||||
// TypeError: (28-49): Internal or recursive type is not allowed for public or external functions.
|
||||
// TypeError: (28-49): Data location must be "memory" for parameter in function, but "storage" was given.
|
||||
|
||||
@@ -3,4 +3,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (28-51): Location has to be calldata for external functions (remove the "memory" or "storage" keyword).
|
||||
// TypeError: (28-51): Data location must be "calldata" for parameter in external function, but "storage" was given.
|
||||
|
||||
@@ -3,4 +3,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (28-51): Location has to be memory for publicly visible functions (remove the "storage" or "calldata" keyword).
|
||||
// TypeError: (28-51): Data location must be "memory" for parameter in function, but "storage" was given.
|
||||
|
||||
@@ -3,4 +3,5 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (37-56): Data location must be "memory" for parameter in function, but "storage" was given.
|
||||
// TypeError: (37-56): Internal type cannot be used for external function type.
|
||||
|
||||
@@ -3,4 +3,5 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (57-76): Data location must be "memory" for return parameter in function, but "storage" was given.
|
||||
// TypeError: (57-76): Internal type cannot be used for external function type.
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
contract c {
|
||||
function f1(mapping(uint => uint)[] calldata) pure external {}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (29-52): Type is required to live outside storage.
|
||||
// TypeError: (29-52): Internal or recursive type is not allowed for public or external functions.
|
||||
@@ -3,4 +3,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (53-84): Location has to be memory for publicly visible functions (remove the "storage" or "calldata" keyword).
|
||||
// TypeError: (53-84): Data location must be "memory" for return parameter in function, but "storage" was given.
|
||||
|
||||
@@ -3,4 +3,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (51-82): Location has to be memory for publicly visible functions (remove the "storage" or "calldata" keyword).
|
||||
// TypeError: (51-82): Data location must be "memory" for return parameter in function, but "storage" was given.
|
||||
|
||||
@@ -6,4 +6,4 @@ contract c {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (81-113): Data location for mappings must be specified as "storage".
|
||||
// TypeError: (81-113): Data location must be "storage" for variable, but "calldata" was given.
|
||||
|
||||
@@ -6,4 +6,4 @@ contract c {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (81-104): Data location for mappings must be specified as "storage".
|
||||
// TypeError: (81-104): Data location must be "storage" for variable, but none was given.
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
contract c {
|
||||
function f1(mapping(uint => uint) calldata) pure external returns (mapping(uint => uint) memory) {}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (29-50): Type is required to live outside storage.
|
||||
// TypeError: (29-50): Internal or recursive type is not allowed for public or external functions.
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
contract c {
|
||||
function f4(mapping(uint => uint) memory) pure internal {}
|
||||
}
|
||||
// ----
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
contract c {
|
||||
function f3(mapping(uint => uint) memory) view public {}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (29-50): Type is required to live outside storage.
|
||||
// TypeError: (29-50): Internal or recursive type is not allowed for public or external functions.
|
||||
@@ -6,4 +6,4 @@ contract c {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (81-111): Data location for mappings must be specified as "storage".
|
||||
// TypeError: (81-111): Data location must be "storage" for variable, but "memory" was given.
|
||||
|
||||
@@ -3,5 +3,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (53-82): Type is required to live outside storage.
|
||||
// TypeError: (53-82): Internal or recursive type is not allowed for public or external functions.
|
||||
// TypeError: (53-82): Data location must be "memory" for return parameter in function, but "storage" was given.
|
||||
|
||||
@@ -3,5 +3,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (51-80): Type is required to live outside storage.
|
||||
// TypeError: (51-80): Internal or recursive type is not allowed for public or external functions.
|
||||
// TypeError: (51-80): Data location must be "memory" for return parameter in function, but "storage" was given.
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() public pure returns (mapping(uint=>uint) memory m) {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (51-79): Type is required to live outside storage.
|
||||
// TypeError: (51-79): Internal or recursive type is not allowed for public or external functions.
|
||||
Reference in New Issue
Block a user