mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix Yul IR push
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
contract C {
|
||||
uint[] storageArray;
|
||||
function test(uint256 v) public {
|
||||
storageArray.push() = v;
|
||||
}
|
||||
function getLength() public view returns (uint256) {
|
||||
return storageArray.length;
|
||||
}
|
||||
function fetch(uint256 a) public view returns (uint256) {
|
||||
return storageArray[a];
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// getLength() -> 0
|
||||
// test(uint256): 42 ->
|
||||
// getLength() -> 1
|
||||
// fetch(uint256): 0 -> 42
|
||||
// fetch(uint256): 1 -> FAILURE
|
||||
// test(uint256): 23 ->
|
||||
// getLength() -> 2
|
||||
// fetch(uint256): 0 -> 42
|
||||
// fetch(uint256): 1 -> 23
|
||||
// fetch(uint256): 2 -> FAILURE
|
||||
@@ -0,0 +1,25 @@
|
||||
contract C {
|
||||
uint[] storageArray;
|
||||
function test(uint256 v) public {
|
||||
storageArray.push(v);
|
||||
}
|
||||
function getLength() public view returns (uint256) {
|
||||
return storageArray.length;
|
||||
}
|
||||
function fetch(uint256 a) public view returns (uint256) {
|
||||
return storageArray[a];
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// getLength() -> 0
|
||||
// test(uint256): 42 ->
|
||||
// getLength() -> 1
|
||||
// fetch(uint256): 0 -> 42
|
||||
// fetch(uint256): 1 -> FAILURE
|
||||
// test(uint256): 23 ->
|
||||
// getLength() -> 2
|
||||
// fetch(uint256): 0 -> 42
|
||||
// fetch(uint256): 1 -> 23
|
||||
// fetch(uint256): 2 -> FAILURE
|
||||
Reference in New Issue
Block a user