Skip to content

Commit

Permalink
An expression statement should be followed by ; (hyperledger-solang#1601
Browse files Browse the repository at this point in the history
)

Fixes hyperledger-solang#1600

Signed-off-by: Sean Young <[email protected]>
  • Loading branch information
seanyoung authored Nov 27, 2023
1 parent 99ecfc0 commit 90b3f70
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions solang-parser/src/helpers/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,10 @@ impl Display for pt::Statement {
f.write_str(") ")?;
block.fmt(f)
}
Self::Expression(_, expr) => expr.fmt(f),
Self::Expression(_, expr) => {
expr.fmt(f)?;
f.write_char(';')
}
Self::VariableDefinition(_, var, expr) => {
var.fmt(f)?;
write_opt!(f, " = ", expr);
Expand Down Expand Up @@ -2419,7 +2422,7 @@ mod tests {

pt::Statement::While(loc!(), expr!(true), Box::new(stmt!({}))) => "while (true) {}",

pt::Statement::Expression(loc!(), expr!(true)) => "true",
pt::Statement::Expression(loc!(), expr!(true)) => "true;",

pt::Statement::VariableDefinition(loc!(), pt::VariableDeclaration {
loc: loc!(),
Expand Down

0 comments on commit 90b3f70

Please sign in to comment.