mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Move files.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
contract C {
|
||||
function f(bytes calldata data)
|
||||
external
|
||||
pure
|
||||
returns (uint256, bytes memory r)
|
||||
{
|
||||
return abi.decode(data, (uint256, bytes));
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// f(bytes): 0x20, 0x80, 0x21, 0x40, 0x7, "abcdefg" -> 0x21, 0x40, 0x7, "abcdefg"
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f(bytes memory data) public pure returns (uint256, bytes memory) {
|
||||
return abi.decode(data, (uint256, bytes));
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// f(bytes): 0x20, 0x80, 0x21, 0x40, 0x7, "abcdefg" -> 0x21, 0x40, 0x7, "abcdefg"
|
||||
@@ -0,0 +1,10 @@
|
||||
contract C {
|
||||
bytes data;
|
||||
|
||||
function f(bytes memory _data) public returns (uint256, bytes memory) {
|
||||
data = _data;
|
||||
return abi.decode(data, (uint256, bytes));
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// f(bytes): 0x20, 0x80, 0x21, 0x40, 0x7, "abcdefg" -> 0x21, 0x40, 0x7, "abcdefg"
|
||||
@@ -0,0 +1,11 @@
|
||||
// Tests that this will not end up using a "bytes0" type
|
||||
// (which would assert)
|
||||
contract C {
|
||||
function f() public pure returns (bytes memory, bytes memory) {
|
||||
return (abi.encode(""), abi.encodePacked(""));
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// ABIEncoderV1Only: true
|
||||
// ----
|
||||
// f() -> 0x40, 0xc0, 0x60, 0x20, 0x0, 0x0, 0x0
|
||||
Reference in New Issue
Block a user