Commit Graph

827 Commits (29000c990c82a8b4b904c05919f7e7ed96f27918)

Author SHA1 Message Date
Phil Hazelden 29000c990c Support promoted type applications.
Closes #370.

Up to GHC 8.10,

    foo @ 'Bar

was a valid type application. In GHC 9 it's not, which means brittany
needs to allow

    foo @'Bar

which it now does.

The reason the space was needed was to allow a promoted type variable at
the head of a type-level list. That is,

    '['Foo]

is invalid syntax, because it initially parses as the character `'['`.
So the promoted type variable was always given a separator at the
beginning, and we'd get

    '[ 'Foo]

which was valid. Now we handle this case by specifically examining the
head of a type-level list; if it's promoted we introduce spaces, so

    '[ 'Foo ]
    '[Foo]

I've added tests for this and some related cases. In doing so I noticed
that unnecessary spaces get added in front of commas in these lists; I
believe that's a separate bug, and I've written a comment explaining why
it happens, but I haven't tried to fix it.

I'm not sure when the first alternates in the `FirstLastSingleton`
and `FirstLast` branches would ever be hit, so I'm not entirely sure if
the separators are necessary there. But since `docSeparator` disappears
at the end of a line and merges with adjacent separators, they should be
harmless.
2023-04-24 15:47:42 +00:00
Lennart Spitzner ea550b401a Respect newlines after block-comments 2023-04-24 15:45:28 +00:00
Lennart Spitzner a3083729af Refactor WriteBriDoc FlushCommentsPrior code slightly 2023-04-24 15:45:28 +00:00
Lennart Spitzner e04b90e4c8 Fixup misspelled data-type name 2023-04-24 15:45:28 +00:00
Lennart Spitzner 084125eed3 Allow par-spacing for single-operator 1+n-line layout plus Tweak of OpApp 2023-04-22 19:54:24 +00:00
Lennart Spitzner 396c23191c Discard special case for non-nested OpApp 2023-04-22 19:54:24 +00:00
Lennart Spitzner 89092d994c Minor comment updates and cleanup 2023-04-22 19:54:24 +00:00
Lennart Spitzner 05e00f39f2 Simplify/Optimize Decl:layoutPatternBindFinal 2023-04-22 19:54:24 +00:00
Lennart Spitzner b1e85de95d setParSpacing for operator-expression ending in par 2023-04-22 19:54:24 +00:00
Lennart Spitzner 99dc88e2f9 Improve one HsLet layout
- Allow parSpacing for single-clause layout
- Allow par/sl layout when no where-clause was present
  (not sure why this was disabled in the first place)
