Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pretty-show 1.10 fails haskell-src-exts' test suite #45

Open
felixonmars opened this issue Feb 22, 2020 · 1 comment
Open

pretty-show 1.10 fails haskell-src-exts' test suite #45

felixonmars opened this issue Feb 22, 2020 · 1 comment

Comments

@felixonmars
Copy link
Contributor

4 out of the 5 test failures in the recent haskell-src-exts issue haskell-suite/haskell-src-exts#448 seems to be new pretty-show not willing to prettify the result.

One of the examples is:

--- /build/haskell-src-exts/src/haskell-src-exts-1.21.1/tests/examples/Nounpack2.hs.parser.golden        2020-02-22 10:31:04.000000000 +0100
+++ /build/haskell-src-exts/src/haskell-src-exts-1.21.1/tests/examples/Nounpack2.hs.parser.out   2020-02-22 10:34:16.040731529 +0100
@@ -1,96 +1 @@
-ParseOk
-  ( Module
-      SrcSpanInfo
-        { srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 1 4 1
-        , srcInfoPoints =
-            [ SrcSpan "tests/examples/Nounpack2.hs" 3 1 3 1
-            , SrcSpan "tests/examples/Nounpack2.hs" 3 1 3 1
-            , SrcSpan "tests/examples/Nounpack2.hs" 3 1 3 1
-            , SrcSpan "tests/examples/Nounpack2.hs" 4 1 4 1
-            , SrcSpan "tests/examples/Nounpack2.hs" 4 1 4 1
-            ]
-        }
-      Nothing
-      []
-      []
-      [ DataDecl
-          SrcSpanInfo
-            { srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 1 3 36
-            , srcInfoPoints =
-                [ SrcSpan "tests/examples/Nounpack2.hs" 3 10 3 11 ]
-            }
-          (DataType
-             SrcSpanInfo
-               { srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 1 3 5
-               , srcInfoPoints = []
-               })
-          Nothing
-          (DHead
-             SrcSpanInfo
-               { srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 6 3 9
-               , srcInfoPoints = []
-               }
-             (Ident
-                SrcSpanInfo
-                  { srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 6 3 9
-                  , srcInfoPoints = []
-                  }
-                "Foo"))
-          [ QualConDecl
-              SrcSpanInfo
-                { srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 12 3 36
-                , srcInfoPoints = []
-                }
-              Nothing
-              Nothing
-              (ConDecl
-                 SrcSpanInfo
-                   { srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 12 3 36
-                   , srcInfoPoints = []
-                   }
-                 (Ident
-                    SrcSpanInfo
-                      { srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 12 3 15
-                      , srcInfoPoints = []
-                      }
-                    "Foo")
-                 [ TyBang
-                     SrcSpanInfo
-                       { srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 16 3 36
-                       , srcInfoPoints = []
-                       }
-                     (NoStrictAnnot
-                        SrcSpanInfo
-                          { srcInfoSpan = SrcSpan "" (-1) (-1) (-1) (-1)
-                          , srcInfoPoints = []
-                          })
-                     (NoUnpack
-                        SrcSpanInfo
-                          { srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 16 3 32
-                          , srcInfoPoints =
-                              [ SrcSpan "tests/examples/Nounpack2.hs" 3 16 3 28
-                              , SrcSpan "tests/examples/Nounpack2.hs" 3 29 3 32
-                              ]
-                          })
-                     (TyCon
-                        SrcSpanInfo
-                          { srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 33 3 36
-                          , srcInfoPoints = []
-                          }
-                        (UnQual
-                           SrcSpanInfo
-                             { srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 33 3 36
-                             , srcInfoPoints = []
-                             }
-                           (Ident
-                              SrcSpanInfo
-                                { srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 33 3 36
-                                , srcInfoPoints = []
-                                }
-                              "Int")))
-                 ])
-          ]
-          []
-      ]
-  , []
-  )
+ParseOk (Module (SrcSpanInfo {srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 1 4 1, srcInfoPoints = [SrcSpan "tests/examples/Nounpack2.hs" 3 1 3 1,SrcSpan "tests/examples/Nounpack2.hs" 3 1 3 1,SrcSpan "tests/examples/Nounpack2.hs" 3 1 3 1,SrcSpan "tests/examples/Nounpack2.hs" 4 1 4 1,SrcSpan "tests/examples/Nounpack2.hs" 4 1 4 1]}) Nothing [] [] [DataDecl (SrcSpanInfo {srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 1 3 36, srcInfoPoints = [SrcSpan "tests/examples/Nounpack2.hs" 3 10 3 11]}) (DataType (SrcSpanInfo {srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 1 3 5, srcInfoPoints = []})) Nothing (DHead (SrcSpanInfo {srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 6 3 9, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 6 3 9, srcInfoPoints = []}) "Foo")) [QualConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 12 3 36, srcInfoPoints = []}) Nothing Nothing (ConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 12 3 36, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 12 3 15, srcInfoPoints = []}) "Foo") [TyBang (SrcSpanInfo {srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 16 3 36, srcInfoPoints = []}) (NoStrictAnnot (SrcSpanInfo {srcInfoSpan = SrcSpan "" -1 -1 -1 -1, srcInfoPoints = []})) (NoUnpack (SrcSpanInfo {srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 16 3 32, srcInfoPoints = [SrcSpan "tests/examples/Nounpack2.hs" 3 16 3 28,SrcSpan "tests/examples/Nounpack2.hs" 3 29 3 32]})) (TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 33 3 36, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 33 3 36, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan "tests/examples/Nounpack2.hs" 3 33 3 36, srcInfoPoints = []}) "Int")))])] []],[])

This used to work fine in pretty-show 1.9.5.

@yav
Copy link
Owner

yav commented Feb 22, 2020

Thanks, I see what happened there and I'll fix it soon.

The issue is the handling of negative literals: your Show instance for SrcSpan does not put parens around negative numbers (which means that Read won't work, so you may want to fix this).

pretty-show used to accept these, but I seem to have changed it the last time I tried to add
ad-hoc support for dealing with times. I think I should be able to reintroduce it though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants