From e9e905da88647c8ba3f9a21305e1a5423b7c3534 Mon Sep 17 00:00:00 2001 From: Klaus Date: Mon, 23 Feb 2026 16:05:52 -0300 Subject: [PATCH 1/5] updating the code coverage on more niche syntaxes --- .../AllSolidityFeatures.sol | 1 + .../__snapshots__/format.test.js.snap | 2 ++ tests/format/Assembly/Assembly.sol | 7 ++++++ .../__snapshots__/format.test.js.snap | 14 ++++++++++++ .../format/BinaryOperationHierarchy/Group.sol | 2 +- .../__snapshots__/format.test.js.snap | 4 ++-- tests/format/ForStatements/ForStatements.sol | 2 ++ .../__snapshots__/format.test.js.snap | 4 ++++ .../FunctionDefinitions.sol | 6 +++++ .../__snapshots__/format.test.js.snap | 11 ++++++++++ .../FunctionDefinitions.sol | 1 + .../__snapshots__/format.test.js.snap | 2 ++ .../FunctionDefinitions.sol | 4 ---- .../__snapshots__/format.test.js.snap | 22 ------------------- .../FunctionDefinitionsv0.5.0/format.test.js | 1 - tests/format/Pragma/Pragma.sol | 3 +++ .../Pragma/__snapshots__/format.test.js.snap | 6 +++++ tests/format/StyleGuide/Mappings.sol | 1 + .../__snapshots__/format.test.js.snap | 2 ++ tests/format/TryCatch/TryCatch.sol | 2 +- .../__snapshots__/format.test.js.snap | 4 ++-- .../format/TypeDefinition/TypeDefinition.sol | 2 ++ .../__snapshots__/format.test.js.snap | 3 +++ .../strings/__snapshots__/format.test.js.snap | 8 +++++++ tests/format/strings/strings.sol | 4 ++++ 25 files changed, 85 insertions(+), 33 deletions(-) delete mode 100644 tests/format/FunctionDefinitionsv0.5.0/FunctionDefinitions.sol delete mode 100644 tests/format/FunctionDefinitionsv0.5.0/__snapshots__/format.test.js.snap delete mode 100644 tests/format/FunctionDefinitionsv0.5.0/format.test.js diff --git a/tests/format/AllSolidityFeatures/AllSolidityFeatures.sol b/tests/format/AllSolidityFeatures/AllSolidityFeatures.sol index 081663de2..75f58273f 100644 --- a/tests/format/AllSolidityFeatures/AllSolidityFeatures.sol +++ b/tests/format/AllSolidityFeatures/AllSolidityFeatures.sol @@ -181,6 +181,7 @@ contract assemblyLocalBinding { let x := 0x00 let y := x let z := "hello" + let t := hex"0123456789abcdef" } } } diff --git a/tests/format/AllSolidityFeatures/__snapshots__/format.test.js.snap b/tests/format/AllSolidityFeatures/__snapshots__/format.test.js.snap index 83e98effd..3bcde827c 100644 --- a/tests/format/AllSolidityFeatures/__snapshots__/format.test.js.snap +++ b/tests/format/AllSolidityFeatures/__snapshots__/format.test.js.snap @@ -189,6 +189,7 @@ contract assemblyLocalBinding { let x := 0x00 let y := x let z := "hello" + let t := hex"0123456789abcdef" } } } @@ -545,6 +546,7 @@ contract assemblyLocalBinding { let x := 0x00 let y := x let z := "hello" + let t := hex"0123456789abcdef" } } } diff --git a/tests/format/Assembly/Assembly.sol b/tests/format/Assembly/Assembly.sol index 91c77e8e0..f717f9336 100644 --- a/tests/format/Assembly/Assembly.sol +++ b/tests/format/Assembly/Assembly.sol @@ -1,6 +1,9 @@ contract Assembly { function ifAssembly() { assembly { + { + success := 1 + } if returndatasize { success := 0 @@ -51,6 +54,7 @@ for { let i := 0 } lt(i, x) { i := add(i, 1) } { y := mul(2, y) } -> result { result := add(x, 1) + leave } } } @@ -61,6 +65,7 @@ for { let i := 0 } lt(i, x) { i := add(i, 1) } { y := mul(2, y) } -> result { result := add(a, add(b, c)) + leave } } } @@ -70,6 +75,7 @@ for { let i := 0 } lt(i, x) { i := add(i, 1) } { y := mul(2, y) } function sum (thisIs, aFunctionWithVery, veryLongParameterNames, andItAlsoHasALotOfParameters, soItShouldBeSplitInMultipleLines) -> result { result := 0 + leave } } } @@ -83,6 +89,7 @@ for { let i := 0 } lt(i, x) { i := add(i, 1) } { y := mul(2, y) } veryLongParameterNames := 0 andItAlsoHasALotOfParameters := 0 soItShouldBeSplitInMultipleLines := 0 + leave } } } diff --git a/tests/format/Assembly/__snapshots__/format.test.js.snap b/tests/format/Assembly/__snapshots__/format.test.js.snap index f358b5c49..870439df6 100644 --- a/tests/format/Assembly/__snapshots__/format.test.js.snap +++ b/tests/format/Assembly/__snapshots__/format.test.js.snap @@ -9,6 +9,9 @@ printWidth: 80 contract Assembly { function ifAssembly() { assembly { + { + success := 1 + } if returndatasize { success := 0 @@ -59,6 +62,7 @@ for { let i := 0 } lt(i, x) { i := add(i, 1) } { y := mul(2, y) } -> result { result := add(x, 1) + leave } } } @@ -69,6 +73,7 @@ for { let i := 0 } lt(i, x) { i := add(i, 1) } { y := mul(2, y) } -> result { result := add(a, add(b, c)) + leave } } } @@ -78,6 +83,7 @@ for { let i := 0 } lt(i, x) { i := add(i, 1) } { y := mul(2, y) } function sum (thisIs, aFunctionWithVery, veryLongParameterNames, andItAlsoHasALotOfParameters, soItShouldBeSplitInMultipleLines) -> result { result := 0 + leave } } } @@ -91,6 +97,7 @@ for { let i := 0 } lt(i, x) { i := add(i, 1) } { y := mul(2, y) } veryLongParameterNames := 0 andItAlsoHasALotOfParameters := 0 soItShouldBeSplitInMultipleLines := 0 + leave } } } @@ -191,6 +198,9 @@ contract BooleanLiteralsInAssembly { contract Assembly { function ifAssembly() { assembly { + { + success := 1 + } if returndatasize { success := 0 } @@ -249,6 +259,7 @@ contract Assembly { assembly { function inc(x) -> result { result := add(x, 1) + leave } } } @@ -257,6 +268,7 @@ contract Assembly { assembly { function sum(a, b, c) -> result { result := add(a, add(b, c)) + leave } } } @@ -271,6 +283,7 @@ contract Assembly { soItShouldBeSplitInMultipleLines ) -> result { result := 0 + leave } } } @@ -290,6 +303,7 @@ contract Assembly { veryLongParameterNames := 0 andItAlsoHasALotOfParameters := 0 soItShouldBeSplitInMultipleLines := 0 + leave } } } diff --git a/tests/format/BinaryOperationHierarchy/Group.sol b/tests/format/BinaryOperationHierarchy/Group.sol index 72e233d32..24fdddeb3 100644 --- a/tests/format/BinaryOperationHierarchy/Group.sol +++ b/tests/format/BinaryOperationHierarchy/Group.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.28; +pragma solidity "0.8.28"; contract Group { uint256 veryVeryVeryLongUint256A; diff --git a/tests/format/BinaryOperationHierarchy/__snapshots__/format.test.js.snap b/tests/format/BinaryOperationHierarchy/__snapshots__/format.test.js.snap index dc224c475..bebb8b2dc 100644 --- a/tests/format/BinaryOperationHierarchy/__snapshots__/format.test.js.snap +++ b/tests/format/BinaryOperationHierarchy/__snapshots__/format.test.js.snap @@ -7,7 +7,7 @@ printWidth: 80 | printWidth =====================================input====================================== // SPDX-License-Identifier: MIT -pragma solidity 0.8.28; +pragma solidity "0.8.28"; contract Group { uint256 veryVeryVeryLongUint256A; @@ -361,7 +361,7 @@ contract Group { } =====================================output===================================== // SPDX-License-Identifier: MIT -pragma solidity 0.8.28; +pragma solidity "0.8.28"; contract Group { uint256 veryVeryVeryLongUint256A; diff --git a/tests/format/ForStatements/ForStatements.sol b/tests/format/ForStatements/ForStatements.sol index baddc34ae..25728064e 100644 --- a/tests/format/ForStatements/ForStatements.sol +++ b/tests/format/ForStatements/ForStatements.sol @@ -4,6 +4,8 @@ contract ForStatements { function hi() public { uint a; +for ((uint i, uint j) = getIndexes(); i < 100; i++) a++; + for (uint i; i < 100; i++) a++; for (i = 0; i < 100; i++) a = a.add(LONG_VARIABLE).add(LONG_VARIABLE).add(LONG_VARIABLE); diff --git a/tests/format/ForStatements/__snapshots__/format.test.js.snap b/tests/format/ForStatements/__snapshots__/format.test.js.snap index 0e6efff07..11a1049a9 100644 --- a/tests/format/ForStatements/__snapshots__/format.test.js.snap +++ b/tests/format/ForStatements/__snapshots__/format.test.js.snap @@ -12,6 +12,8 @@ contract ForStatements { function hi() public { uint a; +for ((uint i, uint j) = getIndexes(); i < 100; i++) a++; + for (uint i; i < 100; i++) a++; for (i = 0; i < 100; i++) a = a.add(LONG_VARIABLE).add(LONG_VARIABLE).add(LONG_VARIABLE); @@ -57,6 +59,8 @@ contract ForStatements { function hi() public { uint a; + for ((uint i, uint j) = getIndexes(); i < 100; i++) a++; + for (uint i; i < 100; i++) a++; for (i = 0; i < 100; i++) diff --git a/tests/format/FunctionDefinitions/FunctionDefinitions.sol b/tests/format/FunctionDefinitions/FunctionDefinitions.sol index fbc308975..d7c9c8fc7 100644 --- a/tests/format/FunctionDefinitions/FunctionDefinitions.sol +++ b/tests/format/FunctionDefinitions/FunctionDefinitions.sol @@ -45,9 +45,15 @@ contract FunctionDefinitions { fallback () external {} fallback () {} fallback () external payable {} + fallback() modify(123) override(Foo) {} + fallback() returns(uint) {} + fallback() external modify() payable override(Foo) virtual returns(uint) {} fallback() external payable virtual {} fallback(bytes calldata _input) external {} + + receive () modify(123) override(Foo) {} + receive () external modify() payable override(Foo) virtual {} receive () external payable {} receive() external payable virtual {} diff --git a/tests/format/FunctionDefinitions/__snapshots__/format.test.js.snap b/tests/format/FunctionDefinitions/__snapshots__/format.test.js.snap index 389837c89..f292ccab3 100644 --- a/tests/format/FunctionDefinitions/__snapshots__/format.test.js.snap +++ b/tests/format/FunctionDefinitions/__snapshots__/format.test.js.snap @@ -53,9 +53,15 @@ contract FunctionDefinitions { fallback () external {} fallback () {} fallback () external payable {} + fallback() modify(123) override(Foo) {} + fallback() returns(uint) {} + fallback() external modify() payable override(Foo) virtual returns(uint) {} fallback() external payable virtual {} fallback(bytes calldata _input) external {} + + receive () modify(123) override(Foo) {} + receive () external modify() payable override(Foo) virtual {} receive () external payable {} receive() external payable virtual {} @@ -415,9 +421,14 @@ contract FunctionDefinitions { fallback() external {} fallback() {} fallback() external payable {} + fallback() override(Foo) modify(123) {} + fallback() returns (uint) {} + fallback() external payable virtual override(Foo) modify returns (uint) {} fallback() external payable virtual {} fallback(bytes calldata _input) external {} + receive() override(Foo) modify(123) {} + receive() external payable virtual override(Foo) modify {} receive() external payable {} receive() external payable virtual {} diff --git a/tests/format/FunctionDefinitionsV0.5.0/FunctionDefinitions.sol b/tests/format/FunctionDefinitionsV0.5.0/FunctionDefinitions.sol index d2d34a07e..81c58fa43 100644 --- a/tests/format/FunctionDefinitionsV0.5.0/FunctionDefinitions.sol +++ b/tests/format/FunctionDefinitionsV0.5.0/FunctionDefinitions.sol @@ -1,4 +1,5 @@ contract FunctionDefinitions { function () external {} function () external payable {} + function () external modify(123) payable {} } diff --git a/tests/format/FunctionDefinitionsV0.5.0/__snapshots__/format.test.js.snap b/tests/format/FunctionDefinitionsV0.5.0/__snapshots__/format.test.js.snap index e010c16f7..f106ebd1b 100644 --- a/tests/format/FunctionDefinitionsV0.5.0/__snapshots__/format.test.js.snap +++ b/tests/format/FunctionDefinitionsV0.5.0/__snapshots__/format.test.js.snap @@ -10,12 +10,14 @@ printWidth: 80 contract FunctionDefinitions { function () external {} function () external payable {} + function () external modify(123) payable {} } =====================================output===================================== contract FunctionDefinitions { function() external {} function() external payable {} + function() external payable modify(123) {} } ================================================================================ diff --git a/tests/format/FunctionDefinitionsv0.5.0/FunctionDefinitions.sol b/tests/format/FunctionDefinitionsv0.5.0/FunctionDefinitions.sol deleted file mode 100644 index d2d34a07e..000000000 --- a/tests/format/FunctionDefinitionsv0.5.0/FunctionDefinitions.sol +++ /dev/null @@ -1,4 +0,0 @@ -contract FunctionDefinitions { - function () external {} - function () external payable {} -} diff --git a/tests/format/FunctionDefinitionsv0.5.0/__snapshots__/format.test.js.snap b/tests/format/FunctionDefinitionsv0.5.0/__snapshots__/format.test.js.snap deleted file mode 100644 index e010c16f7..000000000 --- a/tests/format/FunctionDefinitionsv0.5.0/__snapshots__/format.test.js.snap +++ /dev/null @@ -1,22 +0,0 @@ -// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing - -exports[`FunctionDefinitions.sol - {"compiler":"0.5.17"} format 1`] = ` -====================================options===================================== -compiler: "0.5.17" -parsers: ["slang"] -printWidth: 80 - | printWidth -=====================================input====================================== -contract FunctionDefinitions { - function () external {} - function () external payable {} -} - -=====================================output===================================== -contract FunctionDefinitions { - function() external {} - function() external payable {} -} - -================================================================================ -`; diff --git a/tests/format/FunctionDefinitionsv0.5.0/format.test.js b/tests/format/FunctionDefinitionsv0.5.0/format.test.js deleted file mode 100644 index 80d418f68..000000000 --- a/tests/format/FunctionDefinitionsv0.5.0/format.test.js +++ /dev/null @@ -1 +0,0 @@ -runFormatTest(import.meta, ['slang'], { compiler: '0.5.17' }); diff --git a/tests/format/Pragma/Pragma.sol b/tests/format/Pragma/Pragma.sol index b25fcc72b..a206b8556 100644 --- a/tests/format/Pragma/Pragma.sol +++ b/tests/format/Pragma/Pragma.sol @@ -8,4 +8,7 @@ pragma solidity ~ 0.4.21 ; pragma solidity ^0.4.0 || ^0.5.0 || ^0.6.0 ; pragma solidity 0.5.0 - 0.6.0 ; pragma experimental ABIEncoderV2; +pragma experimental SMTChecker; +pragma experimental "ABIEncoderV2"; +pragma experimental "SMTChecker"; pragma abicoder v2; diff --git a/tests/format/Pragma/__snapshots__/format.test.js.snap b/tests/format/Pragma/__snapshots__/format.test.js.snap index 2585c9843..3802eb5bc 100644 --- a/tests/format/Pragma/__snapshots__/format.test.js.snap +++ b/tests/format/Pragma/__snapshots__/format.test.js.snap @@ -16,6 +16,9 @@ pragma solidity ~ 0.4.21 ; pragma solidity ^0.4.0 || ^0.5.0 || ^0.6.0 ; pragma solidity 0.5.0 - 0.6.0 ; pragma experimental ABIEncoderV2; +pragma experimental SMTChecker; +pragma experimental "ABIEncoderV2"; +pragma experimental "SMTChecker"; pragma abicoder v2; =====================================output===================================== @@ -29,6 +32,9 @@ pragma solidity ~0.4.21; pragma solidity ^0.4.0 || ^0.5.0 || ^0.6.0; pragma solidity 0.5.0 - 0.6.0; pragma experimental ABIEncoderV2; +pragma experimental SMTChecker; +pragma experimental "ABIEncoderV2"; +pragma experimental "SMTChecker"; pragma abicoder v2; ================================================================================ diff --git a/tests/format/StyleGuide/Mappings.sol b/tests/format/StyleGuide/Mappings.sol index 5dbb9448d..f5df6748c 100644 --- a/tests/format/StyleGuide/Mappings.sol +++ b/tests/format/StyleGuide/Mappings.sol @@ -6,4 +6,5 @@ contract Mappings { mapping( address => bool ) registeredAddresses; mapping (uint => mapping (bool => Data[])) public data; mapping(uint => mapping (uint => s)) data; + mapping(Data => uint) data; } diff --git a/tests/format/StyleGuide/__snapshots__/format.test.js.snap b/tests/format/StyleGuide/__snapshots__/format.test.js.snap index cb3816eb7..8aac6d324 100644 --- a/tests/format/StyleGuide/__snapshots__/format.test.js.snap +++ b/tests/format/StyleGuide/__snapshots__/format.test.js.snap @@ -472,6 +472,7 @@ contract Mappings { mapping( address => bool ) registeredAddresses; mapping (uint => mapping (bool => Data[])) public data; mapping(uint => mapping (uint => s)) data; + mapping(Data => uint) data; } =====================================output===================================== @@ -482,6 +483,7 @@ contract Mappings { mapping(address => bool) registeredAddresses; mapping(uint => mapping(bool => Data[])) public data; mapping(uint => mapping(uint => s)) data; + mapping(Data => uint) data; } ================================================================================ diff --git a/tests/format/TryCatch/TryCatch.sol b/tests/format/TryCatch/TryCatch.sol index c0b96f5c6..7a7c10b27 100644 --- a/tests/format/TryCatch/TryCatch.sol +++ b/tests/format/TryCatch/TryCatch.sol @@ -1,6 +1,6 @@ pragma solidity ^0.6.0; -interface DataFeed { function getData(address token) external returns (uint value); } +interface DataFeed is Feed { function getData(address token) external returns (uint value); } contract FeedConsumer { DataFeed feed; diff --git a/tests/format/TryCatch/__snapshots__/format.test.js.snap b/tests/format/TryCatch/__snapshots__/format.test.js.snap index 6a8b4c80f..685c9ffab 100644 --- a/tests/format/TryCatch/__snapshots__/format.test.js.snap +++ b/tests/format/TryCatch/__snapshots__/format.test.js.snap @@ -8,7 +8,7 @@ printWidth: 80 =====================================input====================================== pragma solidity ^0.6.0; -interface DataFeed { function getData(address token) external returns (uint value); } +interface DataFeed is Feed { function getData(address token) external returns (uint value); } contract FeedConsumer { DataFeed feed; @@ -126,7 +126,7 @@ contract Test { =====================================output===================================== pragma solidity ^0.6.0; -interface DataFeed { +interface DataFeed is Feed { function getData(address token) external returns (uint value); } diff --git a/tests/format/TypeDefinition/TypeDefinition.sol b/tests/format/TypeDefinition/TypeDefinition.sol index f4aeac50f..5e21ce5f4 100644 --- a/tests/format/TypeDefinition/TypeDefinition.sol +++ b/tests/format/TypeDefinition/TypeDefinition.sol @@ -3,6 +3,8 @@ pragma solidity ^0.8.8; type Hello is uint; contract TypeDefinition { + + type GoodBye is uint256; event Moon(Hello world); function demo(Hello world) public { diff --git a/tests/format/TypeDefinition/__snapshots__/format.test.js.snap b/tests/format/TypeDefinition/__snapshots__/format.test.js.snap index a7a6a557a..b8b333141 100644 --- a/tests/format/TypeDefinition/__snapshots__/format.test.js.snap +++ b/tests/format/TypeDefinition/__snapshots__/format.test.js.snap @@ -11,6 +11,8 @@ pragma solidity ^0.8.8; type Hello is uint; contract TypeDefinition { + + type GoodBye is uint256; event Moon(Hello world); function demo(Hello world) public { @@ -25,6 +27,7 @@ pragma solidity ^0.8.8; type Hello is uint; contract TypeDefinition { + type GoodBye is uint256; event Moon(Hello world); function demo(Hello world) public { diff --git a/tests/format/strings/__snapshots__/format.test.js.snap b/tests/format/strings/__snapshots__/format.test.js.snap index d1374d40c..2331bc22e 100644 --- a/tests/format/strings/__snapshots__/format.test.js.snap +++ b/tests/format/strings/__snapshots__/format.test.js.snap @@ -99,6 +99,10 @@ library strings { ret += 8; self = bytes32(uint(self) / 0x10000000000000000); } + if (self & 0xffffffff wei == 0) { + ret += 4; + self = bytes32(uint(self) / 0x100000000); + } if (self & 0xffffffff == 0) { ret += 4; self = bytes32(uint(self) / 0x100000000); @@ -817,6 +821,10 @@ library strings { ret += 8; self = bytes32(uint(self) / 0x10000000000000000); } + if (self & 0xffffffff wei == 0) { + ret += 4; + self = bytes32(uint(self) / 0x100000000); + } if (self & 0xffffffff == 0) { ret += 4; self = bytes32(uint(self) / 0x100000000); diff --git a/tests/format/strings/strings.sol b/tests/format/strings/strings.sol index 3e2318b4d..e74ceccfc 100644 --- a/tests/format/strings/strings.sol +++ b/tests/format/strings/strings.sol @@ -91,6 +91,10 @@ library strings { ret += 8; self = bytes32(uint(self) / 0x10000000000000000); } + if (self & 0xffffffff wei == 0) { + ret += 4; + self = bytes32(uint(self) / 0x100000000); + } if (self & 0xffffffff == 0) { ret += 4; self = bytes32(uint(self) / 0x100000000); From e5a3cc5ed174799fb26e70f95bf13d556bfde063 Mon Sep 17 00:00:00 2001 From: Klaus Date: Tue, 24 Feb 2026 21:34:02 -0300 Subject: [PATCH 2/5] clean empty arguments in modifier --- tests/format/FunctionDefinitionsV0.5.0/FunctionDefinitions.sol | 1 + .../FunctionDefinitionsV0.5.0/__snapshots__/format.test.js.snap | 2 ++ 2 files changed, 3 insertions(+) diff --git a/tests/format/FunctionDefinitionsV0.5.0/FunctionDefinitions.sol b/tests/format/FunctionDefinitionsV0.5.0/FunctionDefinitions.sol index 81c58fa43..21ca8bf4c 100644 --- a/tests/format/FunctionDefinitionsV0.5.0/FunctionDefinitions.sol +++ b/tests/format/FunctionDefinitionsV0.5.0/FunctionDefinitions.sol @@ -2,4 +2,5 @@ contract FunctionDefinitions { function () external {} function () external payable {} function () external modify(123) payable {} + function () external modify() payable {} } diff --git a/tests/format/FunctionDefinitionsV0.5.0/__snapshots__/format.test.js.snap b/tests/format/FunctionDefinitionsV0.5.0/__snapshots__/format.test.js.snap index f106ebd1b..adcbfd864 100644 --- a/tests/format/FunctionDefinitionsV0.5.0/__snapshots__/format.test.js.snap +++ b/tests/format/FunctionDefinitionsV0.5.0/__snapshots__/format.test.js.snap @@ -11,6 +11,7 @@ contract FunctionDefinitions { function () external {} function () external payable {} function () external modify(123) payable {} + function () external modify() payable {} } =====================================output===================================== @@ -18,6 +19,7 @@ contract FunctionDefinitions { function() external {} function() external payable {} function() external payable modify(123) {} + function() external payable modify {} } ================================================================================ From 3691c26c5113c855a1edb01fff974e68239ed0d9 Mon Sep 17 00:00:00 2001 From: Klaus Date: Thu, 26 Feb 2026 12:55:58 -0300 Subject: [PATCH 3/5] adding `YulEqualColon` and `YulColonEqual` to the format tests --- tests/config/run-format-test.js | 11 ++++++++++- tests/format/AssemblyV0.4.26/Assembly.sol | 2 ++ .../AssemblyV0.4.26/__snapshots__/format.test.js.snap | 5 +++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/config/run-format-test.js b/tests/config/run-format-test.js index 5d425c556..9b8c5c5fa 100644 --- a/tests/config/run-format-test.js +++ b/tests/config/run-format-test.js @@ -33,7 +33,13 @@ const unstableTests = new Map( // Here we add files that will not have the same AST after being formatted. const unstableAstTests = new Map( - [].map((fixture) => { + [ + // `: =` and `= :` are syntactically the same as `:=` and `=:`, but the ast + // changes from `YulColonAndEqual` and `YulEqualAndColon` to `ColonEqual` + // and `EqualColon`, which is expected but the workaround to keep the test + // stable is too much, so we just put it in this list. + "AssemblyV0.4.26/Assembly.sol", + ].map((fixture) => { const [file, isAstUnstable = () => true] = Array.isArray(fixture) ? fixture : [fixture]; @@ -73,6 +79,9 @@ const antlrMismatchTests = new Map( "IndexOf/IndexOf.sol", // Syntax for `pragma solidity 0.5.0 - 0.6.0;` not supported by ANTLR "Pragma/Pragma.sol", + // ANTLR doesn't support assembly assignment operators separated by a space + // like `: =` or `= :` + "AssemblyV0.4.26/Assembly.sol", ].map((fixture) => { const [file, compareBytecode = () => true] = Array.isArray(fixture) ? fixture diff --git a/tests/format/AssemblyV0.4.26/Assembly.sol b/tests/format/AssemblyV0.4.26/Assembly.sol index dddccb54c..0c1a63e13 100644 --- a/tests/format/AssemblyV0.4.26/Assembly.sol +++ b/tests/format/AssemblyV0.4.26/Assembly.sol @@ -39,6 +39,7 @@ contract MultipleAssemblyAssignment { function foo() public pure { assembly { function bar() -> a, b { + b : = 2 a := 1 b := 2 } @@ -52,6 +53,7 @@ contract AssemblyStackAssignment { function f() public { assembly { 4 =: y + 4 = : y } } } diff --git a/tests/format/AssemblyV0.4.26/__snapshots__/format.test.js.snap b/tests/format/AssemblyV0.4.26/__snapshots__/format.test.js.snap index 8cccd2f59..66c66bdbd 100644 --- a/tests/format/AssemblyV0.4.26/__snapshots__/format.test.js.snap +++ b/tests/format/AssemblyV0.4.26/__snapshots__/format.test.js.snap @@ -47,6 +47,7 @@ contract MultipleAssemblyAssignment { function foo() public pure { assembly { function bar() -> a, b { + b : = 2 a := 1 b := 2 } @@ -60,6 +61,7 @@ contract AssemblyStackAssignment { function f() public { assembly { 4 =: y + 4 = : y } } } @@ -108,6 +110,7 @@ contract MultipleAssemblyAssignment { function foo() public pure { assembly { function bar() -> a, b { + b := 2 a := 1 b := 2 } @@ -122,6 +125,8 @@ contract AssemblyStackAssignment { assembly { 4 =: y + 4 + =: y } } } From 5942f7d735c64f73fafee264899b5fefcfe737a7 Mon Sep 17 00:00:00 2001 From: Klaus Date: Thu, 26 Feb 2026 13:15:53 -0300 Subject: [PATCH 4/5] Single `HexStringLiteral` and `UntypedTupleMember` with `storageLocation` --- tests/config/run-format-test.js | 3 +++ .../AllSolidityFeatures.sol | 14 +++++++++++ .../__snapshots__/format.test.js.snap | 23 +++++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/tests/config/run-format-test.js b/tests/config/run-format-test.js index 9b8c5c5fa..4e0af1597 100644 --- a/tests/config/run-format-test.js +++ b/tests/config/run-format-test.js @@ -82,6 +82,9 @@ const antlrMismatchTests = new Map( // ANTLR doesn't support assembly assignment operators separated by a space // like `: =` or `= :` "AssemblyV0.4.26/Assembly.sol", + // ANTLR doesn't support UntypedTupleMember with a storage location, which + // is valid Slang, but not in Solidity. + "AllSolidityFeaturesV0.4.26/AllSolidityFeatures.sol", ].map((fixture) => { const [file, compareBytecode = () => true] = Array.isArray(fixture) ? fixture diff --git a/tests/format/AllSolidityFeaturesV0.4.26/AllSolidityFeatures.sol b/tests/format/AllSolidityFeaturesV0.4.26/AllSolidityFeatures.sol index dec42d4ea..fcefc78de 100644 --- a/tests/format/AllSolidityFeaturesV0.4.26/AllSolidityFeatures.sol +++ b/tests/format/AllSolidityFeaturesV0.4.26/AllSolidityFeatures.sol @@ -18,6 +18,20 @@ contract test { var b = 7 + (c * (8 - 7)) - x; return -(-b | 0); } + + function singleHexString() payable { + string storage a = hex"ab1248fe"; + } + + + function storageLocationsInTuple() { + var ( + memory foo, + storage bar, + baz) = + (0, 0, 0); + // ~~~~~~ ~~~~~~~ => these are the storage locations + } } contract c { diff --git a/tests/format/AllSolidityFeaturesV0.4.26/__snapshots__/format.test.js.snap b/tests/format/AllSolidityFeaturesV0.4.26/__snapshots__/format.test.js.snap index ee0607181..2f08a1fbd 100644 --- a/tests/format/AllSolidityFeaturesV0.4.26/__snapshots__/format.test.js.snap +++ b/tests/format/AllSolidityFeaturesV0.4.26/__snapshots__/format.test.js.snap @@ -27,6 +27,20 @@ contract test { var b = 7 + (c * (8 - 7)) - x; return -(-b | 0); } + + function singleHexString() payable { + string storage a = hex"ab1248fe"; + } + + + function storageLocationsInTuple() { + var ( + memory foo, + storage bar, + baz) = + (0, 0, 0); + // ~~~~~~ ~~~~~~~ => these are the storage locations + } } contract c { @@ -225,6 +239,15 @@ contract test { var b = 7 + (c * (8 - 7)) - x; return -(-b | 0); } + + function singleHexString() payable { + string storage a = hex"ab1248fe"; + } + + function storageLocationsInTuple() { + var (memory foo, storage bar, baz) = (0, 0, 0); + // ~~~~~~ ~~~~~~~ => these are the storage locations + } } contract c { From 6eb9015f85820ba8073ea45218e827418625df9d Mon Sep 17 00:00:00 2001 From: Klaus Date: Fri, 27 Feb 2026 10:00:18 -0300 Subject: [PATCH 5/5] updating passing coverage requirements --- .c8rc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.c8rc b/.c8rc index 315fdc955..2c2e31510 100644 --- a/.c8rc +++ b/.c8rc @@ -1,9 +1,9 @@ { "check-coverage": true, - "branches": 90, - "lines": 90, - "functions": 90, - "statements": 90, + "branches": 95, + "lines": 98, + "functions": 100, + "statements": 98, "exclude": ["/node_modules/"], "include": ["src/**/*.ts", "variant-coverage/**/*.ts"], "reporter": ["lcov", "text"],