This is a major breaking release of the Solidity compiler and language. Changes include explicit virtual and override keywords in inheritance, support for try/catch, splitting the fallback function into a receive Ether function and an actual fallback function and limitations on how the length of an array can be changed, among others. For a detailed explanation, please see the documentation or refer to the list below that shows every single change.
From this release on, ABIEncoderV2 is not considered experimental any more, but you still have to activate it through the pragma.
Furthermore, the Yul optimizer is automatically activated together with the regular optimizer, but you can still disable it through the detailed optimizer settings.
Breaking changes:
- ABI: Remove the deprecated
constant
andpayable
fields. - ABI: The
type
field is now required and no longer specified to default tofunction
. - AST: Inline assembly is exported as structured JSON instead of plain string.
- C API (
libsolc
): Introduce context parameter to bothsolidity_compile
and the callback. - C API (
libsolc
): The provided callback now takes two parameters, kind and data. The callback can then be used for multiple purposes, such has file imports and SMT queries. - C API (
libsolc
):solidity_free
was renamed tosolidity_reset
. Functionssolidity_alloc
andsolidity_free
were added. - C API (
libsolc
):solidity_compile
now returns a string that must be explicitly freed viasolidity_free()
- Commandline Interface: Remove the text-based AST printer (
--ast
). - Commandline Interface: Switch to the new error reporter by default.
--old-reporter
falls back to the deprecated old error reporter. - Commandline Interface: Add option to disable or choose hash method between IPFS and Swarm for the bytecode metadata.
- General: Disallow explicit conversions from external function types to
address
and add a member calledaddress
to them as replacement. - General: Enable Yul optimizer as part of standard optimization.
- General: New reserved keywords:
override
,receive
, andvirtual
. - General:
private
cannot be used together withvirtual
. - General: Split unnamed fallback functions into two cases defined using
fallback()
andreceive()
. - Inheritance: State variable shadowing is now disallowed.
- Inline Assembly: Only strict inline assembly is allowed.
- Inline Assembly: Variable declarations cannot shadow declarations outside the assembly block.
- JSON AST: Replace
superFunction
attribute bybaseFunctions
. - Natspec JSON Interface: Properly support multiple
@return
statements in@dev
documentation and enforce named return parameters to be mentioned in the documentation. - Source mappings: Add "modifier depth" as a fifth field in the source mappings.
- Standard JSON Interface: Add option to disable or choose hash method between IPFS and Swarm for the bytecode metadata.
- Syntax:
push(element)
for dynamic storage arrays do not return the new length anymore. - Syntax: Abstract contracts need to be marked explicitly as abstract by using the
abstract
keyword. - Syntax:
length
member of arrays is now always read-only, even for storage arrays. - Type Checker: Resulting type of exponentiation is equal to the type of the base. Also allow signed types for the base.
Language Features:
- Allow explicit conversions from
address
toaddress payable
viapayable(...)
. - Allow global enums and structs.
- Allow public variables to override external functions.
- Allow underscores as delimiters in hex strings.
- Introduce syntax for array slices and implement them for dynamic calldata arrays.
- Introduce
push()
for dynamic storage arrays. It returns a reference to the newly allocated element, if applicable. - Introduce
virtual
andoverride
keywords. - Introduce
try
/catch
-statement - Modify
push(element)
for dynamic storage arrays such that it does not return the new length anymore. - Yul: Introduce
leave
statement that exits the current function. - JSON AST: Add the function selector of each externally-visible FunctonDefinition to the AST JSON export.
Compiler Features:
- Allow revert strings to be stripped from the binary using the
--revert-strings
option or thesettings.debug.revertStrings
setting. - ABIEncoderV2: Do not warn about enabled ABIEncoderV2 anymore (the pragma is still needed, though).
We especially thank all the contributors that made this release possible:
Alexander Arlt, Alex Beregszaszi, Bhargava Shastry, cd10012, Chris Chinchilla, Christian Parpart, Cory Dickson, Daniel Kirchner, djudjuu, Erik Kundt, Gaith Hallak, krk, Leo Arias, Leonardo Alt, Mathias Baumann, misterfoxy, rodiazet, William Entriken
If you want to perform a source build, please only use solidity_0.6.0.tar.gz and not the zip provided by github directly.