solidity/test/libsolidity/semanticTests/immutable/use_scratch.sol

25 lines
427 B
Solidity
Raw Normal View History

2020-03-12 16:32:10 +00:00
contract C {
uint256 immutable x;
uint256 immutable y;
mapping(uint => uint) public m;
2020-06-23 12:14:24 +00:00
constructor(uint _a) {
2020-03-12 16:32:10 +00:00
x = 42;
y = 23;
m[_a] = 7;
new uint[](4);
}
function f() public view returns (uint256, uint256) {
return (x+x,y);
}
}
2020-04-02 18:06:52 +00:00
// ====
// compileViaYul: also
2020-03-12 16:32:10 +00:00
// ----
// constructor(): 3 ->
2022-02-15 11:20:28 +00:00
// gas irOptimized: 131042
2021-11-15 15:19:33 +00:00
// gas legacy: 209361
// gas legacyOptimized: 139324
2020-03-12 16:32:10 +00:00
// f() -> 84, 23
// m(uint256): 3 -> 7