mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Enforcing error on msg.gas and block.blockhash()
This commit is contained in:
@@ -2,4 +2,4 @@ contract C {
|
||||
function f() public view returns (uint256 val) { return msg.gas; }
|
||||
}
|
||||
// ----
|
||||
// Warning: (73-80): "msg.gas" has been deprecated in favor of "gasleft()"
|
||||
// TypeError: (73-80): "msg.gas" has been deprecated in favor of "gasleft()"
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
pragma experimental "v0.5.0";
|
||||
contract C {
|
||||
function f() public returns (uint256 val) { return msg.gas; }
|
||||
}
|
||||
// ----
|
||||
// TypeError: (98-105): "msg.gas" has been deprecated in favor of "gasleft()"
|
||||
+1
-1
@@ -4,4 +4,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (77-92): "block.blockhash()" has been deprecated in favor of "blockhash()"
|
||||
// TypeError: (77-92): "block.blockhash()" has been deprecated in favor of "blockhash()"
|
||||
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
pragma experimental "v0.5.0";
|
||||
contract C {
|
||||
function f() public returns (bytes32) { return block.blockhash(3); }
|
||||
}
|
||||
// ----
|
||||
// TypeError: (94-109): "block.blockhash()" has been deprecated in favor of "blockhash()"
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
bytes32 h = keccak256(abi.encodePacked(keccak256, f, this.f.gas, block.blockhash));
|
||||
bytes32 h = keccak256(abi.encodePacked(keccak256, f, this.f.gas, blockhash));
|
||||
h;
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,4 @@ contract C {
|
||||
// TypeError: (91-100): This type cannot be encoded.
|
||||
// TypeError: (102-103): This type cannot be encoded.
|
||||
// TypeError: (105-115): This type cannot be encoded.
|
||||
// TypeError: (117-132): This type cannot be encoded.
|
||||
// TypeError: (117-126): This type cannot be encoded.
|
||||
|
||||
Reference in New Issue
Block a user