summaryrefslogtreecommitdiff
path: root/compiler/GHC/ThToHs.hs
diff options
context:
space:
mode:
authorAlan Zimmerman <alan.zimm@gmail.com>2022-07-01 12:52:29 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-08-11 16:19:57 -0400
commitff67c79ee742024ca0ef41a9a7e540e1662d46bd (patch)
tree6588e16a80e86696f7541c483a724903b82ad492 /compiler/GHC/ThToHs.hs
parent5c24b1b3a9d6a4c2f471fd7d8ec65141a8b46357 (diff)
downloadhaskell-ff67c79ee742024ca0ef41a9a7e540e1662d46bd.tar.gz
EPA: DotFieldOcc does not have exact print annotations
For the code {-# LANGUAGE OverloadedRecordUpdate #-} operatorUpdate f = f{(+) = 1} There are no exact print annotations for the parens around the + symbol, nor does normal ppr print them. This MR fixes that. Closes #21805 Updates haddock submodule
Diffstat (limited to 'compiler/GHC/ThToHs.hs')
-rw-r--r--compiler/GHC/ThToHs.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/GHC/ThToHs.hs b/compiler/GHC/ThToHs.hs
index 8d795d7fe2..5ba99fe7ac 100644
--- a/compiler/GHC/ThToHs.hs
+++ b/compiler/GHC/ThToHs.hs
@@ -55,6 +55,8 @@ import GHC.Data.FastString
import GHC.Utils.Outputable as Outputable
import GHC.Utils.Panic
+import Language.Haskell.Syntax.Basic (FieldLabelString(..))
+
import qualified Data.ByteString as BS
import Control.Monad( unless, ap )
import Control.Applicative( (<|>) )
@@ -1106,8 +1108,10 @@ cvtl e = wrapLA (cvt e)
cvt (LabelE s) = return $ HsOverLabel noComments (fsLit s)
cvt (ImplicitParamVarE n) = do { n' <- ipName n; return $ HsIPVar noComments n' }
cvt (GetFieldE exp f) = do { e' <- cvtl exp
- ; return $ HsGetField noComments e' (L noSrcSpanA (DotFieldOcc noAnn (L noSrcSpanA (fsLit f)))) }
- cvt (ProjectionE xs) = return $ HsProjection noAnn $ fmap (L noSrcSpanA . DotFieldOcc noAnn . L noSrcSpanA . fsLit) xs
+ ; return $ HsGetField noComments e'
+ (L noSrcSpanA (DotFieldOcc noAnn (L noSrcSpanA (FieldLabelString (fsLit f))))) }
+ cvt (ProjectionE xs) = return $ HsProjection noAnn $ fmap
+ (L noSrcSpanA . DotFieldOcc noAnn . L noSrcSpanA . FieldLabelString . fsLit) xs
{- | #16895 Ensure an infix expression's operator is a variable/constructor.
Consider this example: