v2.3.0
What's Changed
Format changes
We had to address formatting choices rather than just fixing formatting bugs thus there was a need to publish a new minor release.
-
standardising all assignment types by @Janther in #1437
There are 4 ways to assign a value to a variable and in each one we used to have a slightly different logic.// Constant Definition uint constant FOO_BAR = 0x1234; contract Foo { // State Variable Definition uint foo = 0x1234; function bar() { // Variable Declaration uint foobar = 0x5678; // Assignment Expression foobar = 0xabcd; } }
This is likely going to impact variable definitions where the initial value was a long expression.
// [email protected] contract Foo { bool success = aggregator1 == address(uint160(SIG_VALIDATION_SUCCESS)) && aggregator2 == address(uint160(SIG_VALIDATION_SUCCESS)); bytes32 public constant BALLOT_TYPEHASH = keccak256("Ballot(uint256 proposalId,uint8 support,address voter,uint256 nonce)"); } // [email protected] contract Foo { bool success = aggregator1 == address(uint160(SIG_VALIDATION_SUCCESS)) && aggregator2 == address(uint160(SIG_VALIDATION_SUCCESS)); bytes32 public constant BALLOT_TYPEHASH = keccak256( "Ballot(uint256 proposalId,uint8 support,address voter,uint256 nonce)" ); }
-
Variables initiated with a multipart string are now indented by @Janther in #1436
// [email protected] contract Foo { string public constant str = "DeadBeef00" "DeadBeef01" "DeadBeef02"; function bar() public { string str = "DeadBeef03" "DeadBeef04" "DeadBeef05"; str = "DeadBeef0a" "DeadBeef0b" "DeadBeef0c"; } } // [email protected] contract Foo { string public constant str = "DeadBeef00" "DeadBeef01" "DeadBeef02"; function bar() public { string str = "DeadBeef03" "DeadBeef04" "DeadBeef05"; str = "DeadBeef0a" "DeadBeef0b" "DeadBeef0c"; } }
Notice how the state variable was already formatting correctly thus making clear the need to standardise the value assingments.
-
remove indentation of a logical operation if it's the operand of a conditional by @Janther in #1441
// [email protected] uint foo = longCondition1 || longCondition2 ? 1234567890 : 9876543210; // [email protected] uint foo = longCondition1 || longCondition2 ? 1234567890 : 9876543210;
Dependencies
- This package was bundled with webpack 5.105.4 by @dependabot[bot] in #1438
- Support @nomicfoundation/slang 1.3.4 and supporting up to solidity 0.8.34 by @Janther in #1421
- Updating semver to 7.7.4 by @dependabot[bot] in #1403
Behaviour changes
- Prettier can format multiple files in parallel and this plugin is now multi-thread safe by @Janther in #1393
Internal changes
- Keeping with continuously improving code speed, size and simplicity. There has been a lot of progress in reducing the size and repetition of steps while keeping or improving the execution time.
- A few bugs if some rare format cases were addressed.
Development changes
- Improved the code coverage to include all possible edge cases of Slang's AST. by @Janther in #1425
- Improved the types, to be more descriptive and accurate to each scenario.
Full Changelog: v2.2.1...v2.3.0