mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Adjusts syntax tests to read-only array length.
This commit is contained in:
@@ -4,4 +4,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (75-83): Calldata arrays cannot be resized.
|
||||
// TypeError: (75-83): Member "length" is read-only and cannot be used to resize arrays.
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
contract c {
|
||||
uint[] storageArray;
|
||||
function f() public {
|
||||
storageArray.length = 3;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (72-91): Member "length" is read-only and cannot be used to resize arrays.
|
||||
@@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
mapping(uint => uint[]) map;
|
||||
function f() public {
|
||||
map[0].length = 4;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (80-93): Member "length" is read-only and cannot be used to resize arrays.
|
||||
@@ -0,0 +1,11 @@
|
||||
contract C {
|
||||
struct S {
|
||||
uint[] a;
|
||||
}
|
||||
S s;
|
||||
function f() public {
|
||||
s.a.length = 4;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (95-105): Member "length" is read-only and cannot be used to resize arrays.
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f(uint[] calldata x) external {
|
||||
x.pop();
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (66-71): Member "pop" is not available in uint256[] calldata outside of storage.
|
||||
@@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
function f() public {
|
||||
uint[] memory x;
|
||||
x.pop();
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (72-77): Member "pop" is not available in uint256[] memory outside of storage.
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f(uint[] calldata x) external {
|
||||
x.push();
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (66-72): Member "push" is not available in uint256[] calldata outside of storage.
|
||||
@@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
function f() public {
|
||||
uint[] memory x;
|
||||
x.push();
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (72-78): Member "push" is not available in uint256[] memory outside of storage.
|
||||
Reference in New Issue
Block a user