Solidity 0.7.0 is a breaking release of the Solidity compiler and language.
This release does not include many features but rather changes that require a backwards-incompatible adjustment in syntax or semantics. For a detailed explanation, please see the documentation.
Most notably, further cleanup of visibility and state mutability has been performed and several unpopular keywords have been removed. Types with mappings in memory are disallowed and shift and exponentiation operations use more reasonable types.
Since we usually do not backport bugfixes, it is recommended to upgrade all code to be compatible with Solidity v.0.7.0. The solidity-upgrade tool can help you to semi-automatically upgrade your contracts to breaking language changes. While solidity-upgrade carries out a large part of the work, your contracts will most likely need further manual adjustments.
You can find a guide on how to update your code here.
Note that changes listed below are the changes between 0.6.12 and 0.7.0. For changes introduced during the 0.6.x series, please see the individual changelogs or release announcements on this blog.
- Inline Assembly: Disallow . in user-defined function and variable names.
- Inline Assembly: Slot and offset of storage pointer variable x are accessed via x.slot and x.offset instead of x_slot and x_offset.
- JSON AST: Mark hex string literals with kind: "hexString".
- JSON AST: Remove members with null value from JSON output.
- Parser: Disallow gwei as identifier.
- Parser: Disallow dot syntax for value and gas.
- Parser: Disallow non-printable characters in string literals.
- Parser: Introduce Unicode string literals: unicode"😃".
- Parser: NatSpec comments on variables are only allowed for public state variables.
- Parser: Remove the finney and szabo denominations.
- Parser: Remove the identifier now (replaced by block.timestamp).
- Reference Resolver: using A for B only affects the contract it is mentioned in and not all derived contracts
- Type Checker: Disallow virtual for library functions.
- Type Checker: Disallow assignments to state variables that contain nested mappings.
- Type checker: Disallow events with same name and parameter types in inheritance hierarchy.
- Type Checker: Disallow shifts by signed types.
- Type Checker: Disallow structs and arrays in memory or calldata if they contain nested mappings.
- Type Checker: Exponentiation and shifts of literals by non-literals will always use uint256 or int256 as a type.
- Yul: Disallow consecutive and trailing dots in identifiers. Leading dots were already disallowed.
- Yul: Disallow EVM instruction pc().
- Inheritance: Allow overrides to have stricter state mutability: view can override nonpayable and pure can override view.
- Parser: Deprecate visibility for constructors.
- State mutability: Do not issue recommendation for stricter mutability for virtual functions but do issue it for functions that override.
- SMTChecker: Report multi-transaction counterexamples including the function calls that initiate the transactions. This does not include concrete values for reference types and reentrant calls.
- Variable declarations using the var keyword are not recognized anymore.
- Inheritance: Disallow public state variables overwriting pure functions.
- NatSpec: Constructors and functions have consistent userdoc output.
- SMTChecker: Fix internal error when assigning to a 1-tuple.
- SMTChecker: Fix internal error when tuples have extra effectless parenthesis.
- State Mutability: Constant public state variables are considered pure functions.
- Type Checker: Fixing deduction issues on function types when function call has named arguments.
- Immutables: Fix internal compiler error when immutables are not assigned.
A big thank you to all contributors who helped make this release possible!
Download the new version of Solidity here.