Add failing test for template haskell splices #71

Closed
eborden wants to merge 1 commits from eborden/bug-top-level-template-haskell into dev
eborden commented 2017-11-29 00:50:06 +01:00 (Migrated from github.com)

For some reason brittany is failing to print exact for top level
splices. This may be an issue in brittany or ghc-exact-print, I'm
not sure. I've added failing tests to highlight this issue. This bug
causes brittany to produce syntactically invalid Haskell.

1) template haskell top level splice
      expected: Right
                {-# LANGUAGE TemplateHaskell #-}
                deriveFromJSON (unPrefix "assignPost") ''AssignmentPost

      but got: Right
                {-# LANGUAGE TemplateHaskell #-}
                deriveFromJSON (unPrefix "assignPost") ''

This test exposes https://github.com/lspitzner/brittany/issues/70

For some reason `brittany` is failing to print exact for top level splices. This may be an issue in `brittany` or `ghc-exact-print`, I'm not sure. I've added failing tests to highlight this issue. This bug causes `brittany` to produce syntactically invalid Haskell. ``` 1) template haskell top level splice expected: Right {-# LANGUAGE TemplateHaskell #-} deriveFromJSON (unPrefix "assignPost") ''AssignmentPost but got: Right {-# LANGUAGE TemplateHaskell #-} deriveFromJSON (unPrefix "assignPost") '' ``` This test exposes https://github.com/lspitzner/brittany/issues/70
eborden commented 2017-11-29 01:10:37 +01:00 (Migrated from github.com)

This should be getting processed via the wildcard of ppDecl.

  _         -> briDocMToPPM (briDocByExactNoComment d) >>= layoutBriDoc
This should be getting processed via the wildcard of `ppDecl`. ``` _ -> briDocMToPPM (briDocByExactNoComment d) >>= layoutBriDoc ```
lspitzner commented 2017-11-29 01:25:15 +01:00 (Migrated from github.com)

This should be getting processed via the wildcard of ppDecl.

correct

This might be similar to https://github.com/alanz/ghc-exactprint/issues/52. Maybe you could try the testing code from that issue? Although I am mildly certain already that this is not on brittany's end.
(of course this is another instance of "would be fixed by brittany properly just supporting TemplateHaskell/QuasiQuotation". probably a good bit of work though.)

> This should be getting processed via the wildcard of `ppDecl`. correct This might be similar to https://github.com/alanz/ghc-exactprint/issues/52. Maybe you could try the testing code from that issue? Although I am mildly certain already that this is not on brittany's end. (of course this is another instance of "would be fixed by brittany properly just supporting TemplateHaskell/QuasiQuotation". probably a good bit of work though.)
lspitzner commented 2017-12-08 20:05:18 +01:00 (Migrated from github.com)

I added a regression test as part of the fix for #70. (This did not merge anyways.)

I added a regression test as part of the fix for #70. (This did not merge anyways.)

Pull request closed

Sign in to join this conversation.
There is no content yet.