Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
-
c83c6733
by Alan Zimmerman at 2026-10-26T18:19:55-04:00
6 changed files:
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Dump.hs
- compiler/GHC/Parser.y
- testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr
- testsuite/tests/printer/Test24533.stdout
- utils/check-exact/ExactPrint.hs
Changes:
| ... | ... | @@ -1042,9 +1042,7 @@ data AnnClsInstDecl |
| 1042 | 1042 | = AnnClsInstDecl {
|
| 1043 | 1043 | acid_instance :: EpToken "instance",
|
| 1044 | 1044 | acid_where :: EpToken "where",
|
| 1045 | - acid_openc :: EpToken "{",
|
|
| 1046 | - acid_semis :: [EpToken ";"],
|
|
| 1047 | - acid_closec :: EpToken "}"
|
|
| 1045 | + acid_decls :: AnnList
|
|
| 1048 | 1046 | } deriving Data
|
| 1049 | 1047 | |
| 1050 | 1048 | |
| ... | ... | @@ -1061,7 +1059,7 @@ type instance XTyFamInstD GhcTc = NoExtField |
| 1061 | 1059 | type instance XXInstDecl (GhcPass _) = DataConCantHappen
|
| 1062 | 1060 | |
| 1063 | 1061 | instance NoAnn AnnClsInstDecl where
|
| 1064 | - noAnn = AnnClsInstDecl noAnn noAnn noAnn noAnn noAnn
|
|
| 1062 | + noAnn = AnnClsInstDecl noAnn noAnn noAnn
|
|
| 1065 | 1063 | |
| 1066 | 1064 | cidDeprecation :: forall p. IsPass p
|
| 1067 | 1065 | => ClsInstDecl (GhcPass p)
|
| ... | ... | @@ -268,12 +268,11 @@ showAstData bs ba a0 = blankLine $$ showAstData' a0 |
| 268 | 268 | showAstData' j]
|
| 269 | 269 | |
| 270 | 270 | annClsInstDecl :: AnnClsInstDecl -> SDoc
|
| 271 | - annClsInstDecl (AnnClsInstDecl a b c d e) = case ba of
|
|
| 271 | + annClsInstDecl (AnnClsInstDecl a b c) = case ba of
|
|
| 272 | 272 | BlankEpAnnotations -> parens $ text "blanked:" <+> text "AnnFamilyDecl"
|
| 273 | 273 | NoBlankEpAnnotations ->
|
| 274 | 274 | parens $ text "AnnClsInstDecl"
|
| 275 | - $$ vcat [showAstData' a, showAstData' b, showAstData' c,
|
|
| 276 | - showAstData' d, showAstData' e]
|
|
| 275 | + $$ vcat [showAstData' a, showAstData' b, showAstData' c]
|
|
| 277 | 276 | |
| 278 | 277 | |
| 279 | 278 | annotationExprBracket :: BracketAnn (EpUniToken "[|" "⟦") (EpToken "[e|") -> SDoc
|
| ... | ... | @@ -1435,8 +1435,8 @@ expModifiers1 :: { forall b. DisambECP b => PV (Located [LHsModifierOf (LocatedA |
| 1435 | 1435 | inst_decl :: { LInstDecl GhcPs }
|
| 1436 | 1436 | : 'instance' maybe_warning_pragma overlap_pragma inst_type where_inst
|
| 1437 | 1437 | {% do { decls <- cvBindsAndSigs (snd $ unLoc $5)
|
| 1438 | - ; let (twhere, (openc, closec, semis)) = fst $ unLoc $5
|
|
| 1439 | - ; let anns = AnnClsInstDecl (epTok $1) twhere openc semis closec
|
|
| 1438 | + ; let (twhere, ann_list) = fst $ unLoc $5
|
|
| 1439 | + ; let anns = AnnClsInstDecl (epTok $1) twhere ann_list
|
|
| 1440 | 1440 | ; let cid = ClsInstDecl
|
| 1441 | 1441 | { cid_ext = ($2, anns)
|
| 1442 | 1442 | , cid_poly_ty = $4
|
| ... | ... | @@ -1896,14 +1896,13 @@ decls_inst :: { Located ([EpToken ";"],OrdList (LHsDecl GhcPs)) } -- Reversed |
| 1896 | 1896 | | {- empty -} { noLoc ([],nilOL) }
|
| 1897 | 1897 | |
| 1898 | 1898 | decllist_inst
|
| 1899 | - :: { Located ((EpToken "{", EpToken "}", [EpToken ";"])
|
|
| 1900 | - , OrdList (LHsDecl GhcPs)) } -- Reversed
|
|
| 1901 | - : '{' decls_inst '}' { sLL $1 $> ((epTok $1,epTok $3,fst $ unLoc $2),snd $ unLoc $2) }
|
|
| 1902 | - | vocurly decls_inst close { L (gl $2) ((noAnn,noAnn,fst $ unLoc $2),snd $ unLoc $2) }
|
|
| 1899 | + :: { Located (AnnList, OrdList (LHsDecl GhcPs)) } -- Reversed
|
|
| 1900 | + : '{' decls_inst '}' { sLL $1 $> (AnnList AnnListBraces (ListBraces (epTok $1) (epTok $3)) (fst $ unLoc $2), snd $ unLoc $2) }
|
|
| 1901 | + | vocurly decls_inst close { L (gl $2) (AnnList (AnnListLayout (glR $1)) ListNone (fst $ unLoc $2), snd $ unLoc $2) }
|
|
| 1903 | 1902 | |
| 1904 | 1903 | -- Instance body
|
| 1905 | 1904 | --
|
| 1906 | -where_inst :: { Located ((EpToken "where", (EpToken "{", EpToken "}", [EpToken ";"]))
|
|
| 1905 | +where_inst :: { Located ((EpToken "where", AnnList)
|
|
| 1907 | 1906 | , OrdList (LHsDecl GhcPs)) } -- Reversed
|
| 1908 | 1907 | -- No implicit parameters
|
| 1909 | 1908 | -- May have type declarations
|
| ... | ... | @@ -999,9 +999,11 @@ |
| 999 | 999 | (EpTok (EpaSpan { T17544.hs:23:1-8 }))
|
| 1000 | 1000 | (EpTok
|
| 1001 | 1001 | (EpaSpan { T17544.hs:23:17-21 }))
|
| 1002 | - (EpTok (EpaSpan { <no location info> }))
|
|
| 1003 | - []
|
|
| 1004 | - (EpTok (EpaSpan { <no location info> }))))
|
|
| 1002 | + (AnnList
|
|
| 1003 | + (AnnListLayout
|
|
| 1004 | + (EpaSpan { T17544.hs:24:3 }))
|
|
| 1005 | + (ListNone)
|
|
| 1006 | + [])))
|
|
| 1005 | 1007 | []
|
| 1006 | 1008 | (L
|
| 1007 | 1009 | (EpAnn
|
| ... | ... | @@ -1393,9 +1395,11 @@ |
| 1393 | 1395 | (EpTok (EpaSpan { T17544.hs:29:1-8 }))
|
| 1394 | 1396 | (EpTok
|
| 1395 | 1397 | (EpaSpan { T17544.hs:29:17-21 }))
|
| 1396 | - (EpTok (EpaSpan { <no location info> }))
|
|
| 1397 | - []
|
|
| 1398 | - (EpTok (EpaSpan { <no location info> }))))
|
|
| 1398 | + (AnnList
|
|
| 1399 | + (AnnListLayout
|
|
| 1400 | + (EpaSpan { T17544.hs:30:3 }))
|
|
| 1401 | + (ListNone)
|
|
| 1402 | + [])))
|
|
| 1399 | 1403 | []
|
| 1400 | 1404 | (L
|
| 1401 | 1405 | (EpAnn
|
| ... | ... | @@ -1787,9 +1791,11 @@ |
| 1787 | 1791 | (EpTok (EpaSpan { T17544.hs:35:1-8 }))
|
| 1788 | 1792 | (EpTok
|
| 1789 | 1793 | (EpaSpan { T17544.hs:35:17-21 }))
|
| 1790 | - (EpTok (EpaSpan { <no location info> }))
|
|
| 1791 | - []
|
|
| 1792 | - (EpTok (EpaSpan { <no location info> }))))
|
|
| 1794 | + (AnnList
|
|
| 1795 | + (AnnListLayout
|
|
| 1796 | + (EpaSpan { T17544.hs:36:3 }))
|
|
| 1797 | + (ListNone)
|
|
| 1798 | + [])))
|
|
| 1793 | 1799 | []
|
| 1794 | 1800 | (L
|
| 1795 | 1801 | (EpAnn
|
| ... | ... | @@ -2181,9 +2187,11 @@ |
| 2181 | 2187 | (EpTok (EpaSpan { T17544.hs:41:1-8 }))
|
| 2182 | 2188 | (EpTok
|
| 2183 | 2189 | (EpaSpan { T17544.hs:41:17-21 }))
|
| 2184 | - (EpTok (EpaSpan { <no location info> }))
|
|
| 2185 | - []
|
|
| 2186 | - (EpTok (EpaSpan { <no location info> }))))
|
|
| 2190 | + (AnnList
|
|
| 2191 | + (AnnListLayout
|
|
| 2192 | + (EpaSpan { T17544.hs:42:3 }))
|
|
| 2193 | + (ListNone)
|
|
| 2194 | + [])))
|
|
| 2187 | 2195 | []
|
| 2188 | 2196 | (L
|
| 2189 | 2197 | (EpAnn
|
| ... | ... | @@ -2575,9 +2583,11 @@ |
| 2575 | 2583 | (EpTok (EpaSpan { T17544.hs:47:1-8 }))
|
| 2576 | 2584 | (EpTok
|
| 2577 | 2585 | (EpaSpan { T17544.hs:47:17-21 }))
|
| 2578 | - (EpTok (EpaSpan { <no location info> }))
|
|
| 2579 | - []
|
|
| 2580 | - (EpTok (EpaSpan { <no location info> }))))
|
|
| 2586 | + (AnnList
|
|
| 2587 | + (AnnListLayout
|
|
| 2588 | + (EpaSpan { T17544.hs:48:3 }))
|
|
| 2589 | + (ListNone)
|
|
| 2590 | + [])))
|
|
| 2581 | 2591 | []
|
| 2582 | 2592 | (L
|
| 2583 | 2593 | (EpAnn
|
| ... | ... | @@ -2969,9 +2979,11 @@ |
| 2969 | 2979 | (EpTok (EpaSpan { T17544.hs:53:1-8 }))
|
| 2970 | 2980 | (EpTok
|
| 2971 | 2981 | (EpaSpan { T17544.hs:53:18-22 }))
|
| 2972 | - (EpTok (EpaSpan { <no location info> }))
|
|
| 2973 | - []
|
|
| 2974 | - (EpTok (EpaSpan { <no location info> }))))
|
|
| 2982 | + (AnnList
|
|
| 2983 | + (AnnListLayout
|
|
| 2984 | + (EpaSpan { T17544.hs:54:3 }))
|
|
| 2985 | + (ListNone)
|
|
| 2986 | + [])))
|
|
| 2975 | 2987 | []
|
| 2976 | 2988 | (L
|
| 2977 | 2989 | (EpAnn
|
| ... | ... | @@ -64,9 +64,10 @@ |
| 64 | 64 | (EpTok (EpaSpan { Test24533.hs:4:1-8 }))
|
| 65 | 65 | (EpTok
|
| 66 | 66 | (EpaSpan { <no location info> }))
|
| 67 | - (EpTok (EpaSpan { <no location info> }))
|
|
| 68 | - []
|
|
| 69 | - (EpTok (EpaSpan { <no location info> }))))
|
|
| 67 | + (AnnList
|
|
| 68 | + (AnnListNoLayout)
|
|
| 69 | + (ListNone)
|
|
| 70 | + [])))
|
|
| 70 | 71 | []
|
| 71 | 72 | (L
|
| 72 | 73 | (EpAnn
|
| ... | ... | @@ -451,9 +452,11 @@ |
| 451 | 452 | (EpTok (EpaSpan { Test24533.hs:14:1-8 }))
|
| 452 | 453 | (EpTok
|
| 453 | 454 | (EpaSpan { Test24533.hs:14:17-21 }))
|
| 454 | - (EpTok (EpaSpan { <no location info> }))
|
|
| 455 | - []
|
|
| 456 | - (EpTok (EpaSpan { <no location info> }))))
|
|
| 455 | + (AnnList
|
|
| 456 | + (AnnListLayout
|
|
| 457 | + (EpaSpan { Test24533.hs:16:3 }))
|
|
| 458 | + (ListNone)
|
|
| 459 | + [])))
|
|
| 457 | 460 | []
|
| 458 | 461 | (L
|
| 459 | 462 | (EpAnn
|
| ... | ... | @@ -724,9 +727,10 @@ |
| 724 | 727 | (EpTok (EpaSpan { Test24533.ppr.hs:3:1-8 }))
|
| 725 | 728 | (EpTok
|
| 726 | 729 | (EpaSpan { <no location info> }))
|
| 727 | - (EpTok (EpaSpan { <no location info> }))
|
|
| 728 | - []
|
|
| 729 | - (EpTok (EpaSpan { <no location info> }))))
|
|
| 730 | + (AnnList
|
|
| 731 | + (AnnListNoLayout)
|
|
| 732 | + (ListNone)
|
|
| 733 | + [])))
|
|
| 730 | 734 | []
|
| 731 | 735 | (L
|
| 732 | 736 | (EpAnn
|
| ... | ... | @@ -1038,9 +1042,11 @@ |
| 1038 | 1042 | (EpTok (EpaSpan { Test24533.ppr.hs:5:1-8 }))
|
| 1039 | 1043 | (EpTok
|
| 1040 | 1044 | (EpaSpan { Test24533.ppr.hs:5:17-21 }))
|
| 1041 | - (EpTok (EpaSpan { <no location info> }))
|
|
| 1042 | - []
|
|
| 1043 | - (EpTok (EpaSpan { <no location info> }))))
|
|
| 1045 | + (AnnList
|
|
| 1046 | + (AnnListLayout
|
|
| 1047 | + (EpaSpan { Test24533.ppr.hs:6:3 }))
|
|
| 1048 | + (ListNone)
|
|
| 1049 | + [])))
|
|
| 1044 | 1050 | []
|
| 1045 | 1051 | (L
|
| 1046 | 1052 | (EpAnn
|
| ... | ... | @@ -2406,18 +2406,17 @@ instance ExactPrint (ClsInstDecl GhcPs) where |
| 2406 | 2406 | getAnnotationEntry _ = NoEntryVal
|
| 2407 | 2407 | setAnnotationAnchor a _ _ _ = a
|
| 2408 | 2408 | |
| 2409 | - exact (ClsInstDecl { cid_ext = (mbWarn, AnnClsInstDecl i w oc semis cc)
|
|
| 2409 | + exact (ClsInstDecl { cid_ext = (mbWarn, AnnClsInstDecl i w ann_list)
|
|
| 2410 | 2410 | , cid_poly_ty = inst_ty
|
| 2411 | 2411 | , cid_decls = decls
|
| 2412 | 2412 | , cid_overlap_mode = mbOverlap
|
| 2413 | 2413 | , cid_modifiers = mods })
|
| 2414 | 2414 | = do
|
| 2415 | 2415 | (mbWarn', i', w', mbOverlap', inst_ty', mods') <- top_matter
|
| 2416 | - oc' <- markEpToken oc
|
|
| 2417 | - semis' <- mapM markEpToken semis
|
|
| 2418 | - decls' <- mapM markAnnotated decls
|
|
| 2419 | - cc' <- markEpToken cc
|
|
| 2420 | - return (ClsInstDecl { cid_ext = (mbWarn', AnnClsInstDecl i' w' oc' semis' cc')
|
|
| 2416 | + (ann_list', decls') <- markAnnListA' ann_list $ \a -> do
|
|
| 2417 | + r <- setLayoutBoth $ mapM markAnnotated decls
|
|
| 2418 | + return (a,r)
|
|
| 2419 | + return (ClsInstDecl { cid_ext = (mbWarn', AnnClsInstDecl i' w' ann_list')
|
|
| 2421 | 2420 | , cid_poly_ty = inst_ty'
|
| 2422 | 2421 | , cid_decls = decls'
|
| 2423 | 2422 | , cid_overlap_mode = mbOverlap'
|