Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fmt): fix indent closing parenthesis enclosed in { } #7557

Merged
merged 2 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/fmt/src/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ impl<'a, W: Write> Formatter<'a, W> {
write_chunk!(fmt, "{}", stringified.trim_start())
})?;
if !last.content.trim_start().is_empty() {
self.write_whitespace_separator(true)?;
self.indented(1, |fmt| fmt.write_whitespace_separator(true))?;
}
let last_chunk =
self.chunk_at(last.loc_before(), last.loc_next(), last.spaced, &last.content);
Expand Down
12 changes: 12 additions & 0 deletions crates/fmt/testdata/Repros/fmt.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,15 @@ function errorIdentifier() {
bytes memory error = bytes("");
if (error.length > 0) {}
}

// https://github.com/foundry-rs/foundry/issues/7549
function one() external {
this.other({
data: abi.encodeCall(
this.other,
(
"bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla"
)
)
});
}
12 changes: 12 additions & 0 deletions crates/fmt/testdata/Repros/original.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,15 @@ function errorIdentifier() {
bytes memory error = bytes("");
if (error.length > 0) {}
}

// https://github.com/foundry-rs/foundry/issues/7549
function one() external {
this.other({
data: abi.encodeCall(
this.other,
(
"bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla"
)
)
});
}
2 changes: 1 addition & 1 deletion testdata/default/cheats/RecordAccountAccesses.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ contract RecordAccountAccessesTest is DSTest {
data: abi.encodeCall(
Create2or.create2,
(bytes32(0), abi.encodePacked(type(ConstructorStorer).creationCode, abi.encode(true)))
),
),
reverted: false,
storageAccesses: new Vm.StorageAccess[](0),
depth: 1
Expand Down
Loading