mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Improve error message for static array with size too large
This commit is contained in:
@@ -2,4 +2,4 @@ contract C {
|
||||
bytes32[8**90] ids;
|
||||
}
|
||||
// ----
|
||||
// TypeError 5462: (25-30): Invalid array length, expected integer literal or constant expression.
|
||||
// TypeError 1847: (25-30): Array length too large, maximum is 2**256 - 1.
|
||||
|
||||
@@ -2,4 +2,4 @@ contract C {
|
||||
bytes32[8**90][500] ids;
|
||||
}
|
||||
// ----
|
||||
// TypeError 5462: (25-30): Invalid array length, expected integer literal or constant expression.
|
||||
// TypeError 1847: (25-30): Array length too large, maximum is 2**256 - 1.
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
contract C {
|
||||
uint[uint(1)] valid_size_invalid_expr1;
|
||||
uint[uint(2**256-1)] valid_size_invalid_expr2;
|
||||
uint[uint(2**256)] invalid_size_invalid_expr3;
|
||||
|
||||
uint[int(1)] valid_size_invalid_expr4;
|
||||
uint[int(2**256-1)] valid_size_invalid_expr5;
|
||||
uint[int(2**256)] invalid_size_invalid_expr6;
|
||||
}
|
||||
// ----
|
||||
// TypeError 5462: (22-29): Invalid array length, expected integer literal or constant expression.
|
||||
// TypeError 5462: (66-80): Invalid array length, expected integer literal or constant expression.
|
||||
// TypeError 5462: (117-129): Invalid array length, expected integer literal or constant expression.
|
||||
// TypeError 5462: (169-175): Invalid array length, expected integer literal or constant expression.
|
||||
// TypeError 5462: (212-225): Invalid array length, expected integer literal or constant expression.
|
||||
// TypeError 5462: (262-273): Invalid array length, expected integer literal or constant expression.
|
||||
@@ -1,5 +1,8 @@
|
||||
contract C {
|
||||
uint[8**90] ids;
|
||||
uint[2**256-1] okay;
|
||||
uint[2**256] tooLarge;
|
||||
}
|
||||
// ----
|
||||
// TypeError 5462: (22-27): Invalid array length, expected integer literal or constant expression.
|
||||
// TypeError 1847: (22-27): Array length too large, maximum is 2**256 - 1.
|
||||
// TypeError 1847: (68-74): Array length too large, maximum is 2**256 - 1.
|
||||
|
||||
@@ -2,4 +2,4 @@ contract C {
|
||||
uint[8**90][500] ids;
|
||||
}
|
||||
// ----
|
||||
// TypeError 5462: (22-27): Invalid array length, expected integer literal or constant expression.
|
||||
// TypeError 1847: (22-27): Array length too large, maximum is 2**256 - 1.
|
||||
|
||||
Reference in New Issue
Block a user