Solidity v0.8.2 adds an optimizer stage that can inline small amounts of code to save gas and provides more means to work with code documentation by exporting inline comments and allowing custom natspec tags.
Notable New Features
This release adds a simple inliner to the low-level optimizer of Solidity. It can inline short functions that do not contain control-flow branches or opcodes with side-effects. If you want to learn more about the inliner, read this post.
Custom Natspec and Exported Documentation
It is now possible to use documentation tags outside of the set of those
recognized by the compiler. These custom tags have to start with
followed by lowercase characters or hypens. How these tags are used is application-defined,
but we imagine this to be useful for formal verification or special documentation needs.
Examples could be
@custom:since v2.3 or
These custom tags are included in the NatSpec export in the “developer documentation”.
It is possible to also use triple-slash documentation inside functions. These are
exported by the compiler as part of the Json AST as the
property of the following statement.
- AST: Export NatSpec comments above each statement as their documentation.
- Inline Assembly: Do not warn anymore about variables or functions being shadowed by EVM opcodes.
- NatSpec: Allow and export all tags that start with
- NatSpec: Provide source locations for parsing errors.
- Optimizer: Simple inlining when jumping to small blocks that jump again after a few side-effect free opcodes.
- AST: Added referencedDeclaration for enum members.
- Code Generator: Fix internal error when functions are passed as parameters of other callables, when the function types can be implicitly converted, but not identical.
- Parser: Properly parse .address in some situations.
- SMTChecker: Fix missing type constraints on block and transaction variables in the deployment phase.
- Type Checker: Fix internal error when override specifier is not a contract.
- Type Checker: Make function-hash collision errors into fatal type errors.
- Adds nameLocation to declarations to represent the exact location of the symbolic name.
- Removed the redundant function type “bytearraypush” - replaced by “arraypush”.
- Support field documentation to hold NatSpec comments above each statement.
A big thank you to all contributors who helped make this release possible!
Download the new version of Solidity here.