File tree Expand file tree Collapse file tree 3 files changed +35
-2
lines changed Expand file tree Collapse file tree 3 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -2340,8 +2340,11 @@ impl<W: Write> Visitor for Formatter<'_, W> {
23402340 ""
23412341 } ;
23422342 let closing_bracket = format ! ( "{prefix}{}" , "}" ) ;
2343- let closing_bracket_loc = args. last ( ) . unwrap ( ) . loc . end ( ) ;
2344- write_chunk ! ( self , closing_bracket_loc, "{closing_bracket}" ) ?;
2343+ if let Some ( arg) = args. last ( ) {
2344+ write_chunk ! ( self , arg. loc. end( ) , "{closing_bracket}" ) ?;
2345+ } else {
2346+ write_chunk ! ( self , "{closing_bracket}" ) ?;
2347+ }
23452348
23462349 Ok ( ( ) )
23472350 }
Original file line number Diff line number Diff line change @@ -144,3 +144,18 @@ contract IfElseTest {
144144 }
145145 }
146146}
147+
148+ contract DbgFmtTest is Test {
149+ function test_argsList () public {
150+ uint256 result1 = internalNoArgs ({});
151+ result2 = add ({a: 1 , b: 2 });
152+ }
153+
154+ function add (uint256 a , uint256 b ) internal pure returns (uint256 ) {
155+ return a + b;
156+ }
157+
158+ function internalNoArgs () internal pure returns (uint256 ) {
159+ return 0 ;
160+ }
161+ }
Original file line number Diff line number Diff line change @@ -143,3 +143,18 @@ contract IfElseTest {
143143 }
144144 }
145145}
146+
147+ contract DbgFmtTest is Test {
148+ function test_argsList () public {
149+ uint256 result1 = internalNoArgs ({});
150+ result2 = add ({a: 1 , b: 2 });
151+ }
152+
153+ function add (uint256 a , uint256 b ) internal pure returns (uint256 ) {
154+ return a + b;
155+ }
156+
157+ function internalNoArgs () internal pure returns (uint256 ) {
158+ return 0 ;
159+ }
160+ }
You can’t perform that action at this time.
0 commit comments