Skip to content

Commit

Permalink
Fix missing comma in Stmt::Load Display impl (#132)
Browse files Browse the repository at this point in the history
Summary:
I was exploring using starlark_syntax to merge BUILD files together, and noticed that it generates invalid load statements. Its a simple fix, we just add a comma that was missing from the Display impl.

This is the same as #131 just from my work github org so the CLA automation works correctly.

Pull Request resolved: #132

Reviewed By: KapJI

Differential Revision: D65606766

Pulled By: stepancheg

fbshipit-source-id: baeb88a29470546f30becc38a9f8a5e1ff727f4d
  • Loading branch information
rossdylan authored and facebook-github-bot committed Nov 7, 2024
1 parent be2cd13 commit 8b2f376
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion starlark_syntax/src/syntax/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ impl Display for Expr {
for x in c {
write!(f, "{}", x)?;
}
f.write_str("}}")
f.write_str("}")
}
Expr::Literal(x) => write!(f, "{}", x),
Expr::FString(x) => {
Expand Down Expand Up @@ -757,6 +757,7 @@ impl Stmt {
Stmt::Load(load) => {
write!(f, "{}load(", tab)?;
fmt_string_literal(f, &load.module.node)?;
f.write_str(", ")?;
comma_separated_fmt(
f,
&load.args,
Expand Down
2 changes: 1 addition & 1 deletion starlark_syntax/src/syntax/grammar_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fn test_top_level_comment() {

#[test]
fn test_top_level_load() {
let want = "load(\"//top/level/load.bzl\"top-level = \"top-level\")\n";
let want = "load(\"//top/level/load.bzl\", top-level = \"top-level\")\n";
assert_eq!(
parse("\nload(\"//top/level/load.bzl\", \"top-level\")\n"),
want
Expand Down

0 comments on commit 8b2f376

Please sign in to comment.