From 86cf19a63f12049d95b89d3c006124eb373e3780 Mon Sep 17 00:00:00 2001 From: Troels Henriksen Date: Sun, 3 Nov 2024 11:36:03 +0100 Subject: [PATCH] futhark fmt: no linebreak before parens. --- src/Futhark/Fmt/Printer.hs | 8 ++++---- tests_fmt/expected/lambda.fut | 4 ++-- tests_fmt/lambda.fut | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Futhark/Fmt/Printer.hs b/src/Futhark/Fmt/Printer.hs index 0d8a10de5e..a1786c70ab 100644 --- a/src/Futhark/Fmt/Printer.hs +++ b/src/Futhark/Fmt/Printer.hs @@ -212,10 +212,10 @@ instance Format UncheckedExp where fmt (Var name _ loc) = addComments loc $ fmtQualName name fmt (Hole _ loc) = addComments loc "???" fmt (Parens e loc) = - addComments loc $ "(" <> stdNest (fmt e) <:/> ")" + addComments loc $ "(" <> stdNest (fmt e) <> ")" fmt (QualParens (v, _qLoc) e loc) = addComments loc $ - fmtQualName v <> "." <> "(" <> align (fmt e) <:/> ")" + fmtQualName v <> "." <> "(" <> align (fmt e) <> ")" fmt (Ascript e t loc) = addComments loc $ fmt e <> ":" <+> fmt t fmt (Coerce e t _ loc) = addComments loc $ fmt e <+> ":>" <+> fmt t fmt (Literal _v loc) = addComments loc $ fmtCopyLoc constantStyle loc @@ -482,7 +482,7 @@ typeWiths mte = (mte, []) instance Format UncheckedModTypeExp where fmt (ModTypeVar v _ loc) = addComments loc $ fmtPretty v fmt (ModTypeParens mte loc) = - addComments loc $ "(" <> align (fmt mte) <:/> ")" + addComments loc $ "(" <> align (fmt mte) <> ")" fmt (ModTypeSpecs sbs loc) = addComments loc $ "{" <:/> stdIndent (sepDecs fmt sbs) <:/> "}" fmt (ModTypeWith mte tr loc) = @@ -547,7 +547,7 @@ instance Format UncheckedModBind where instance Format UncheckedModExp where fmt (ModVar v loc) = addComments loc $ fmtQualName v fmt (ModParens f loc) = - addComments loc $ "(" <:/> stdIndent (fmt f) <:/> ")" + addComments loc $ "(" <:/> stdIndent (fmt f) <> ")" fmt (ModImport path _f loc) = addComments loc $ "import" <+> "\"" <> fmtPretty path <> "\"" fmt (ModDecs decs loc) = diff --git a/tests_fmt/expected/lambda.fut b/tests_fmt/expected/lambda.fut index 3b5b66d6c6..5e525e6df0 100644 --- a/tests_fmt/expected/lambda.fut +++ b/tests_fmt/expected/lambda.fut @@ -1,6 +1,6 @@ def f = - \x -> - x + 2 + (\x -> + x + 2) def r = { x = diff --git a/tests_fmt/lambda.fut b/tests_fmt/lambda.fut index 3b5b66d6c6..5e525e6df0 100644 --- a/tests_fmt/lambda.fut +++ b/tests_fmt/lambda.fut @@ -1,6 +1,6 @@ def f = - \x -> - x + 2 + (\x -> + x + 2) def r = { x =