ormolu 0.0.3.0 → 0.0.3.1
raw patch · 6 files changed
+37/−9 lines, 6 filesdep ~ghc-lib-parserdep ~optparse-applicativedep ~pathPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: ghc-lib-parser, optparse-applicative, path
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- data/examples/declaration/value/function/record-dot-out.hs +8/−0
- data/examples/declaration/value/function/record-dot.hs +8/−0
- ormolu.cabal +5/−5
- src/Ormolu/Printer/Meat/Declaration/Value.hs +8/−1
- tests/Ormolu/PrinterSpec.hs +3/−3
CHANGELOG.md view
@@ -1,3 +1,8 @@+## Ormolu 0.0.3.1++* Fixed rendering of record updates with the record dot preprocessor syntax+ [Issue 498](https://github.com/tweag/ormolu/issues/498).+ ## Ormolu 0.0.3.0 * Fixed an issue related to unnecessary use of curly braces. [Issue
data/examples/declaration/value/function/record-dot-out.hs view
@@ -5,3 +5,11 @@ mfoo = fmap (.bar) $ Nothing bar = (Foo 1).bar++fooplus f n = f{foo = f.bar + n}++fooplus' f n = f {foo = f.bar + n}++fooplus'' f n = f {foo = f.bar + n}++fooplus''' f n = f {foo = f.bar + n}
data/examples/declaration/value/function/record-dot.hs view
@@ -4,3 +4,11 @@ mfoo = fmap (.bar) $ Nothing bar = ( Foo 1).bar++fooplus f n = f{foo = f.bar + n}++fooplus' f n = f { foo = f.bar + n}++fooplus'' f n = f {foo = f.bar + n}++fooplus''' f n = f{ foo = f.bar + n}
ormolu.cabal view
@@ -1,5 +1,5 @@ name: ormolu-version: 0.0.3.0+version: 0.0.3.1 cabal-version: 1.18 tested-with: GHC==8.6.5 license: BSD3@@ -68,7 +68,7 @@ , containers >= 0.5 && < 0.7 , dlist >= 0.8 && < 0.9 , exceptions >= 0.6 && < 0.11- , ghc-lib-parser >= 8.8.1 && < 8.8.2+ , ghc-lib-parser >= 8.8.1 && < 8.8.3 , mtl >= 2.0 && < 3.0 , syb >= 0.7 && < 0.8 , text >= 0.2 && < 1.3@@ -132,7 +132,7 @@ , filepath >= 1.2 && < 1.5 , hspec >= 2.0 && < 3.0 , ormolu- , path >= 0.6 && < 0.7+ , path >= 0.6 && < 0.8 , path-io >= 1.4.2 && < 2.0 , text >= 0.2 && < 1.3 build-tools: hspec-discover >= 2.0 && < 3.0@@ -150,9 +150,9 @@ main-is: Main.hs hs-source-dirs: app build-depends: base >= 4.12 && < 5.0- , ghc-lib-parser >= 8.8.1 && < 8.8.2+ , ghc-lib-parser >= 8.8.1 && < 8.8.3 , gitrev >= 1.3 && < 1.4- , optparse-applicative >= 0.14 && < 0.15+ , optparse-applicative >= 0.14 && < 0.16 , ormolu , text >= 0.2 && < 1.3 other-modules: Paths_ormolu
src/Ormolu/Printer/Meat/Declaration/Value.hs view
@@ -699,7 +699,14 @@ sep (comma >> breakpoint) sitcc (fields <> dotdot) RecordUpd {..} -> do located rupd_expr p_hsExpr- breakpoint+ useRecordDot' <- useRecordDot+ let mrs sp = case getLoc sp of+ RealSrcSpan r -> Just r+ _ -> Nothing+ let isPluginForm =+ ((1 +) . srcSpanEndCol <$> mrs rupd_expr)+ == (srcSpanStartCol <$> mrs (head rupd_flds))+ unless (useRecordDot' && isPluginForm) breakpoint let updName f = f { hsRecFieldLbl = case unLoc $ hsRecFieldLbl f of
tests/Ormolu/PrinterSpec.hs view
@@ -15,7 +15,7 @@ import Ormolu import Path import Path.IO-import System.FilePath (addExtension, dropExtensions, splitExtensions)+import qualified System.FilePath as F import Test.Hspec spec :: Spec@@ -53,14 +53,14 @@ isInput :: Path Rel File -> Bool isInput path = let s = fromRelFile path- (s', exts) = splitExtensions s+ (s', exts) = F.splitExtensions s in exts == ".hs" && not ("-out" `isSuffixOf` s') -- | For given path of input file return expected name of output. deriveOutput :: Path Rel File -> IO (Path Rel File) deriveOutput path = parseRelFile $- addExtension (dropExtensions (fromRelFile path) ++ "-out") "hs"+ F.addExtension (F.dropExtensions (fromRelFile path) ++ "-out") "hs" -- | A version of 'shouldBe' that is specialized to comparing 'Text' values. -- It also prints multi-line snippets in a more readable form.