Admin message

Due to a large amount of spam we do not allow new users to create repositories, they are "external" users. If you are a new user and want to create a repository, for example for forking GHC, open a new issue on ghc/ghc using the "get-verified" issue template

More incorrect Template Haskell parenthesization
The latest installment of "RyanGlScott finds bugs in Template Haskell pretty-printing". Here is what's featured on today's episode: ```hs {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -ddump-splices #-} module Bug where import Data.Functor.Identity import Language.Haskell.TH $([d| f = \(Identity x) -> x |]) $([d| g = $(pure $ VarE '(+) `AppE` LitE (IntegerL (-1)) `AppE` (LitE (IntegerL (-1)))) |]) ``` Running this with GHC 8.2 or later yields some incorrectly parenthesized output: ``` $ /opt/ghc/8.2.2/bin/ghc Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) Bug.hs:8:3-31: Splicing declarations [d| f_azO = \ (Identity x_azP) -> x_azP |] ======> f_a3Nx = \ Identity x_a3Ny -> x_a3Ny Bug.hs:9:3-90: Splicing declarations [d| g_a3NU = $(pure $ VarE '(+) `AppE` LitE (IntegerL (- 1)) `AppE` (LitE (IntegerL (- 1)))) |] pending(rn) [<splice_a3NV, pure $ VarE '(+) `AppE` LitE (IntegerL (- 1)) `AppE` (LitE (IntegerL (- 1)))>] ======> g_a4dU = ((+) -1) -1 ``` In particular, look at these two lines: ``` f_a3Nx = \ Identity x_a3Ny -> x_a3Ny g_a4dU = ((+) -1) -1 ``` These should be: ``` f_a3Nx = \ (Identity x_a3Ny) -> x_a3Ny g_a4dU = ((+) (-1)) (-1) ``` <details><summary>Trac metadata</summary> | Trac field | Value | | ---------------------- | ---------------- | | Version | 8.2.2 | | Type | Bug | | TypeOfFailure | OtherFailure | | Priority | normal | | Resolution | Unresolved | | Component | Template Haskell | | Test case | | | Differential revisions | | | BlockedBy | | | Related | | | Blocking | | | CC | | | Operating system | | | Architecture | | </details> <!-- {"blocked_by":[],"summary":"More incorrect Template Haskell parenthesization","status":"New","operating_system":"","component":"Template Haskell","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The latest installment of \"RyanGlScott finds bugs in Template Haskell pretty-printing\". Here is what's featured on today's episode:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE TemplateHaskell #-}\r\n{-# OPTIONS_GHC -ddump-splices #-}\r\nmodule Bug where\r\n\r\nimport Data.Functor.Identity\r\nimport Language.Haskell.TH\r\n\r\n$([d| f = \\(Identity x) -> x |])\r\n$([d| g = $(pure $ VarE '(+) `AppE` LitE (IntegerL (-1)) `AppE` (LitE (IntegerL (-1)))) |])\r\n}}}\r\n\r\nRunning this with GHC 8.2 or later yields some incorrectly parenthesized output:\r\n\r\n{{{\r\n$ /opt/ghc/8.2.2/bin/ghc Bug.hs\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\nBug.hs:8:3-31: Splicing declarations\r\n [d| f_azO = \\ (Identity x_azP) -> x_azP |]\r\n ======>\r\n f_a3Nx = \\ Identity x_a3Ny -> x_a3Ny\r\nBug.hs:9:3-90: Splicing declarations\r\n [d| g_a3NU\r\n = $(pure\r\n $ VarE '(+) `AppE` LitE (IntegerL (- 1))\r\n `AppE` (LitE (IntegerL (- 1)))) |]\r\n pending(rn) [<splice_a3NV, pure\r\n $ VarE '(+) `AppE` LitE (IntegerL (- 1))\r\n `AppE` (LitE (IntegerL (- 1)))>]\r\n ======>\r\n g_a4dU = ((+) -1) -1\r\n}}}\r\n\r\nIn particular, look at these two lines:\r\n\r\n{{{\r\nf_a3Nx = \\ Identity x_a3Ny -> x_a3Ny\r\ng_a4dU = ((+) -1) -1\r\n}}}\r\n\r\nThese should be:\r\n\r\n{{{\r\nf_a3Nx = \\ (Identity x_a3Ny) -> x_a3Ny\r\ng_a4dU = ((+) (-1)) (-1)\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->
issue