Skip to content

Commit

Permalink
Assert: always force-expand
Browse files Browse the repository at this point in the history
  • Loading branch information
piegamesde committed Jan 15, 2024
1 parent a50996f commit 690c7ba
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Nixfmt/Pretty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ absorbRHS expr = case expr of
(Term t) | isAbsorbable t -> hardspace <> prettyTermWide t
-- Parenthesized expression. Same thing as the special case for parenthesized last argument in function calls.
(Term (Parenthesized open expr' close)) ->
group' True $ nest 2 $ base $
group' True $ nest 2 $ base $
hardspace <> pretty open
<> (surroundWith line' . group . nest 2 . base) expr'
<> pretty close
Expand Down
15 changes: 12 additions & 3 deletions test/diff/assert/out.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[
(assert b; e)
(
assert b;
e
)
(
assert b; # d
e
Expand Down Expand Up @@ -36,6 +39,12 @@
; # d
e
)
(assert b; cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc)
(assert b; cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc)
(
assert b;
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
)
(
assert b;
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
)
]
8 changes: 6 additions & 2 deletions test/diff/idioms_lib_4/out.nix
Original file line number Diff line number Diff line change
Expand Up @@ -837,10 +837,14 @@ rec {
cpu,
# Optional, but fallback too complex for here.
# Inferred below instead.
vendor ? assert false; null,
vendor ?
assert false;
null,
kernel,
# Also inferred below
abi ? assert false; null,
abi ?
assert false;
null,
}@args:
let
getCpu = name: cpuTypes.${name} or (throw "Unknown CPU type: ${name}");
Expand Down

0 comments on commit 690c7ba

Please sign in to comment.