From 0dc8b07b59e0063c91371f098a17c8bc0d117f0a Mon Sep 17 00:00:00 2001 From: mertcandav Date: Sun, 24 Mar 2024 21:21:27 +0300 Subject: [PATCH] julefmt: fix newline detection for structure literals --- src/format.jule | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/format.jule b/src/format.jule index 30d81b9..f7b65a1 100644 --- a/src/format.jule +++ b/src/format.jule @@ -1165,9 +1165,10 @@ impl ExprFormatter { ret } let mut newline = false - let row = lit.exprs[0].token.row - for _, expr in lit.exprs[1:] { - if expr.token.row != row { + for _, expr in lit.exprs { + // Compare with kind row. Because kind and brace should be same line. + // Therefore, kind row also means brace row. + if expr.token.row != lit.kind.token.row { newline = true break }