ormolu 0.6.0.0 → 0.6.0.1
raw patch · 5 files changed
+26/−17 lines, 5 filesdep ~ansi-terminaldep ~optparse-applicativePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: ansi-terminal, optparse-applicative
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- data/examples/declaration/data/gadt/unicode-out.hs +4/−0
- data/examples/declaration/data/gadt/unicode.hs +4/−0
- ormolu.cabal +1/−1
- src/Ormolu/Diff/ParseResult.hs +12/−16
CHANGELOG.md view
@@ -1,3 +1,8 @@+## Ormolu 0.6.0.1++* Fix false positives in AST diffing related to `UnicodeSyntax`. [PR+ 1009](https://github.com/tweag/ormolu/pull/1009).+ ## Ormolu 0.6.0.0 * Haddocks attached to arguments of a data constructor are now formatted in
+ data/examples/declaration/data/gadt/unicode-out.hs view
@@ -0,0 +1,4 @@+{-# LANGUAGE UnicodeSyntax #-}++data Foo :: Type -> Type where+ Foo :: a -> Foo a
+ data/examples/declaration/data/gadt/unicode.hs view
@@ -0,0 +1,4 @@+{-# LANGUAGE UnicodeSyntax #-}++data Foo ∷ Type → Type where+ Foo ∷ a → Foo a
ormolu.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: ormolu-version: 0.6.0.0+version: 0.6.0.1 license: BSD-3-Clause license-file: LICENSE.md maintainer: Mark Karpov <mark.karpov@tweag.io>
src/Ormolu/Diff/ParseResult.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeepSubsumption #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ViewPatterns #-}@@ -51,7 +52,7 @@ prParsedSource = hs1 } = diffCommentStream cstream0 cstream1- <> matchIgnoringSrcSpans hs0 hs1+ <> diffHsModule hs0 hs1 diffCommentStream :: CommentStream -> CommentStream -> ParseResultDiff diffCommentStream (CommentStream cs) (CommentStream cs')@@ -60,18 +61,18 @@ where commentLines = concatMap (toList . unComment . unLoc) --- | Compare two values for equality disregarding the following aspects:+-- | Compare two modules for equality disregarding the following aspects: -- -- * 'SrcSpan's -- * ordering of import lists--- * style (ASCII vs Unicode) of arrows+-- * style (ASCII vs Unicode) of arrows, colons -- * LayoutInfo (brace style) in extension fields -- * Empty contexts in type classes -- * Parens around derived type classes--- * 'TokenLocation' (in 'LHsUniToken')+-- * 'TokenLocation' (in 'LHsToken'/'LHsUniToken') -- * 'EpaLocation'-matchIgnoringSrcSpans :: (Data a) => a -> a -> ParseResultDiff-matchIgnoringSrcSpans a = genericQuery a+diffHsModule :: HsModule GhcPs -> HsModule GhcPs -> ParseResultDiff+diffHsModule = genericQuery where genericQuery :: GenericQ (GenericQ ParseResultDiff) genericQuery x y@@ -92,14 +93,17 @@ `extQ` considerEqual @SourceText `extQ` hsDocStringEq `extQ` importDeclQualifiedStyleEq- `extQ` unicodeArrowStyleEq `extQ` considerEqual @(LayoutInfo GhcPs) `extQ` classDeclCtxEq `extQ` derivedTyClsParensEq `extQ` considerEqual @EpAnnComments -- ~ XCGRHSs GhcPs- `extQ` considerEqual @TokenLocation+ `extQ` considerEqual @TokenLocation -- in LHs(Uni)Token `extQ` considerEqual @EpaLocation `ext2Q` forLocated+ -- unicode-related+ `extQ` considerEqual @(HsUniToken "->" "→")+ `extQ` considerEqual @(HsUniToken "::" "∷")+ `extQ` considerEqual @(HsLinearArrowTokens GhcPs) ) x y@@ -147,14 +151,6 @@ else d UnhelpfulSpan _ -> d appendSpan _ d = d-- -- as we normalize arrow styles (e.g. -> vs →), we consider them equal here- unicodeArrowStyleEq = considerEqualVia @(HsArrow GhcPs) f- where- f (HsUnrestrictedArrow _) (HsUnrestrictedArrow _) = Same- f (HsLinearArrow _) (HsLinearArrow _) = Same- f (HsExplicitMult _ _ t) (HsExplicitMult _ _ t') = genericQuery t t'- f _ _ = Different [] classDeclCtxEq :: TyClDecl GhcPs -> GenericQ ParseResultDiff classDeclCtxEq ClassDecl {tcdCtxt = Just (L _ []), ..} tc' = genericQuery ClassDecl {tcdCtxt = Nothing, ..} tc'