Skip to content

Commit

Permalink
Put end on separate line when pretty printing definitions (#2100)
Browse files Browse the repository at this point in the history
```diff
 def intersperse
   = \n. \f2. \f1.
-  if (n > 0) {f1; if (n > 1) {f2} {}; intersperse (n - 1) f2 f1} {} end
+  if (n > 0) {f1; if (n > 1) {f2} {}; intersperse (n - 1) f2 f1} {}
+ end
```

You can test it with:
```sh
swarm format -i data/scenarios/Challenges/_arbitrage/solution.sw
```

* caused by #1928 where def was made more similar to let
  • Loading branch information
xsebek authored Aug 9, 2024
1 parent f82a544 commit 6d1027c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/swarm-lang/Swarm/Language/Pretty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ instance PrettyPrec (Term' ty) where
]
SLet LSDef _ (LV _ x) mty _ t1 t2 ->
mconcat $
prettyDefinition "def" x mty t1 <+> "end"
sep [prettyDefinition "def" x mty t1, "end"]
: case t2 of
Syntax' _ (TConst Noop) _ _ -> []
_ -> [hardline, hardline, ppr t2]
Expand Down

0 comments on commit 6d1027c

Please sign in to comment.