summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/GHC/Hs/Decls.hs5
-rw-r--r--compiler/GHC/Parser/PostProcess.hs16
-rw-r--r--compiler/GHC/Rename/Module.hs2
-rw-r--r--compiler/GHC/ThToHs.hs8
-rw-r--r--testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr108
-rw-r--r--testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr18
-rw-r--r--testsuite/tests/parser/should_compile/DumpParsedAst.stderr20
-rw-r--r--testsuite/tests/parser/should_compile/DumpRenamedAst.stderr6
-rw-r--r--testsuite/tests/parser/should_compile/T14189.stderr2
-rw-r--r--testsuite/tests/parser/should_compile/T15323.stderr9
-rw-r--r--testsuite/tests/printer/Makefile4
-rw-r--r--testsuite/tests/printer/T18791.stderr10
-rw-r--r--testsuite/tests/printer/Test19834.hs4
-rw-r--r--testsuite/tests/printer/all.T2
-rw-r--r--utils/check-exact/ExactPrint.hs39
-rw-r--r--utils/check-exact/Main.hs3
m---------utils/haddock0
17 files changed, 112 insertions, 144 deletions
diff --git a/compiler/GHC/Hs/Decls.hs b/compiler/GHC/Hs/Decls.hs
index a4614bb220..1d59ae2308 100644
--- a/compiler/GHC/Hs/Decls.hs
+++ b/compiler/GHC/Hs/Decls.hs
@@ -329,7 +329,7 @@ type instance XSynDecl GhcPs = EpAnn [AddEpAnn]
type instance XSynDecl GhcRn = NameSet -- FVs
type instance XSynDecl GhcTc = NameSet -- FVs
-type instance XDataDecl GhcPs = EpAnn [AddEpAnn] -- AZ: used?
+type instance XDataDecl GhcPs = EpAnn [AddEpAnn]
type instance XDataDecl GhcRn = DataDeclRn
type instance XDataDecl GhcTc = DataDeclRn
@@ -568,7 +568,7 @@ instance OutputableBndrId p
* *
********************************************************************* -}
-type instance XCHsDataDefn (GhcPass _) = EpAnn [AddEpAnn]
+type instance XCHsDataDefn (GhcPass _) = NoExtField
type instance XXHsDataDefn (GhcPass _) = NoExtCon
type instance XCHsDerivingClause (GhcPass _) = EpAnn [AddEpAnn]
@@ -1184,4 +1184,3 @@ type instance Anno (WarnDecl (GhcPass p)) = SrcSpanAnnA
type instance Anno (AnnDecl (GhcPass p)) = SrcSpanAnnA
type instance Anno (RoleAnnotDecl (GhcPass p)) = SrcSpanAnnA
type instance Anno (Maybe Role) = SrcSpan
-
diff --git a/compiler/GHC/Parser/PostProcess.hs b/compiler/GHC/Parser/PostProcess.hs
index beeaeb9d9e..c6ad4db6d1 100644
--- a/compiler/GHC/Parser/PostProcess.hs
+++ b/compiler/GHC/Parser/PostProcess.hs
@@ -215,8 +215,8 @@ mkTyData loc' new_or_data cType (L _ (mcxt, tycl_hdr))
; (tyvars, anns) <- checkTyVars (ppr new_or_data) equalsDots tc tparams
; cs <- getCommentsFor (locA loc) -- Get any remaining comments
; let anns' = addAnns (EpAnn (spanAsAnchor $ locA loc) annsIn emptyComments) (ann ++ anns) cs
- ; defn <- mkDataDefn new_or_data cType mcxt ksig data_cons maybe_deriv anns'
- ; return (L loc (DataDecl { tcdDExt = anns', -- AZ: do we need these?
+ ; defn <- mkDataDefn new_or_data cType mcxt ksig data_cons maybe_deriv
+ ; return (L loc (DataDecl { tcdDExt = anns',
tcdLName = tc, tcdTyVars = tyvars,
tcdFixity = fixity,
tcdDataDefn = defn })) }
@@ -227,11 +227,10 @@ mkDataDefn :: NewOrData
-> Maybe (LHsKind GhcPs)
-> [LConDecl GhcPs]
-> HsDeriving GhcPs
- -> EpAnn [AddEpAnn]
-> P (HsDataDefn GhcPs)
-mkDataDefn new_or_data cType mcxt ksig data_cons maybe_deriv ann
+mkDataDefn new_or_data cType mcxt ksig data_cons maybe_deriv
= do { checkDatatypeContext mcxt
- ; return (HsDataDefn { dd_ext = ann
+ ; return (HsDataDefn { dd_ext = noExtField
, dd_ND = new_or_data, dd_cType = cType
, dd_ctxt = mcxt
, dd_cons = data_cons
@@ -309,12 +308,11 @@ mkDataFamInst :: SrcSpan
mkDataFamInst loc new_or_data cType (mcxt, bndrs, tycl_hdr)
ksig data_cons (L _ maybe_deriv) anns
= do { (tc, tparams, fixity, ann) <- checkTyClHdr False tycl_hdr
- ; -- AZ:TODO: deal with these comments
- ; cs <- getCommentsFor loc -- Add any API Annotations to the top SrcSpan [temp]
+ ; cs <- getCommentsFor loc -- Add any API Annotations to the top SrcSpan
; let anns' = addAnns (EpAnn (spanAsAnchor loc) ann cs) anns emptyComments
- ; defn <- mkDataDefn new_or_data cType mcxt ksig data_cons maybe_deriv anns'
+ ; defn <- mkDataDefn new_or_data cType mcxt ksig data_cons maybe_deriv
; return (L (noAnnSrcSpan loc) (DataFamInstD anns' (DataFamInstDecl
- (FamEqn { feqn_ext = noAnn -- AZ: get anns
+ (FamEqn { feqn_ext = anns'
, feqn_tycon = tc
, feqn_bndrs = bndrs
, feqn_pats = tparams
diff --git a/compiler/GHC/Rename/Module.hs b/compiler/GHC/Rename/Module.hs
index 2eb048f3f6..e91901ae50 100644
--- a/compiler/GHC/Rename/Module.hs
+++ b/compiler/GHC/Rename/Module.hs
@@ -1939,7 +1939,7 @@ rnDataDefn doc (HsDataDefn { dd_ND = new_or_data, dd_cType = cType
; let all_fvs = fvs1 `plusFV` fvs3 `plusFV`
con_fvs `plusFV` sig_fvs
- ; return ( HsDataDefn { dd_ext = noAnn
+ ; return ( HsDataDefn { dd_ext = noExtField
, dd_ND = new_or_data, dd_cType = cType
, dd_ctxt = context', dd_kindSig = m_sig'
, dd_cons = condecls'
diff --git a/compiler/GHC/ThToHs.hs b/compiler/GHC/ThToHs.hs
index b71e5afbd1..02b93c5803 100644
--- a/compiler/GHC/ThToHs.hs
+++ b/compiler/GHC/ThToHs.hs
@@ -253,7 +253,7 @@ cvtDec (DataD ctxt tc tvs ksig constrs derivs)
; ksig' <- cvtKind `traverse` ksig
; cons' <- mapM cvtConstr constrs
; derivs' <- cvtDerivs derivs
- ; let defn = HsDataDefn { dd_ext = noAnn
+ ; let defn = HsDataDefn { dd_ext = noExtField
, dd_ND = DataType, dd_cType = Nothing
, dd_ctxt = Just ctxt'
, dd_kindSig = ksig'
@@ -269,7 +269,7 @@ cvtDec (NewtypeD ctxt tc tvs ksig constr derivs)
; ksig' <- cvtKind `traverse` ksig
; con' <- cvtConstr constr
; derivs' <- cvtDerivs derivs
- ; let defn = HsDataDefn { dd_ext = noAnn
+ ; let defn = HsDataDefn { dd_ext = noExtField
, dd_ND = NewType, dd_cType = Nothing
, dd_ctxt = Just ctxt'
, dd_kindSig = ksig'
@@ -340,7 +340,7 @@ cvtDec (DataInstD ctxt bndrs tys ksig constrs derivs)
; ksig' <- cvtKind `traverse` ksig
; cons' <- mapM cvtConstr constrs
; derivs' <- cvtDerivs derivs
- ; let defn = HsDataDefn { dd_ext = noAnn
+ ; let defn = HsDataDefn { dd_ext = noExtField
, dd_ND = DataType, dd_cType = Nothing
, dd_ctxt = Just ctxt'
, dd_kindSig = ksig'
@@ -361,7 +361,7 @@ cvtDec (NewtypeInstD ctxt bndrs tys ksig constr derivs)
; ksig' <- cvtKind `traverse` ksig
; con' <- cvtConstr constr
; derivs' <- cvtDerivs derivs
- ; let defn = HsDataDefn { dd_ext = noAnn
+ ; let defn = HsDataDefn { dd_ext = noExtField
, dd_ND = NewType, dd_cType = Nothing
, dd_ctxt = Just ctxt'
, dd_kindSig = ksig'
diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr
index db88734005..622ba39adf 100644
--- a/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr
+++ b/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr
@@ -760,7 +760,14 @@
(SrcSpanAnn (EpAnnNotUsed) { T17544.hs:(24,3)-(25,18) })
(DataFamInstDecl
(FamEqn
- (EpAnnNotUsed)
+ (EpAnn
+ (Anchor
+ { T17544.hs:(24,3)-(25,18) }
+ (UnchangedAnchor))
+ [(AddEpAnn AnnData (EpaSpan { T17544.hs:24:3-6 }))
+ ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:24:15-19 }))]
+ (EpaComments
+ []))
(L
(SrcSpanAnn (EpAnnNotUsed) { T17544.hs:24:8-9 })
(Unqual
@@ -785,14 +792,7 @@
{OccName: Int})))))]
(Prefix)
(HsDataDefn
- (EpAnn
- (Anchor
- { T17544.hs:(24,3)-(25,18) }
- (UnchangedAnchor))
- [(AddEpAnn AnnData (EpaSpan { T17544.hs:24:3-6 }))
- ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:24:15-19 }))]
- (EpaComments
- []))
+ (NoExtField)
(DataType)
(Nothing)
(Nothing)
@@ -1020,7 +1020,14 @@
(SrcSpanAnn (EpAnnNotUsed) { T17544.hs:(30,3)-(31,18) })
(DataFamInstDecl
(FamEqn
- (EpAnnNotUsed)
+ (EpAnn
+ (Anchor
+ { T17544.hs:(30,3)-(31,18) }
+ (UnchangedAnchor))
+ [(AddEpAnn AnnData (EpaSpan { T17544.hs:30:3-6 }))
+ ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:30:15-19 }))]
+ (EpaComments
+ []))
(L
(SrcSpanAnn (EpAnnNotUsed) { T17544.hs:30:8-9 })
(Unqual
@@ -1045,14 +1052,7 @@
{OccName: Int})))))]
(Prefix)
(HsDataDefn
- (EpAnn
- (Anchor
- { T17544.hs:(30,3)-(31,18) }
- (UnchangedAnchor))
- [(AddEpAnn AnnData (EpaSpan { T17544.hs:30:3-6 }))
- ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:30:15-19 }))]
- (EpaComments
- []))
+ (NoExtField)
(DataType)
(Nothing)
(Nothing)
@@ -1280,7 +1280,14 @@
(SrcSpanAnn (EpAnnNotUsed) { T17544.hs:(36,3)-(37,18) })
(DataFamInstDecl
(FamEqn
- (EpAnnNotUsed)
+ (EpAnn
+ (Anchor
+ { T17544.hs:(36,3)-(37,18) }
+ (UnchangedAnchor))
+ [(AddEpAnn AnnData (EpaSpan { T17544.hs:36:3-6 }))
+ ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:36:15-19 }))]
+ (EpaComments
+ []))
(L
(SrcSpanAnn (EpAnnNotUsed) { T17544.hs:36:8-9 })
(Unqual
@@ -1305,14 +1312,7 @@
{OccName: Int})))))]
(Prefix)
(HsDataDefn
- (EpAnn
- (Anchor
- { T17544.hs:(36,3)-(37,18) }
- (UnchangedAnchor))
- [(AddEpAnn AnnData (EpaSpan { T17544.hs:36:3-6 }))
- ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:36:15-19 }))]
- (EpaComments
- []))
+ (NoExtField)
(DataType)
(Nothing)
(Nothing)
@@ -1540,7 +1540,14 @@
(SrcSpanAnn (EpAnnNotUsed) { T17544.hs:(42,3)-(43,18) })
(DataFamInstDecl
(FamEqn
- (EpAnnNotUsed)
+ (EpAnn
+ (Anchor
+ { T17544.hs:(42,3)-(43,18) }
+ (UnchangedAnchor))
+ [(AddEpAnn AnnData (EpaSpan { T17544.hs:42:3-6 }))
+ ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:42:15-19 }))]
+ (EpaComments
+ []))
(L
(SrcSpanAnn (EpAnnNotUsed) { T17544.hs:42:8-9 })
(Unqual
@@ -1565,14 +1572,7 @@
{OccName: Int})))))]
(Prefix)
(HsDataDefn
- (EpAnn
- (Anchor
- { T17544.hs:(42,3)-(43,18) }
- (UnchangedAnchor))
- [(AddEpAnn AnnData (EpaSpan { T17544.hs:42:3-6 }))
- ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:42:15-19 }))]
- (EpaComments
- []))
+ (NoExtField)
(DataType)
(Nothing)
(Nothing)
@@ -1800,7 +1800,14 @@
(SrcSpanAnn (EpAnnNotUsed) { T17544.hs:(48,3)-(49,18) })
(DataFamInstDecl
(FamEqn
- (EpAnnNotUsed)
+ (EpAnn
+ (Anchor
+ { T17544.hs:(48,3)-(49,18) }
+ (UnchangedAnchor))
+ [(AddEpAnn AnnData (EpaSpan { T17544.hs:48:3-6 }))
+ ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:48:15-19 }))]
+ (EpaComments
+ []))
(L
(SrcSpanAnn (EpAnnNotUsed) { T17544.hs:48:8-9 })
(Unqual
@@ -1825,14 +1832,7 @@
{OccName: Int})))))]
(Prefix)
(HsDataDefn
- (EpAnn
- (Anchor
- { T17544.hs:(48,3)-(49,18) }
- (UnchangedAnchor))
- [(AddEpAnn AnnData (EpaSpan { T17544.hs:48:3-6 }))
- ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:48:15-19 }))]
- (EpaComments
- []))
+ (NoExtField)
(DataType)
(Nothing)
(Nothing)
@@ -2060,7 +2060,14 @@
(SrcSpanAnn (EpAnnNotUsed) { T17544.hs:(54,3)-(55,20) })
(DataFamInstDecl
(FamEqn
- (EpAnnNotUsed)
+ (EpAnn
+ (Anchor
+ { T17544.hs:(54,3)-(55,20) }
+ (UnchangedAnchor))
+ [(AddEpAnn AnnData (EpaSpan { T17544.hs:54:3-6 }))
+ ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:54:16-20 }))]
+ (EpaComments
+ []))
(L
(SrcSpanAnn (EpAnnNotUsed) { T17544.hs:54:8-10 })
(Unqual
@@ -2085,14 +2092,7 @@
{OccName: Int})))))]
(Prefix)
(HsDataDefn
- (EpAnn
- (Anchor
- { T17544.hs:(54,3)-(55,20) }
- (UnchangedAnchor))
- [(AddEpAnn AnnData (EpaSpan { T17544.hs:54:3-6 }))
- ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:54:16-20 }))]
- (EpaComments
- []))
+ (NoExtField)
(DataType)
(Nothing)
(Nothing)
diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr
index 6d58a727af..82d2122d3e 100644
--- a/testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr
+++ b/testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr
@@ -63,14 +63,7 @@
[])
(Prefix)
(HsDataDefn
- (EpAnn
- (Anchor
- { T17544_kw.hs:(15,1)-(16,20) }
- (UnchangedAnchor))
- [(AddEpAnn AnnData (EpaSpan { T17544_kw.hs:15:1-4 }))
- ,(AddEpAnn AnnWhere (EpaSpan { T17544_kw.hs:16:3-7 }))]
- (EpaComments
- []))
+ (NoExtField)
(DataType)
(Nothing)
(Nothing)
@@ -146,14 +139,7 @@
[])
(Prefix)
(HsDataDefn
- (EpAnn
- (Anchor
- { T17544_kw.hs:(18,1)-(19,26) }
- (UnchangedAnchor))
- [(AddEpAnn AnnNewtype (EpaSpan { T17544_kw.hs:18:1-7 }))
- ,(AddEpAnn AnnWhere (EpaSpan { T17544_kw.hs:19:3-7 }))]
- (EpaComments
- []))
+ (NoExtField)
(NewType)
(Nothing)
(Nothing)
diff --git a/testsuite/tests/parser/should_compile/DumpParsedAst.stderr b/testsuite/tests/parser/should_compile/DumpParsedAst.stderr
index 106851f2e8..025df2068b 100644
--- a/testsuite/tests/parser/should_compile/DumpParsedAst.stderr
+++ b/testsuite/tests/parser/should_compile/DumpParsedAst.stderr
@@ -89,14 +89,7 @@
[])
(Prefix)
(HsDataDefn
- (EpAnn
- (Anchor
- { DumpParsedAst.hs:8:1-30 }
- (UnchangedAnchor))
- [(AddEpAnn AnnData (EpaSpan { DumpParsedAst.hs:8:1-4 }))
- ,(AddEpAnn AnnEqual (EpaSpan { DumpParsedAst.hs:8:12 }))]
- (EpaComments
- []))
+ (NoExtField)
(DataType)
(Nothing)
(Nothing)
@@ -530,16 +523,7 @@
{OccName: k}))))))])
(Prefix)
(HsDataDefn
- (EpAnn
- (Anchor
- { DumpParsedAst.hs:15:1-29 }
- (UnchangedAnchor))
- [(AddEpAnn AnnData (EpaSpan { DumpParsedAst.hs:15:1-4 }))
- ,(AddEpAnn AnnEqual (EpaSpan { DumpParsedAst.hs:15:19 }))
- ,(AddEpAnn AnnCloseP (EpaSpan { DumpParsedAst.hs:15:17 }))
- ,(AddEpAnn AnnOpenP (EpaSpan { DumpParsedAst.hs:15:10 }))]
- (EpaComments
- []))
+ (NoExtField)
(DataType)
(Nothing)
(Nothing)
diff --git a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
index 6ddf6dbf19..a205c8af53 100644
--- a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
+++ b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
@@ -107,7 +107,7 @@
[])
(Prefix)
(HsDataDefn
- (EpAnnNotUsed)
+ (NoExtField)
(DataType)
(Nothing)
(Nothing)
@@ -495,7 +495,7 @@
{Name: GHC.Types.Type}))))))))))]
(Prefix)
(HsDataDefn
- (EpAnnNotUsed)
+ (NoExtField)
(NewType)
(Nothing)
(Nothing)
@@ -752,7 +752,7 @@
{Name: k})))))])
(Prefix)
(HsDataDefn
- (EpAnnNotUsed)
+ (NoExtField)
(DataType)
(Nothing)
(Nothing)
diff --git a/testsuite/tests/parser/should_compile/T14189.stderr b/testsuite/tests/parser/should_compile/T14189.stderr
index 5871c41b1c..f5cd2ecb36 100644
--- a/testsuite/tests/parser/should_compile/T14189.stderr
+++ b/testsuite/tests/parser/should_compile/T14189.stderr
@@ -34,7 +34,7 @@
[])
(Prefix)
(HsDataDefn
- (EpAnnNotUsed)
+ (NoExtField)
(DataType)
(Nothing)
(Nothing)
diff --git a/testsuite/tests/parser/should_compile/T15323.stderr b/testsuite/tests/parser/should_compile/T15323.stderr
index 987a5b88a6..20867efede 100644
--- a/testsuite/tests/parser/should_compile/T15323.stderr
+++ b/testsuite/tests/parser/should_compile/T15323.stderr
@@ -77,14 +77,7 @@
{OccName: v}))))])
(Prefix)
(HsDataDefn
- (EpAnn
- (Anchor
- { T15323.hs:(5,1)-(6,54) }
- (UnchangedAnchor))
- [(AddEpAnn AnnData (EpaSpan { T15323.hs:5:1-4 }))
- ,(AddEpAnn AnnWhere (EpaSpan { T15323.hs:5:21-25 }))]
- (EpaComments
- []))
+ (NoExtField)
(DataType)
(Nothing)
(Nothing)
diff --git a/testsuite/tests/printer/Makefile b/testsuite/tests/printer/Makefile
index 653b9d3300..94893f6347 100644
--- a/testsuite/tests/printer/Makefile
+++ b/testsuite/tests/printer/Makefile
@@ -583,3 +583,7 @@ Test19821:
$(CHECK_PPR) $(LIBDIR) Test19821.hs
$(CHECK_EXACT) $(LIBDIR) Test19821.hs
+.PHONY: Test19834
+Test19834:
+ $(CHECK_PPR) $(LIBDIR) Test19834.hs
+ $(CHECK_EXACT) $(LIBDIR) Test19834.hs
diff --git a/testsuite/tests/printer/T18791.stderr b/testsuite/tests/printer/T18791.stderr
index 3ff58cc17e..ac100b217e 100644
--- a/testsuite/tests/printer/T18791.stderr
+++ b/testsuite/tests/printer/T18791.stderr
@@ -1,7 +1,6 @@
==================== Parser AST ====================
-
(L
{ T18791.hs:1:1 }
(HsModule
@@ -64,14 +63,7 @@
[])
(Prefix)
(HsDataDefn
- (EpAnn
- (Anchor
- { T18791.hs:(4,1)-(5,17) }
- (UnchangedAnchor))
- [(AddEpAnn AnnData (EpaSpan { T18791.hs:4:1-4 }))
- ,(AddEpAnn AnnWhere (EpaSpan { T18791.hs:4:8-12 }))]
- (EpaComments
- []))
+ (NoExtField)
(DataType)
(Nothing)
(Nothing)
diff --git a/testsuite/tests/printer/Test19834.hs b/testsuite/tests/printer/Test19834.hs
new file mode 100644
index 0000000000..bc4a118aa3
--- /dev/null
+++ b/testsuite/tests/printer/Test19834.hs
@@ -0,0 +1,4 @@
+{-# LANGUAGE TypeOperators #-}
+module Test19834 where
+
+data (a:.b) = a:.b
diff --git a/testsuite/tests/printer/all.T b/testsuite/tests/printer/all.T
index 51b63b880f..618206ae54 100644
--- a/testsuite/tests/printer/all.T
+++ b/testsuite/tests/printer/all.T
@@ -132,4 +132,4 @@ test('Test19798', ignore_stderr, makefile_test, ['Test19798'])
test('Test19813', ignore_stderr, makefile_test, ['Test19813'])
test('Test19814', ignore_stderr, makefile_test, ['Test19814'])
test('Test19821', ignore_stderr, makefile_test, ['Test19821'])
-
+test('Test19834', ignore_stderr, makefile_test, ['Test19834'])
diff --git a/utils/check-exact/ExactPrint.hs b/utils/check-exact/ExactPrint.hs
index e4319bebf0..c0620ebf16 100644
--- a/utils/check-exact/ExactPrint.hs
+++ b/utils/check-exact/ExactPrint.hs
@@ -782,12 +782,6 @@ instance ExactPrint (InstDecl GhcPs) where
getAnnotationEntry (DataFamInstD an _) = fromAnn an
getAnnotationEntry (TyFamInstD _ _) = NoEntryVal
--- instance Annotate (GHC.InstDecl GHC.GhcPs) where
-
--- markAST l (GHC.ClsInstD _ cid) = markAST l cid
--- markAST l (GHC.DataFamInstD _ dfid) = markAST l dfid
--- markAST l (GHC.TyFamInstD _ tfid) = markAST l tfid
--- markAST _ (GHC.XInstDecl x) = error $ "got XInstDecl for:" ++ showPprUnsafe x
exact (ClsInstD _ cid) = markAnnotated cid
exact (DataFamInstD an decl) = do
@@ -800,12 +794,13 @@ instance ExactPrint (InstDecl GhcPs) where
exactDataFamInstDecl :: EpAnn [AddEpAnn] -> TopLevelFlag -> (DataFamInstDecl GhcPs) -> EPP ()
exactDataFamInstDecl an top_lvl
- (DataFamInstDecl ( FamEqn { feqn_tycon = tycon
+ (DataFamInstDecl ( FamEqn { feqn_ext = an2
+ , feqn_tycon = tycon
, feqn_bndrs = bndrs
, feqn_pats = pats
, feqn_fixity = fixity
, feqn_rhs = defn }))
- = exactDataDefn an pp_hdr defn
+ = exactDataDefn an2 pp_hdr defn -- See Note [an and an2 in exactDataFamInstDecl]
where
pp_hdr mctxt = do
case top_lvl of
@@ -813,6 +808,19 @@ exactDataFamInstDecl an top_lvl
NotTopLevel -> return ()
exactHsFamInstLHS an tycon bndrs pats fixity mctxt
+{-
+Note [an and an2 in exactDataFamInstDecl]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The exactDataFamInstDecl function is called to render a
+DataFamInstDecl within its surrounding context. This context is
+rendered via the 'pp_hdr' function, which uses the exact print
+annotations from that context, named 'an'. The EPAs used for
+rendering the DataDefn are contained in the FamEqn, and are called
+'an2'.
+
+-}
+
-- ---------------------------------------------------------------------
exactTyFamInstDecl :: TopLevelFlag -> (TyFamInstDecl GhcPs) -> EPP ()
@@ -2681,7 +2689,6 @@ instance ExactPrint (TyClDecl GhcPs) where
markEpAnn an AnnCloseC
where
top_matter = do
- annotationsToComments (epAnnAnns an) [AnnOpenP, AnnCloseP]
markEpAnn an AnnClass
exactVanillaDeclHead an lclas tyvars fixity context
unless (null fds) $ do
@@ -2829,14 +2836,14 @@ exactDataDefn :: EpAnn [AddEpAnn]
-> HsDataDefn GhcPs
-> EPP ()
exactDataDefn an exactHdr
- (HsDataDefn { dd_ext = an2
- , dd_ND = new_or_data, dd_ctxt = context
+ (HsDataDefn { dd_ND = new_or_data, dd_ctxt = context
, dd_cType = mb_ct
, dd_kindSig = mb_sig
, dd_cons = condecls, dd_derivs = derivings }) = do
+ -- annotationsToComments (epAnnAnns an) [AnnOpenP, AnnCloseP]
if new_or_data == DataType
- then markEpAnn an2 AnnData
- else markEpAnn an2 AnnNewtype
+ then markEpAnn an AnnData
+ else markEpAnn an AnnNewtype
mapM_ markAnnotated mb_ct
exactHdr context
case mb_sig of
@@ -2845,7 +2852,7 @@ exactDataDefn an exactHdr
markEpAnn an AnnDcolon
markAnnotated kind
when (isGadt condecls) $ markEpAnn an AnnWhere
- exact_condecls an2 condecls
+ exact_condecls an condecls
mapM_ markAnnotated derivings
return ()
@@ -2863,16 +2870,16 @@ exactVanillaDeclHead an thing (HsQTvs { hsq_explicit = tyvars }) fixity context
-- = hsep [char '(',ppr (unLoc varl), pprInfixOcc (unLoc thing)
-- , (ppr.unLoc) (head varsr), char ')'
-- , hsep (map (ppr.unLoc) (tail vaprsr))]
- markEpAnnAll an id AnnOpenP
+ annotationsToComments (epAnnAnns an) [AnnOpenP,AnnCloseP]
markAnnotated varl
markAnnotated thing
markAnnotated (head varsr)
- markEpAnnAll an id AnnCloseP
markAnnotated (tail varsr)
return ()
| fixity == Infix = do
-- = hsep [ppr (unLoc varl), pprInfixOcc (unLoc thing)
-- , hsep (map (ppr.unLoc) varsr)]
+ annotationsToComments (epAnnAnns an) [AnnOpenP,AnnCloseP]
markAnnotated varl
markAnnotated thing
markAnnotated varsr
diff --git a/utils/check-exact/Main.hs b/utils/check-exact/Main.hs
index f9883fee83..d0971dac65 100644
--- a/utils/check-exact/Main.hs
+++ b/utils/check-exact/Main.hs
@@ -187,7 +187,8 @@ _tt = testOneFile changers "/home/alanz/mysrc/git.haskell.org/worktree/exactprin
-- "../../testsuite/tests/printer/Test19784.hs" Nothing
-- "../../testsuite/tests/printer/Test19813.hs" Nothing
-- "../../testsuite/tests/printer/Test19814.hs" Nothing
- "../../testsuite/tests/printer/Test19821.hs" Nothing
+ -- "../../testsuite/tests/printer/Test19821.hs" Nothing
+ "../../testsuite/tests/printer/Test19834.hs" Nothing
-- cloneT does not need a test, function can be retired
diff --git a/utils/haddock b/utils/haddock
-Subproject ef2304bbff1e30fcd9306b5b211f045d608753c
+Subproject 2fec1b44e0ee7e263286709aa528b4ecb99ac6c