mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Mark chainid as view.
This commit is contained in:
parent
fca8026250
commit
588535566f
@ -22,6 +22,7 @@ Breaking Changes:
|
||||
* Type System: Explicit conversions from literals to enums are only allowed if the value fits in the enum.
|
||||
* Type System: Explicit conversions from literals to integer type is as strict as implicit conversions.
|
||||
* Type System: Unary negation can only be used on signed integers, not on unsigned integers.
|
||||
* View Pure Checker: Mark ``chainid`` as view.
|
||||
|
||||
Language Features:
|
||||
* Super constructors can now be called using the member notation e.g. ``M.C(123)``.
|
||||
|
@ -91,6 +91,8 @@ New Restrictions
|
||||
* Remove support for the ``\b``, ``\f``, and ``\v`` escape sequences in code.
|
||||
They can still be inserted via hexadecimal escapes, e.g. ``\x08``, ``\x0c``, and ``\x0b``, respectively.
|
||||
|
||||
* The ``chainid`` builtin in inline assembly is now considered ``view`` instead of ``pure``.
|
||||
|
||||
Interface Changes
|
||||
=================
|
||||
|
||||
|
@ -365,6 +365,7 @@ bool SemanticInformation::invalidInPureFunctions(Instruction _instruction)
|
||||
case Instruction::ORIGIN:
|
||||
case Instruction::CALLER:
|
||||
case Instruction::CALLVALUE:
|
||||
case Instruction::CHAINID:
|
||||
case Instruction::GAS:
|
||||
case Instruction::GASPRICE:
|
||||
case Instruction::EXTCODESIZE:
|
||||
|
@ -1,5 +1,5 @@
|
||||
contract C {
|
||||
function f() pure external returns (uint id) {
|
||||
function f() view external returns (uint id) {
|
||||
assembly {
|
||||
id := chainid()
|
||||
}
|
||||
|
@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
assembly { pop(chainid()) }
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=istanbul
|
||||
// ----
|
||||
// TypeError 2527: (67-76): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
@ -1,5 +1,5 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
function f() public view {
|
||||
assembly { pop(chainid()) }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user