2023-04-22 19:54:24 +00:00
Lennart Spitzner f18fd0c4ba Dont flatten operators without surrounding parens 2023-04-22 19:54:24 +00:00
Lennart Spitzner e9f66b3fd8 Fix comment-after-context 2023-04-22 19:54:24 +00:00
Lennart Spitzner a6ed006427 Fix restore-position after block comment 2023-04-22 19:54:24 +00:00
Lennart Spitzner f2e0044c4a Fix comments moving after "where" 2023-04-22 19:54:24 +00:00
Lennart Spitzner bad95f3670 Use dependency-injection for ToBriDoc modules
I assume this makes inlining impossible, but it enables
parallel compilation of all these modules. In my tests
this reduce wall clock time to 92%, and with more cores
the benefit should be higher.
2023-04-22 19:54:24 +00:00
Lennart Spitzner 5e1452a5f0 Fix retain comments on matches (lambda rhs etc.) 2023-04-22 19:54:24 +00:00
Lennart Spitzner 0c660e272d Refactor s/rec/go for extension compat 2023-04-22 19:54:24 +00:00
Lennart Spitzner 6a1edb38f9 Fix BDLines getSpacing computation 2023-04-22 19:54:24 +00:00
Lennart Spitzner 9b5fb89c2b Do not count warnings for considering exactprint fallback 2023-04-22 19:54:24 +00:00
Lennart Spitzner 7d4d6e77f7 Fixup annotation on error-fallback 2023-04-22 19:54:24 +00:00
Lennart Spitzner 73656eeff6 Implement fixity-aware-ops feature 2023-04-22 19:54:24 +00:00
Lennart Spitzner 4ea66b0e45 Fix double-printing of comments on certain data-decls 2023-04-22 19:54:24 +00:00
Lennart Spitzner cbfa0d6d22 Partially restore retaining-empty-lines behaviour
Currently works for do blocks, multi-line list literals, and
lambda-case cases (apart from top-level blank lines that
never got ignored).
2023-04-22 19:54:24 +00:00
Lennart Spitzner dafaa8cab8 Improve block-comment behaviour (newlines after or not) 2023-04-22 19:54:24 +00:00
Lennart Spitzner 5693be1be0 Make if-then-layout layout more consistent 2023-04-22 19:54:24 +00:00
Lennart Spitzner e92580429a Fix missing comment for MG 2023-04-22 19:54:24 +00:00
Lennart Spitzner 6f380f2be6 Change behaviour: Less par-spacing for function application 2023-04-22 19:54:24 +00:00
Lennart Spitzner 67a6ab8209 Behaviour addition: Allow par-spacing on HsApp 2023-04-22 19:54:24 +00:00
Lennart Spitzner c58bf7b845 Implement extension support - OverloadedRecordDot 2023-04-22 19:54:24 +00:00
Lennart Spitzner 278dcfc7c6 Fix block-comment delta position special case 2023-04-22 19:54:24 +00:00
Lennart Spitzner 7f5dc46798 Replace BriDoc+BriDocF with single BriDocW + type family 2023-04-22 19:54:24 +00:00
Lennart Spitzner 7db1028223 Reintroduce BDAnnotationKW in the form of BDEntryDelta 2023-04-22 19:54:24 +00:00
Lennart Spitzner 9034a2f59d Clean up WriteBriDoc monad state handling 2023-04-22 19:54:24 +00:00
Lennart Spitzner cca049b100 Clean up unused WriteBriDoc operators 2023-04-22 19:54:24 +00:00
Lennart Spitzner 7ebd61db3d Refactor+Rewrite+Adaptation for ghc-9.2 support 2023-04-22 19:54:24 +00:00
Lennart Spitzner 8d0bf2faf8 Ignore missing kind signatures and unused imports for now 2023-04-22 19:54:24 +00:00
Lennart Spitzner 2ebefa9ad6 Unhide warning 2023-04-22 19:54:24 +00:00
Lennart Spitzner bb97412d69 Pass ghc -fhide-source-paths by default 2023-04-22 19:54:24 +00:00
Lennart Spitzner f7de67892b Support and use nested file structure for tests 2023-04-22 19:54:24 +00:00
Lennart Spitzner dd8264797e Revert "Split tests into individual files"
This reverts commit 21e86adf6e.
2023-04-22 19:54:24 +00:00
Lennart Spitzner d4896d2234 Revert "Run tests in serial"
This reverts commit cddb98b124.
2023-04-22 19:54:24 +00:00
Lennart Spitzner eabf4e9d45 Revert "Simplify test suite"
This reverts commit 8f2625dc87.
2023-04-22 19:54:24 +00:00
Lennart Spitzner 5806dfc208 Add seaaye stuff 2023-04-22 19:54:24 +00:00
Lennart Spitzner dc008800e7 Switch to butcher-2.0 2023-04-22 19:54:24 +00:00
Taylor Fausak e03ab8425b
Merge pull request #377 from lspitzner/tfausak-patch-1
Announce end of maintenance
2022-11-11 12:13:28 -06:00
Taylor Fausak 420eac889e
Announce end of maintenance 2022-11-11 09:52:57 -06:00
Taylor Fausak 0aa04af4eb
Version 0.14.0.2 2022-01-13 09:28:26 -05:00
Taylor Fausak 93a43bf28d Revert "Remove `Language.Haskell.` from module names"
This reverts commit 2fe1432631.
2022-01-13 14:16:14 +00:00
Taylor Fausak 29814f919e
Version 0.14.0.1 2022-01-11 08:49:47 -05:00
Taylor Fausak 97da38fab7 Merge remote-tracking branch 'upstream/master' into main 2022-01-11 13:48:58 +00:00