diff --git a/src/Nixfmt/Pretty.hs b/src/Nixfmt/Pretty.hs index bd4fd480..d9e79cf8 100644 --- a/src/Nixfmt/Pretty.hs +++ b/src/Nixfmt/Pretty.hs @@ -269,11 +269,11 @@ moveParamsComments -- # comment -- , name2 ( (ParamAttr name maybeDefault (Just (Ann trivia comma Nothing))) - : (ParamAttr (Ann trivia' name' Nothing) maybeDefault' maybeComma') + : (ParamAttr (Ann trivia' name' trailing') maybeDefault' maybeComma') : xs ) = ParamAttr name maybeDefault (Just (Ann [] comma Nothing)) - : moveParamsComments (ParamAttr (Ann (trivia ++ trivia') name' Nothing) maybeDefault' maybeComma' : xs) + : moveParamsComments (ParamAttr (Ann (trivia ++ trivia') name' trailing') maybeDefault' maybeComma' : xs) -- This may seem like a nonsensical case, but keep in mind that blank lines also count as comments (trivia) moveParamsComments -- , name diff --git a/test/diff/regression-218/in.nix b/test/diff/regression-218/in.nix new file mode 100644 index 00000000..29ccb81a --- /dev/null +++ b/test/diff/regression-218/in.nix @@ -0,0 +1,6 @@ +{ + foo + # bar + , baz # qux +}: +null diff --git a/test/diff/regression-218/out.nix b/test/diff/regression-218/out.nix new file mode 100644 index 00000000..001d48e5 --- /dev/null +++ b/test/diff/regression-218/out.nix @@ -0,0 +1,6 @@ +{ + foo, + # bar + baz, # qux +}: +null