diff --git a/tooling/nargo_fmt/src/visitor/expr.rs b/tooling/nargo_fmt/src/visitor/expr.rs index 433235e0017..5c85430ad0e 100644 --- a/tooling/nargo_fmt/src/visitor/expr.rs +++ b/tooling/nargo_fmt/src/visitor/expr.rs @@ -39,6 +39,7 @@ impl FmtVisitor<'_> { self.format_expr(infix.rhs) ) } + ExpressionKind::Variable(path) => path.to_string(), ExpressionKind::MemberAccess(member_access_expr) => { let lhs_str = self.format_expr(member_access_expr.lhs); format!("{}.{}", lhs_str, member_access_expr.rhs) diff --git a/tooling/nargo_fmt/tests/expected/variable.nr b/tooling/nargo_fmt/tests/expected/variable.nr new file mode 100644 index 00000000000..4684e4b199c --- /dev/null +++ b/tooling/nargo_fmt/tests/expected/variable.nr @@ -0,0 +1,3 @@ +fn main() { + let value = some::module::Struct::field; +} diff --git a/tooling/nargo_fmt/tests/input/variable.nr b/tooling/nargo_fmt/tests/input/variable.nr new file mode 100644 index 00000000000..4684e4b199c --- /dev/null +++ b/tooling/nargo_fmt/tests/input/variable.nr @@ -0,0 +1,3 @@ +fn main() { + let value = some::module::Struct::field; +}