Solidity v0.7.2 fixes a bug in free functions, which had been introduced with v0.7.1, and adds compiler-generated utility file export. Furthermore, it comes with a considerably broadened language support of the SMTChecker.
Free Function Overloading Checks
Free functions were introduced in the previous release (Solidity v0.7.1). It turned out that it was possible to define a function with the same name multiple times, even containing the same parameter types. Allowing two functions with the same name, but different parameter types is called "overloading" and is useful when essentially the same functionality is implemented for different types. However, what should not be possible is allowing two functions with the same name and same parameter types.
In v0.7.1, the compiler would silently generate code that called the first definition.
To fix the bug, the missing check has been added.
Notable New Features
Utility File Export
For routines like the ABI encoder and decoder, the compiler generates additional code that cannot directly be attributed to specific locations in the source code. For a while now, these routines are generated as Yul code that is supposed to be readable and auditable. Solidity 0.7.2 provides the ability to output the generated code, both in its optimized and in its non-optimized form.
The generated files are available in standard-json under the keys evm.bytecode.generatedSources and evm.deployedBytecode.generatedSources, respectively. For now, there is a single file that is always called #utility.yul, but this can change in the future.
- Type Checker: Disallow two or more free functions with identical name (potentially imported and aliased) and parameter types.
- Export compiler-generated utility sources via standard-json or combined-json.
- Optimizer: Optimize exp when base is 0, 1 or 2.
- SMTChecker: Keep knowledge about string literals, even through assignment, and thus support the .length property properly.
- SMTChecker: Support address type conversion with literals, e.g. address(0).
- SMTChecker: Support revert().
- SMTChecker: Support type(T).min, type(T).max, and type(I).interfaceId.
- SMTChecker: Support compound and, or, and xor operators.
- SMTChecker: Support events and low-level logs.
- SMTChecker: Support fixed bytes index access.
- SMTChecker: Support memory allocation, e.g. new bytes(123).
- SMTChecker: Support shifts.
- SMTChecker: Support structs.
- Type Checker: Explain why oversized hex string literals can not be explicitly converted to a shorter bytesNN type.
- Type Checker: More detailed error messages why implicit conversions fail.
- Type Checker: Report position of first invalid UTF-8 sequence in unicode"" literals.
- Yul IR Generator: Report source locations related to unimplemented features.
- Yul Optimizer: Inline into functions further down in the call graph first.
- Yul Optimizer: Prune unused parameters in functions.
- Yul Optimizer: Try to simplify function names.
- Code generator: Fix internal error on stripping dynamic types from return parameters on EVM versions without RETURNDATACOPY.
- Type Checker: Add missing check against nested dynamic arrays in ABI encoding functions when ABIEncoderV2 is disabled.
- Type Checker: Correct the error message for invalid named parameter in a call to refer to the right argument.
- Type Checker: Correct the warning for homonymous, but not shadowing declarations.
- Type Checker: Disallow virtual for modifiers in libraries.
- Type system: Fix internal error on implicit conversion of contract instance to the type of its super.
- Type system: Fix internal error on implicit conversion of string literal to a calldata string.
- Type system: Fix named parameters in overloaded function and event calls being matched incorrectly if the order differs from the declaration.
- ViewPureChecker: Prevent visibility check on constructors.
A big thank you to all contributors who helped make this release possible!
Download the new version of Solidity here.