From ff67c79ee742024ca0ef41a9a7e540e1662d46bd Mon Sep 17 00:00:00 2001 From: Alan Zimmerman Date: Fri, 1 Jul 2022 12:52:29 +0100 Subject: 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 --- compiler/GHC/ThToHs.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'compiler/GHC/ThToHs.hs') 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: -- cgit v1.2.1