solidity/test/libsolidity/semanticTests/literalSuffixes/unchecked_suffixes.sol
2023-05-17 16:55:14 +02:00

21 lines
476 B
Solidity

function uncheckedSuffix(uint8 x) pure suffix returns (uint8) {
unchecked {
return x + 10;
}
}
contract C {
function testUncheckedSuffix() public pure returns (uint8) {
return 250 uncheckedSuffix;
}
function testUncheckedSuffixInUncheckedBlock() public pure returns (uint8) {
unchecked {
return 250 uncheckedSuffix;
}
}
}
// ----
// testUncheckedSuffix() -> 4
// testUncheckedSuffixInUncheckedBlock() -> 4