mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Changelog and tests
This commit is contained in:
parent
e54c4eecfc
commit
e4e200f29f
@ -1,7 +1,7 @@
|
||||
### 0.6.8 (unreleased)
|
||||
|
||||
Language Features:
|
||||
|
||||
* Implemented ``type(X).min`` and ``type(X).max`` for every integer type ``X`` that returns the smallest and largest value representable by the type.
|
||||
|
||||
|
||||
Compiler Features:
|
||||
|
@ -8,5 +8,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 0
|
||||
|
@ -19,6 +19,8 @@ contract C {
|
||||
y[0] = 23;
|
||||
return x[2];
|
||||
}}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> FAILURE
|
||||
// g() -> FAILURE
|
||||
|
7
test/libsolidity/syntaxTests/metaTypes/contract_min.sol
Normal file
7
test/libsolidity/syntaxTests/metaTypes/contract_min.sol
Normal file
@ -0,0 +1,7 @@
|
||||
contract Min {
|
||||
function contractMin() public {
|
||||
type(Min).min;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (50-63): Member "min" not found or not visible after argument-dependent lookup in type(contract Min).
|
7
test/libsolidity/syntaxTests/metaTypes/int_name.sol
Normal file
7
test/libsolidity/syntaxTests/metaTypes/int_name.sol
Normal file
@ -0,0 +1,7 @@
|
||||
contract test {
|
||||
function intName() public {
|
||||
type(int).name;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (47-61): Member "name" not found or not visible after argument-dependent lookup in type(int256).
|
12
test/libsolidity/syntaxTests/metaTypes/integer.sol
Normal file
12
test/libsolidity/syntaxTests/metaTypes/integer.sol
Normal file
@ -0,0 +1,12 @@
|
||||
contract Test {
|
||||
function basic() public pure {
|
||||
uint uintMax = type(uint).max;
|
||||
uintMax;
|
||||
int intMax = type(int).max;
|
||||
intMax;
|
||||
uint uintMin = type(uint).min;
|
||||
uintMin;
|
||||
int intMin = type(int).min;
|
||||
intMin;
|
||||
}
|
||||
}
|
15
test/libsolidity/syntaxTests/metaTypes/integer_err.sol
Normal file
15
test/libsolidity/syntaxTests/metaTypes/integer_err.sol
Normal file
@ -0,0 +1,15 @@
|
||||
contract Test {
|
||||
function assignment() public {
|
||||
uint8 uint8Min = type(int).min;
|
||||
uint uintMin = type(int).min;
|
||||
|
||||
if (type(int).min == 2**256 - 1) {
|
||||
uintMin;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (59-89): Type int256 is not implicitly convertible to expected type uint8.
|
||||
// TypeError: (99-127): Type int256 is not implicitly convertible to expected type uint256.
|
||||
// TypeError: (142-169): Operator == not compatible with types int256 and int_const 1157...(70 digits omitted)...9935
|
16
test/libsolidity/syntaxTests/metaTypes/integer_pure.sol
Normal file
16
test/libsolidity/syntaxTests/metaTypes/integer_pure.sol
Normal file
@ -0,0 +1,16 @@
|
||||
contract test {
|
||||
|
||||
function viewAssignment() public view {
|
||||
int min = type(int).min;
|
||||
min;
|
||||
}
|
||||
|
||||
function assignment() public {
|
||||
int max = type(int).max;
|
||||
max;
|
||||
}
|
||||
|
||||
}
|
||||
// ----
|
||||
// Warning: (21-112): Function state mutability can be restricted to pure
|
||||
// Warning: (118-200): Function state mutability can be restricted to pure
|
Loading…
Reference in New Issue
Block a user