mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge remote-tracking branch 'origin/develop' into breaking
This commit is contained in:
+19
@@ -0,0 +1,19 @@
|
||||
contract c {
|
||||
uint64[] data1;
|
||||
uint256[] data2;
|
||||
|
||||
function test() public returns (uint256 x, uint256 y) {
|
||||
data2.push(11);
|
||||
data1.push(0);
|
||||
data1.push(1);
|
||||
data1.push(2);
|
||||
data1.push(3);
|
||||
data1.push(4);
|
||||
data2 = data1;
|
||||
assert(data1[0] == data2[0]);
|
||||
x = data2.length;
|
||||
y = data2[4];
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// test() -> 5, 4
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
contract c {
|
||||
uint256[] data1;
|
||||
uint256[] data2;
|
||||
|
||||
function test() public returns (uint256 x, uint256 y) {
|
||||
data2.push(11);
|
||||
data1.push(0);
|
||||
data1.push(1);
|
||||
data1.push(2);
|
||||
data1.push(3);
|
||||
data1.push(4);
|
||||
data2 = data1;
|
||||
assert(data1[0] == data2[0]);
|
||||
x = data2.length;
|
||||
y = data2[4];
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 5, 4
|
||||
+2
@@ -13,5 +13,7 @@ contract c {
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 8, 0
|
||||
|
||||
@@ -30,7 +30,7 @@ contract c {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test1(uint256[][]): 0x20, 2, 0x40, 0x40, 2, 23, 42 -> 2, 65
|
||||
// test2(uint256[][2]): 0x20, 0x40, 0x40, 2, 23, 42 -> 2, 65
|
||||
|
||||
+1
-1
@@ -18,6 +18,6 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f((uint256[])[]): 0x20, 3, 0x60, 0x60, 0x60, 0x20, 3, 1, 2, 3 -> 3, 1
|
||||
@@ -0,0 +1,14 @@
|
||||
pragma abicoder v2;
|
||||
|
||||
contract C {
|
||||
function g(bytes[2] memory m) internal returns (bytes memory) {
|
||||
return m[0];
|
||||
}
|
||||
function f(bytes[2] calldata c) external returns (bytes memory) {
|
||||
return g(c);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(bytes[2]): 0x20, 0x40, 0x40, 2, "ab" -> 0x20, 2, "ab"
|
||||
@@ -0,0 +1,18 @@
|
||||
pragma abicoder v2;
|
||||
|
||||
contract C {
|
||||
function g(bytes[2] memory m) internal {
|
||||
assert(m[0].length > 1);
|
||||
assert(m[1].length > 1);
|
||||
assert(m[0][0] == m[1][0]);
|
||||
assert(m[0][1] == m[1][1]);
|
||||
}
|
||||
function f(bytes[2] calldata c) external {
|
||||
g(c);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(bytes[2]): 0x20, 0x40, 0x40, 2, "ab" ->
|
||||
// f(bytes[2]): 0x20, 0x40, 0x40, 1, "a" -> FAILURE
|
||||
@@ -0,0 +1,14 @@
|
||||
pragma abicoder v2;
|
||||
|
||||
contract Test {
|
||||
struct shouldBug {
|
||||
uint256[][2] deadly;
|
||||
}
|
||||
function killer(uint256[][2] calldata weapon) pure external returns (shouldBug memory) {
|
||||
return shouldBug(weapon);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// killer(uint256[][2]): 0x20, 0x40, 0x40, 2, 1, 2 -> 0x20, 0x20, 0x40, 0xa0, 2, 1, 2, 2, 1, 2
|
||||
Reference in New Issue
Block a user