Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
-
a10cb52a
by Zubin Duggal at 2026-08-06T07:29:26-04:00
-
a745b443
by Zubin Duggal at 2026-08-06T07:29:26-04:00
-
5f17ab12
by Simon Jakobi at 2026-08-06T07:29:28-04:00
-
fecb9282
by Simon Peyton Jones at 2026-08-06T07:29:28-04:00
-
1cab497c
by Alan Zimmerman at 2026-08-06T07:29:29-04:00
20 changed files:
- compiler/GHC/Core/Class.hs
- compiler/GHC/Driver/Main/Passes.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Decls/Overlap.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Iface/Ext/Types.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/Annotation.hs
- compiler/GHC/Rename/HsType.hs
- compiler/GHC/Types/ForeignCall.hs
- compiler/GHC/Types/Id/Make.hs
- compiler/GHC/Unit/Module/Warnings.hs
- testsuite/.gitignore
- testsuite/Makefile
- testsuite/tests/hiefile/should_compile/T24493.stderr
- + testsuite/tests/hiefile/should_run/T25709.hs
- + testsuite/tests/hiefile/should_run/T25709.stdout
- testsuite/tests/hiefile/should_run/all.T
- utils/check-exact/ExactPrint.hs
- utils/haddock/haddock-api/src/Haddock/Types.hs
Changes:
| ... | ... | @@ -84,9 +84,9 @@ data Class |
| 84 | 84 | -- Here fun-deps are [([a,b],[c]), ([a,c],[b])]
|
| 85 | 85 | type FunDep a = ([a],[a])
|
| 86 | 86 | |
| 87 | -type ClassOpItem = (Id, DefMethInfo)
|
|
| 88 | - -- Selector function; contains unfolding
|
|
| 89 | - -- Default-method info
|
|
| 87 | +type ClassOpItem = ( Id -- Dictionary selector function
|
|
| 88 | + -- See Note [Dictionary selectors]
|
|
| 89 | + , DefMethInfo) -- Default-method info
|
|
| 90 | 90 | |
| 91 | 91 | type DefMethInfo = Maybe (Name, DefMethSpec Type)
|
| 92 | 92 | -- Nothing No default method
|
| ... | ... | @@ -164,7 +164,19 @@ classMinimalDef :: Class -> ClassMinimalDef |
| 164 | 164 | classMinimalDef Class{ classBody = ConcreteClass{ cls_min_def = d } } = d
|
| 165 | 165 | classMinimalDef _ = mkTrue -- TODO: make sure this is the right direction
|
| 166 | 166 | |
| 167 | -{-
|
|
| 167 | +{- Note [Dictionary selectors]
|
|
| 168 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
| 169 | +Each `ClassOpItem` stores a dictionary selector `Id`:
|
|
| 170 | + |
|
| 171 | +* The type of the selector is always closed, and has form
|
|
| 172 | + forall a1..an. C a1 .. an => blah
|
|
| 173 | + where `a1..an` are the class variables, and
|
|
| 174 | + `blah` is the method type.
|
|
| 175 | + See GHC.Types.Id.Make.mkDictSelId, which constructs them.
|
|
| 176 | + |
|
| 177 | +* The selector has no unfolding, but one RULE.
|
|
| 178 | + See Note [ClassOp/DFun selection] in GHC.Tc.TyCl.Instance
|
|
| 179 | + |
|
| 168 | 180 | Note [Associated type defaults]
|
| 169 | 181 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| 170 | 182 | The following is an example of associated type defaults:
|
| ... | ... | @@ -92,7 +92,7 @@ import GHC.Iface.Make |
| 92 | 92 | import GHC.Iface.Recomp
|
| 93 | 93 | import GHC.Iface.Tidy
|
| 94 | 94 | import GHC.Iface.Ext.Ast ( mkHieFile )
|
| 95 | -import GHC.Iface.Ext.Types ( getAsts, hie_asts, hie_module )
|
|
| 95 | +import GHC.Iface.Ext.Types ( getAsts, hie_asts, hie_module, hie_types )
|
|
| 96 | 96 | import GHC.Iface.Ext.Binary ( readHieFile, writeHieFile , hie_file_result)
|
| 97 | 97 | import GHC.Iface.Ext.Debug ( diffFile, validateScopes )
|
| 98 | 98 | |
| ... | ... | @@ -167,7 +167,7 @@ import GHC.Data.StringBuffer |
| 167 | 167 | import GHC.Data.Maybe
|
| 168 | 168 | import qualified GHC.Data.Strict as Strict
|
| 169 | 169 | |
| 170 | - |
|
| 170 | +import qualified Data.Array as A
|
|
| 171 | 171 | import Data.List ( nub, isPrefixOf, partition )
|
| 172 | 172 | import qualified Data.List.NonEmpty as NE
|
| 173 | 173 | import Control.Monad
|
| ... | ... | @@ -332,7 +332,10 @@ extract_renamed_stuff mod_summary tc_result = do |
| 332 | 332 | hieFile <- mkHieFile mod_summary tc_result (fromJust rn_info)
|
| 333 | 333 | let out_file = ml_hie_file $ ms_location mod_summary
|
| 334 | 334 | liftIO $ writeHieFile out_file hieFile
|
| 335 | - liftIO $ putDumpFileMaybe logger Opt_D_dump_hie "HIE AST" FormatHaskell (ppr $ hie_asts hieFile)
|
|
| 335 | + let hie_doc =
|
|
| 336 | + ppr (hie_asts hieFile)
|
|
| 337 | + $+$ ppr (A.assocs $ hie_types hieFile)
|
|
| 338 | + liftIO $ putDumpFileMaybe logger Opt_D_dump_hie "HIE AST" FormatHaskell hie_doc
|
|
| 336 | 339 | |
| 337 | 340 | -- Validate HIE files
|
| 338 | 341 | when (gopt Opt_ValidateHie dflags) $ do
|
| ... | ... | @@ -1528,7 +1528,7 @@ instance OutputableBndrId p |
| 1528 | 1528 | ************************************************************************
|
| 1529 | 1529 | -}
|
| 1530 | 1530 | |
| 1531 | -type instance XHsAnnotation (GhcPass _) = (AnnPragma, SourceText)
|
|
| 1531 | +type instance XHsAnnotation (GhcPass _) = (AnnAnnDecl, SourceText)
|
|
| 1532 | 1532 | type instance XXAnnDecl (GhcPass _) = DataConCantHappen
|
| 1533 | 1533 | |
| 1534 | 1534 | instance (OutputableBndrId p) => Outputable (AnnDecl (GhcPass p)) where
|
| ... | ... | @@ -26,7 +26,7 @@ import GHC.Prelude |
| 26 | 26 | |
| 27 | 27 | import GHC.Hs.Extension
|
| 28 | 28 | |
| 29 | -import GHC.Parser.Annotation ( AnnPragma )
|
|
| 29 | +import GHC.Parser.Annotation ( AnnOverlap )
|
|
| 30 | 30 | |
| 31 | 31 | import Language.Haskell.Syntax.Decls.Overlap
|
| 32 | 32 | import Language.Haskell.Syntax.Extension
|
| ... | ... | @@ -67,8 +67,8 @@ instance NFData OverlapFlag where |
| 67 | 67 | instance Outputable OverlapFlag where
|
| 68 | 68 | ppr flag = ppr (overlapMode flag) <+> pprSafeOverlap (isSafeOverlap flag)
|
| 69 | 69 | |
| 70 | -type instance XOverlapMode GhcPs = (SourceText, AnnPragma)
|
|
| 71 | -type instance XOverlapMode GhcRn = (SourceText, AnnPragma)
|
|
| 70 | +type instance XOverlapMode GhcPs = (SourceText, AnnOverlap)
|
|
| 71 | +type instance XOverlapMode GhcRn = (SourceText, AnnOverlap)
|
|
| 72 | 72 | type instance XOverlapMode GhcTc = SourceText
|
| 73 | 73 | |
| 74 | 74 | type instance XXOverlapMode (GhcPass _) = DataConCantHappen
|
| ... | ... | @@ -612,7 +612,7 @@ instance NoAnn AnnFunRhs where |
| 612 | 612 | |
| 613 | 613 | -- ---------------------------------------------------------------------
|
| 614 | 614 | |
| 615 | -type instance XSCC (GhcPass _) = (AnnPragma, SourceText)
|
|
| 615 | +type instance XSCC (GhcPass _) = (AnnPragSCC, SourceText)
|
|
| 616 | 616 | type instance XXPragE (GhcPass _) = DataConCantHappen
|
| 617 | 617 | |
| 618 | 618 | type instance XCDotFieldOcc (GhcPass _) = AnnFieldLabel
|
| ... | ... | @@ -159,6 +159,18 @@ data HieType a |
| 159 | 159 | | HCoercionTy
|
| 160 | 160 | deriving (Functor, Foldable, Traversable, Eq)
|
| 161 | 161 | |
| 162 | +instance Outputable a => Outputable (HieType a) where
|
|
| 163 | + ppr (HTyVarTy name) = ppr name
|
|
| 164 | + ppr (HAppTy fun arg) = parens $ ppr fun <+> ppr arg
|
|
| 165 | + ppr (HTyConApp tc args) = parens $ ppr tc <+> ppr args
|
|
| 166 | + ppr (HForAllTy ((name, ty), flag) body) =
|
|
| 167 | + text "forall" <+> ppr flag <+> ppr name O.<> text ":" <+> ppr ty O.<> text "." <+> ppr body
|
|
| 168 | + ppr (HFunTy mult arg res) = parens $ ppr arg <+> arrow <+> ppr res <+> ppr mult
|
|
| 169 | + ppr (HQualTy ctxt ty) = parens $ ppr ctxt <+> text "=>" <+> ppr ty
|
|
| 170 | + ppr (HLitTy lit) = ppr lit
|
|
| 171 | + ppr (HCastTy ty) = text "cast" <+> ppr ty
|
|
| 172 | + ppr HCoercionTy = text "<coercion>"
|
|
| 173 | + |
|
| 162 | 174 | type HieTypeFlat = HieType TypeIndex
|
| 163 | 175 | |
| 164 | 176 | -- | Roughly isomorphic to the original core 'Type'.
|
| ... | ... | @@ -222,6 +234,10 @@ instance Binary (HieArgs TypeIndex) where |
| 222 | 234 | put_ bh (HieArgs xs) = put_ bh xs
|
| 223 | 235 | get bh = HieArgs <$> get bh
|
| 224 | 236 | |
| 237 | +instance Outputable a => Outputable (HieArgs a) where
|
|
| 238 | + ppr (HieArgs args) = braces $ hsep $ punctuate comma $ map pprArg args
|
|
| 239 | + where pprArg (vis, ty) = (if vis then id else parens) (ppr ty)
|
|
| 240 | + |
|
| 225 | 241 | |
| 226 | 242 | -- A HiePath is just a lexical FastString. We use a lexical FastString to avoid
|
| 227 | 243 | -- non-determinism when printing or storing HieASTs which are sorted by their
|
| ... | ... | @@ -1473,13 +1473,13 @@ inst_decl :: { LInstDecl GhcPs } |
| 1473 | 1473 | |
| 1474 | 1474 | overlap_pragma :: { Maybe (LocatedA (OverlapMode GhcPs)) }
|
| 1475 | 1475 | : '{-# OVERLAPPABLE' '#-}' {% fmap Just $ amsA' (sLL $1 $> (Overlappable (getOVERLAPPABLE_PRAGs $1,
|
| 1476 | - AnnPragma (glR $1) (epTok $2) noAnn noAnn noAnn noAnn noAnn))) }
|
|
| 1476 | + AnnOverlap (glR $1) (epTok $2)))) }
|
|
| 1477 | 1477 | | '{-# OVERLAPPING' '#-}' {% fmap Just $ amsA' (sLL $1 $> (Overlapping (getOVERLAPPING_PRAGs $1,
|
| 1478 | - AnnPragma (glR $1) (epTok $2) noAnn noAnn noAnn noAnn noAnn))) }
|
|
| 1478 | + AnnOverlap (glR $1) (epTok $2)))) }
|
|
| 1479 | 1479 | | '{-# OVERLAPS' '#-}' {% fmap Just $ amsA' (sLL $1 $> (Overlaps (getOVERLAPS_PRAGs $1,
|
| 1480 | - AnnPragma (glR $1) (epTok $2) noAnn noAnn noAnn noAnn noAnn))) }
|
|
| 1480 | + AnnOverlap (glR $1) (epTok $2)))) }
|
|
| 1481 | 1481 | | '{-# INCOHERENT' '#-}' {% fmap Just $ amsA' (sLL $1 $> (Incoherent (getINCOHERENT_PRAGs $1,
|
| 1482 | - AnnPragma (glR $1) (epTok $2) noAnn noAnn noAnn noAnn noAnn))) }
|
|
| 1482 | + AnnOverlap (glR $1) (epTok $2)))) }
|
|
| 1483 | 1483 | | {- empty -} { Nothing }
|
| 1484 | 1484 | |
| 1485 | 1485 | deriv_strategy_no_via :: { LDerivStrategy GhcPs }
|
| ... | ... | @@ -1710,13 +1710,13 @@ datafam_inst_hdr :: { Located (Maybe (LHsContext GhcPs), HsOuterFamEqnTyVarBndrs |
| 1710 | 1710 | capi_ctype :: { Maybe (LocatedA (CType GhcPs)) }
|
| 1711 | 1711 | capi_ctype : '{-# CTYPE' STRING STRING '#-}'
|
| 1712 | 1712 | {% fmap Just $ amsA' (sLL $1 $> (mkCType (getCTYPEs $1) (getSTRINGs $3)
|
| 1713 | - (AnnPragma (glR $1) (epTok $4) noAnn (glR $2) (glR $3) noAnn noAnn)
|
|
| 1713 | + (AnnCType (glR $1) (epTok $4) (glR $2) (glR $3))
|
|
| 1714 | 1714 | (Just (Header (getSTRINGs $2) (getSTRING $2)))
|
| 1715 | 1715 | (getSTRING $3)))}
|
| 1716 | 1716 | |
| 1717 | 1717 | | '{-# CTYPE' STRING '#-}'
|
| 1718 | 1718 | {% fmap Just $ amsA' (sLL $1 $> (mkCType (getCTYPEs $1) (getSTRINGs $2)
|
| 1719 | - (AnnPragma (glR $1) (epTok $3) noAnn noAnn (glR $2) noAnn noAnn)
|
|
| 1719 | + (AnnCType (glR $1) (epTok $3) noAnn (glR $2))
|
|
| 1720 | 1720 | Nothing (getSTRING $2)))}
|
| 1721 | 1721 | |
| 1722 | 1722 | | { Nothing }
|
| ... | ... | @@ -2078,11 +2078,11 @@ to varid (used for rule_vars), 'checkRuleTyVarBndrNames' must be updated. |
| 2078 | 2078 | maybe_warning_pragma :: { Maybe (LWarningTxt GhcPs) }
|
| 2079 | 2079 | : '{-# DEPRECATED' strings '#-}'
|
| 2080 | 2080 | {% fmap Just $ amsA' (sLL $1 $> $
|
| 2081 | - DeprecatedTxt (getDEPRECATED_PRAGs $1, AnnPragma (glR $1) (epTok $3) (fst $ unLoc $2) noAnn noAnn noAnn noAnn)
|
|
| 2081 | + DeprecatedTxt (getDEPRECATED_PRAGs $1, AnnWarningTxt (glR $1) (epTok $3) (fst $ unLoc $2))
|
|
| 2082 | 2082 | (snd $ unLoc $2))}
|
| 2083 | 2083 | | '{-# WARNING' warning_category strings '#-}'
|
| 2084 | 2084 | {% fmap Just $ amsA' (sLL $1 $> $
|
| 2085 | - WarningTxt (getWARNING_PRAGs $1, AnnPragma (glR $1) (epTok $4) (fst $ unLoc $3) noAnn noAnn noAnn noAnn)
|
|
| 2085 | + WarningTxt (getWARNING_PRAGs $1, AnnWarningTxt (glR $1) (epTok $4) (fst $ unLoc $3))
|
|
| 2086 | 2086 | $2 (snd $ unLoc $3))}
|
| 2087 | 2087 | | {- empty -} { Nothing }
|
| 2088 | 2088 | |
| ... | ... | @@ -2165,19 +2165,19 @@ stringlist :: { Located (OrdList (LocatedA (WithHsDocIdentifiers (StringLiteral |
| 2165 | 2165 | annotation :: { LHsDecl GhcPs }
|
| 2166 | 2166 | : '{-# ANN' name_var aexp '#-}' {% runPV (unECP $3) >>= \ $3 ->
|
| 2167 | 2167 | amsA' (sLL $1 $> (AnnD noExtField $ HsAnnotation
|
| 2168 | - (AnnPragma (glR $1) (epTok $4) noAnn noAnn noAnn noAnn noAnn,
|
|
| 2168 | + (AnnAnnDecl (glR $1) (epTok $4) noAnn noAnn,
|
|
| 2169 | 2169 | (getANN_PRAGs $1))
|
| 2170 | 2170 | (ValueAnnProvenance $2) $3)) }
|
| 2171 | 2171 | |
| 2172 | 2172 | | '{-# ANN' 'type' otycon aexp '#-}' {% runPV (unECP $4) >>= \ $4 ->
|
| 2173 | 2173 | amsA' (sLL $1 $> (AnnD noExtField $ HsAnnotation
|
| 2174 | - (AnnPragma (glR $1) (epTok $5) noAnn noAnn noAnn (epTok $2) noAnn,
|
|
| 2174 | + (AnnAnnDecl (glR $1) (epTok $5) (epTok $2) noAnn,
|
|
| 2175 | 2175 | (getANN_PRAGs $1))
|
| 2176 | 2176 | (TypeAnnProvenance $3) $4)) }
|
| 2177 | 2177 | |
| 2178 | 2178 | | '{-# ANN' 'module' aexp '#-}' {% runPV (unECP $3) >>= \ $3 ->
|
| 2179 | 2179 | amsA' (sLL $1 $> (AnnD noExtField $ HsAnnotation
|
| 2180 | - (AnnPragma (glR $1) (epTok $4) noAnn noAnn noAnn noAnn (epTok $2),
|
|
| 2180 | + (AnnAnnDecl (glR $1) (epTok $4) noAnn (epTok $2),
|
|
| 2181 | 2181 | (getANN_PRAGs $1))
|
| 2182 | 2182 | ModuleAnnProvenance $3)) }
|
| 2183 | 2183 | |
| ... | ... | @@ -3052,12 +3052,12 @@ prag_e :: { Located (HsPragE GhcPs) } |
| 3052 | 3052 | : '{-# SCC' STRING '#-}' {% do { scc <- getSCC $2
|
| 3053 | 3053 | ; return (sLL $1 $>
|
| 3054 | 3054 | (HsPragSCC
|
| 3055 | - (AnnPragma (glR $1) (epTok $3) noAnn (glR $2) noAnn noAnn noAnn,
|
|
| 3055 | + (AnnPragSCC (glR $1) (epTok $3) (glR $2),
|
|
| 3056 | 3056 | (getSCC_PRAGs $1))
|
| 3057 | 3057 | (StringLiteral (getSTRINGs $2) scc)))} }
|
| 3058 | 3058 | | '{-# SCC' VARID '#-}' { sLL $1 $>
|
| 3059 | 3059 | (HsPragSCC
|
| 3060 | - (AnnPragma (glR $1) (epTok $3) noAnn (glR $2) noAnn noAnn noAnn,
|
|
| 3060 | + (AnnPragSCC (glR $1) (epTok $3) (glR $2),
|
|
| 3061 | 3061 | (getSCC_PRAGs $1))
|
| 3062 | 3062 | (StringLiteral NoSourceText (fastStringToShortText $ getVARID $2))) }
|
| 3063 | 3063 |
| ... | ... | @@ -36,7 +36,7 @@ module GHC.Parser.Annotation ( |
| 36 | 36 | |
| 37 | 37 | AnnList(..), AnnListBrackets(..),
|
| 38 | 38 | AnnParen(..),
|
| 39 | - AnnPragma(..),
|
|
| 39 | + AnnCType(..),AnnWarningTxt(..),AnnOverlap(..),AnnAnnDecl(..),AnnPragSCC(..),
|
|
| 40 | 40 | AnnBooleanFormula(..),
|
| 41 | 41 | NameAnn(..), NameAdornment(..),
|
| 42 | 42 | NoEpAnns(..),
|
| ... | ... | @@ -627,15 +627,40 @@ data NameAdornment |
| 627 | 627 | |
| 628 | 628 | -- | exact print annotation used for capturing the locations of
|
| 629 | 629 | -- annotations in pragmas.
|
| 630 | -data AnnPragma
|
|
| 631 | - = AnnPragma {
|
|
| 632 | - apr_open :: EpaLocation,
|
|
| 633 | - apr_close :: EpToken "#-}",
|
|
| 634 | - apr_squares :: (EpToken "[", EpToken "]"),
|
|
| 635 | - apr_loc1 :: EpaLocation,
|
|
| 636 | - apr_loc2 :: EpaLocation,
|
|
| 637 | - apr_type :: EpToken "type",
|
|
| 638 | - apr_module :: EpToken "module"
|
|
| 630 | +data AnnCType
|
|
| 631 | + = AnnCType {
|
|
| 632 | + ac_open :: EpaLocation,
|
|
| 633 | + ac_close :: EpToken "#-}",
|
|
| 634 | + ac_loc1 :: EpaLocation,
|
|
| 635 | + ac_loc2 :: EpaLocation
|
|
| 636 | + } deriving (Data,Eq)
|
|
| 637 | + |
|
| 638 | +data AnnWarningTxt
|
|
| 639 | + = AnnWarningTxt {
|
|
| 640 | + awt_open :: EpaLocation,
|
|
| 641 | + awt_close :: EpToken "#-}",
|
|
| 642 | + awt_squares :: (EpToken "[", EpToken "]")
|
|
| 643 | + } deriving (Data,Eq)
|
|
| 644 | + |
|
| 645 | +data AnnOverlap
|
|
| 646 | + = AnnOverlap {
|
|
| 647 | + ao_open :: EpaLocation,
|
|
| 648 | + ao_close :: EpToken "#-}"
|
|
| 649 | + } deriving (Data,Eq)
|
|
| 650 | + |
|
| 651 | +data AnnAnnDecl
|
|
| 652 | + = AnnAnnDecl {
|
|
| 653 | + ad_open :: EpaLocation,
|
|
| 654 | + ad_close :: EpToken "#-}",
|
|
| 655 | + ad_type :: EpToken "type",
|
|
| 656 | + ad_module :: EpToken "module"
|
|
| 657 | + } deriving (Data,Eq)
|
|
| 658 | + |
|
| 659 | +data AnnPragSCC
|
|
| 660 | + = AnnPragSCC {
|
|
| 661 | + aps_open :: EpaLocation,
|
|
| 662 | + aps_close :: EpToken "#-}",
|
|
| 663 | + aps_loc1 :: EpaLocation
|
|
| 639 | 664 | } deriving (Data,Eq)
|
| 640 | 665 | |
| 641 | 666 | -- ---------------------------------------------------------------------
|
| ... | ... | @@ -1020,8 +1045,20 @@ instance NoAnn a => NoAnn (AnnList a) where |
| 1020 | 1045 | instance NoAnn NameAnn where
|
| 1021 | 1046 | noAnn = NameAnnTrailing []
|
| 1022 | 1047 | |
| 1023 | -instance NoAnn AnnPragma where
|
|
| 1024 | - noAnn = AnnPragma noAnn noAnn noAnn noAnn noAnn noAnn noAnn
|
|
| 1048 | +instance NoAnn AnnCType where
|
|
| 1049 | + noAnn = AnnCType noAnn noAnn noAnn noAnn
|
|
| 1050 | + |
|
| 1051 | +instance NoAnn AnnWarningTxt where
|
|
| 1052 | + noAnn = AnnWarningTxt noAnn noAnn noAnn
|
|
| 1053 | + |
|
| 1054 | +instance NoAnn AnnOverlap where
|
|
| 1055 | + noAnn = AnnOverlap noAnn noAnn
|
|
| 1056 | + |
|
| 1057 | +instance NoAnn AnnAnnDecl where
|
|
| 1058 | + noAnn = AnnAnnDecl noAnn noAnn noAnn noAnn
|
|
| 1059 | + |
|
| 1060 | +instance NoAnn AnnPragSCC where
|
|
| 1061 | + noAnn = AnnPragSCC noAnn noAnn noAnn
|
|
| 1025 | 1062 | |
| 1026 | 1063 | instance NoAnn AnnParen where
|
| 1027 | 1064 | noAnn = AnnParens noAnn noAnn
|
| ... | ... | @@ -1107,7 +1144,23 @@ instance Outputable AnnListBrackets where |
| 1107 | 1144 | ppr (ListBanana o c) = text "ListBanana" <+> ppr o <+> ppr c
|
| 1108 | 1145 | ppr ListNone = text "ListNone"
|
| 1109 | 1146 | |
| 1110 | -instance Outputable AnnPragma where
|
|
| 1111 | - ppr (AnnPragma o c s l ca t m)
|
|
| 1112 | - = text "AnnPragma" <+> ppr o <+> ppr c <+> ppr s <+> ppr l
|
|
| 1113 | - <+> ppr ca <+> ppr ca <+> ppr t <+> ppr m |
|
| 1147 | +instance Outputable AnnCType where
|
|
| 1148 | + ppr (AnnCType o c l ca)
|
|
| 1149 | + = text "AnnCType" <+> ppr o <+> ppr c <+> ppr l
|
|
| 1150 | + <+> ppr ca <+> ppr ca
|
|
| 1151 | + |
|
| 1152 | +instance Outputable AnnWarningTxt where
|
|
| 1153 | + ppr (AnnWarningTxt o c s)
|
|
| 1154 | + = text "AnnWarningTxt" <+> ppr o <+> ppr c <+> ppr s
|
|
| 1155 | + |
|
| 1156 | +instance Outputable AnnOverlap where
|
|
| 1157 | + ppr (AnnOverlap o c)
|
|
| 1158 | + = text "AnnOverlap" <+> ppr o <+> ppr c
|
|
| 1159 | + |
|
| 1160 | +instance Outputable AnnAnnDecl where
|
|
| 1161 | + ppr (AnnAnnDecl o c t m)
|
|
| 1162 | + = text "AnnAnnDecl" <+> ppr o <+> ppr c <+> ppr t <+> ppr m
|
|
| 1163 | + |
|
| 1164 | +instance Outputable AnnPragSCC where
|
|
| 1165 | + ppr (AnnPragSCC o c l)
|
|
| 1166 | + = text "AnnPragSCC" <+> ppr o <+> ppr c <+> ppr l |
| ... | ... | @@ -1188,10 +1188,20 @@ bindHsOuterTyVarBndrs :: OutputableBndrFlag flag 'Renamed |
| 1188 | 1188 | -> RnM (a, FreeNames)
|
| 1189 | 1189 | bindHsOuterTyVarBndrs doc mb_cls implicit_vars outer_bndrs thing_inside =
|
| 1190 | 1190 | case outer_bndrs of
|
| 1191 | + |
|
| 1191 | 1192 | HsOuterImplicit{} ->
|
| 1193 | + -- Add an implicit `forall a1..an` at the top, where `a1..an`
|
|
| 1194 | + -- are not-otherwise-in-scope type variables.
|
|
| 1195 | + -- Used when there is no forall, or a /visible/ (forall a -> blah)
|
|
| 1196 | + -- See Note [forall-or-nothing rule] in Language.Haskell.Syntax.Type
|
|
| 1192 | 1197 | rnImplicitTvOccs mb_cls implicit_vars $ \implicit_vars' ->
|
| 1193 | 1198 | thing_inside $ HsOuterImplicit { hso_ximplicit = implicit_vars' }
|
| 1199 | + |
|
| 1194 | 1200 | HsOuterExplicit{hso_bndrs = exp_bndrs} ->
|
| 1201 | + -- The type already has an explicit, user-written, invisible forall,
|
|
| 1202 | + -- so do not add an implicit forall
|
|
| 1203 | + -- See Note [forall-or-nothing rule] in Language.Haskell.Syntax.Type
|
|
| 1204 | + --
|
|
| 1195 | 1205 | -- Note: If we pass mb_cls instead of Nothing below, bindLHsTyVarBndrs
|
| 1196 | 1206 | -- will use class variables for any names the user meant to bring in
|
| 1197 | 1207 | -- scope here. This is an explicit forall, so we want fresh names, not
|
| ... | ... | @@ -109,7 +109,7 @@ import Data.Data (Data) |
| 109 | 109 | import Data.Functor ((<&>))
|
| 110 | 110 | |
| 111 | 111 | import Control.DeepSeq (NFData(..))
|
| 112 | -import GHC.Parser.Annotation (AnnPragma, noAnn)
|
|
| 112 | +import GHC.Parser.Annotation (AnnCType, noAnn)
|
|
| 113 | 113 | |
| 114 | 114 | {-
|
| 115 | 115 | ************************************************************************
|
| ... | ... | @@ -216,7 +216,7 @@ defaultCType :: String -> CType (GhcPass p) |
| 216 | 216 | defaultCType =
|
| 217 | 217 | CType (CTypeGhc NoSourceText NoSourceText noAnn) Nothing . packHText
|
| 218 | 218 | |
| 219 | -mkCType :: SourceText -> SourceText -> AnnPragma -> Maybe (Header (GhcPass p)) -> HText -> CType (GhcPass p)
|
|
| 219 | +mkCType :: SourceText -> SourceText -> AnnCType -> Maybe (Header (GhcPass p)) -> HText -> CType (GhcPass p)
|
|
| 220 | 220 | mkCType x y ann m =
|
| 221 | 221 | CType (CTypeGhc x y ann) m
|
| 222 | 222 | |
| ... | ... | @@ -303,7 +303,7 @@ data StaticTargetGhc = StaticTargetGhc |
| 303 | 303 | data CTypeGhc = CTypeGhc
|
| 304 | 304 | { cTypeSourceText :: SourceText
|
| 305 | 305 | , cTypeOtherText :: SourceText
|
| 306 | - , cTypeAnn :: AnnPragma
|
|
| 306 | + , cTypeAnn :: AnnCType
|
|
| 307 | 307 | }
|
| 308 | 308 | deriving (Data, Eq)
|
| 309 | 309 |
| ... | ... | @@ -480,7 +480,7 @@ Therefore there is no loss of generality if we make all selectors unrestricted. |
| 480 | 480 | mkDictSelId :: Name -- Name of one of the *value* selectors
|
| 481 | 481 | -- (dictionary superclass or method)
|
| 482 | 482 | -> Class -> Id
|
| 483 | --- Important: see Note [ClassOp/DFun selection] in GHC.Tc.TyCl.Instance
|
|
| 483 | +-- See Note [Dictionary selectors]
|
|
| 484 | 484 | mkDictSelId name clas
|
| 485 | 485 | = mkGlobalId (ClassOpId clas terminating) name sel_ty info
|
| 486 | 486 | where
|
| ... | ... | @@ -158,8 +158,8 @@ warningTxtSame w1 w2 |
| 158 | 158 | instance Outputable (InWarningCategory (GhcPass pass)) where
|
| 159 | 159 | ppr (InWarningCategory _ wt) = text "in" <+> doubleQuotes (ppr wt)
|
| 160 | 160 | |
| 161 | -type instance XDeprecatedTxt (GhcPass _) = (SourceText, AnnPragma)
|
|
| 162 | -type instance XWarningTxt (GhcPass _) = (SourceText, AnnPragma)
|
|
| 161 | +type instance XDeprecatedTxt (GhcPass _) = (SourceText, AnnWarningTxt)
|
|
| 162 | +type instance XWarningTxt (GhcPass _) = (SourceText, AnnWarningTxt)
|
|
| 163 | 163 | type instance XXWarningTxt (GhcPass _) = DataConCantHappen
|
| 164 | 164 | type instance XInWarningCategory (GhcPass _) = (EpToken "in", SourceText)
|
| 165 | 165 | type instance XXInWarningCategory (GhcPass _) = DataConCantHappen
|
| ... | ... | @@ -72,7 +72,7 @@ mk/ghcconfig*_test___spaces_ghc*.exe.mk |
| 72 | 72 | # NOTE: to edit this section in Vim, add your ignore annotations some where
|
| 73 | 73 | # in the list, select the entire section and say ':sort u' to sort it.
|
| 74 | 74 | |
| 75 | -/mk/ghc-config
|
|
| 75 | +/ghc-config/ghc-config
|
|
| 76 | 76 | |
| 77 | 77 | /tests/ado/ado001
|
| 78 | 78 | /tests/annotations/should_compile/th/build_make
|
| ... | ... | @@ -46,5 +46,6 @@ clean distclean maintainer-clean: |
| 46 | 46 | $(RM) -f mk/*.o
|
| 47 | 47 | $(RM) -f mk/*.hi
|
| 48 | 48 | $(RM) -f mk/ghcconfig*.mk
|
| 49 | - $(RM) -f mk/ghc-config mk/ghc-config.exe
|
|
| 49 | + $(RM) -f ghc-config/ghc-config ghc-config/ghc-config.exe
|
|
| 50 | + $(RM) -f ghc-config/ghc-config.o ghc-config/ghc-config.hi
|
|
| 50 | 51 | $(RM) -f driver/*.pyc |
| 1 | + |
|
| 1 | 2 | ==================== HIE AST ====================
|
| 2 | 3 | File: T24493.hs
|
| 3 | 4 | Node@T24493.hs:(1,8)-(3,8): Source: From source
|
| ... | ... | @@ -25,9 +26,10 @@ Node@T24493.hs:(1,8)-(3,8): Source: From source |
| 25 | 26 | Node@T24493.hs:3:6-8: Source: From source
|
| 26 | 27 | {(annotations: {(HsLit, HsExpr)}), (types: [0]),
|
| 27 | 28 | (identifier info: {})}
|
| 28 | -
|
|
| 29 | +
|
|
| 29 | 30 | |
| 31 | +[(0, (GHC.Internal.Base.String {}))]
|
|
| 30 | 32 | |
| 31 | 33 | |
| 32 | 34 | Got valid scopes
|
| 33 | -Got no roundtrip errors |
|
| \ No newline at end of file | ||
| 35 | +Got no roundtrip errors |
| 1 | +{-# LANGUAGE QuantifiedConstraints#-}
|
|
| 2 | +{-# LANGUAGE UndecidableInstances #-}
|
|
| 3 | +{-# LANGUAGE AllowAmbiguousTypes #-}
|
|
| 4 | +module Main where
|
|
| 5 | + |
|
| 6 | +import TestUtils
|
|
| 7 | +import qualified Data.Map.Strict as M
|
|
| 8 | +import qualified Data.Set as S
|
|
| 9 | +import Data.Either
|
|
| 10 | +import Data.Maybe
|
|
| 11 | +import Data.Bifunctor (first)
|
|
| 12 | +import GHC.Plugins (moduleNameString, nameStableString, nameOccName, occNameString, isDerivedOccName)
|
|
| 13 | +import GHC.Iface.Ext.Types
|
|
| 14 | + |
|
| 15 | + |
|
| 16 | +import Data.Typeable
|
|
| 17 | + |
|
| 18 | +data Some c where
|
|
| 19 | + Some :: c a => a -> Some c
|
|
| 20 | + |
|
| 21 | +extractSome :: (Typeable a, forall x. c x => Typeable x) => Some c -> Maybe a
|
|
| 22 | +extractSome (Some a) = cast a
|
|
| 23 | + |
|
| 24 | +f :: (forall x. Ord x => Eq [x]) => ()
|
|
| 25 | +f = ()
|
|
| 26 | +{-# NOINLINE f #-}
|
|
| 27 | + |
|
| 28 | +g :: ()
|
|
| 29 | +g = f
|
|
| 30 | + |
|
| 31 | +useQC :: forall c a. (c a, forall x. c x => Show x) => a -> String
|
|
| 32 | +useQC x = show x
|
|
| 33 | + |
|
| 34 | +points :: [(Int,Int)]
|
|
| 35 | +points = [(22,26),(29, 5), (32, 13)]
|
|
| 36 | + |
|
| 37 | +main = do
|
|
| 38 | + (df, hf) <- readTestHie "T25709.hie"
|
|
| 39 | + let refmap = generateReferencesMap $ getAsts $ hie_asts hf
|
|
| 40 | + traverse (explainEv df hf refmap) points |
| 1 | +==========================
|
|
| 2 | +At point (22,26), we found:
|
|
| 3 | +==========================
|
|
| 4 | +┌
|
|
| 5 | +│ $dTypeable at T25709.hs:22:14-19, of type: Typeable a
|
|
| 6 | +│ is an evidence variable bound by a let, depending on: [$dTypeable]
|
|
| 7 | +│ with scope: LocalScope T25709.hs:22:14-29
|
|
| 8 | +│
|
|
| 9 | +│ Defined at <no location info>
|
|
| 10 | +└
|
|
| 11 | +|
|
|
| 12 | +`- ┌
|
|
| 13 | + │ $dTypeable at T25709.hs:22:1-29, of type: Typeable a
|
|
| 14 | + │ is an evidence variable bound by a HsWrapper
|
|
| 15 | + │ with scope: LocalScope T25709.hs:22:1-29
|
|
| 16 | + │ bound at: T25709.hs:22:1-29
|
|
| 17 | + │ Defined at <no location info>
|
|
| 18 | + └
|
|
| 19 | + |
|
| 20 | +┌
|
|
| 21 | +│ $dTypeable at T25709.hs:22:14-19, of type: Typeable a
|
|
| 22 | +│ is an evidence variable bound by a let, depending on: [df, irred]
|
|
| 23 | +│ with scope: LocalScope T25709.hs:22:14-29
|
|
| 24 | +│
|
|
| 25 | +│ Defined at <no location info>
|
|
| 26 | +└
|
|
| 27 | +|
|
|
| 28 | ++- ┌
|
|
| 29 | +| │ df at T25709.hs:22:1-29, of type: forall x. c x => Typeable x
|
|
| 30 | +| │ is an evidence variable bound by a HsWrapper
|
|
| 31 | +| │ with scope: LocalScope T25709.hs:22:1-29
|
|
| 32 | +| │ bound at: T25709.hs:22:1-29
|
|
| 33 | +| │ Defined at <no location info>
|
|
| 34 | +| └
|
|
| 35 | +|
|
|
| 36 | +`- ┌
|
|
| 37 | + │ irred at T25709.hs:22:14-19, of type: c a
|
|
| 38 | + │ is an evidence variable bound by a let, depending on: [irred]
|
|
| 39 | + │ with scope: LocalScope T25709.hs:22:14-29
|
|
| 40 | + │
|
|
| 41 | + │ Defined at <no location info>
|
|
| 42 | + └
|
|
| 43 | + |
|
|
| 44 | + `- ┌
|
|
| 45 | + │ irred at T25709.hs:22:14-19, of type: c a
|
|
| 46 | + │ is an evidence variable bound by a pattern
|
|
| 47 | + │ with scope: LocalScope T25709.hs:22:14-29
|
|
| 48 | + │
|
|
| 49 | + │ Defined at <no location info>
|
|
| 50 | + └
|
|
| 51 | + |
|
| 52 | +==========================
|
|
| 53 | +At point (29,5), we found:
|
|
| 54 | +==========================
|
|
| 55 | +┌
|
|
| 56 | +│ df at T25709.hs:1:1, of type: forall x. Ord x => Eq [x]
|
|
| 57 | +│ is an evidence variable bound by a let, depending on: [$p1Ord,
|
|
| 58 | +│ $fEqList]
|
|
| 59 | +│ with scope: ModuleScope
|
|
| 60 | +│
|
|
| 61 | +│ Defined at <no location info>
|
|
| 62 | +└
|
|
| 63 | +|
|
|
| 64 | ++- ┌
|
|
| 65 | +| │ $p1Ord at T25709.hs:1:1, of type: forall a. Ord a => Eq a
|
|
| 66 | +| │ is a usage of an external evidence variable
|
|
| 67 | +| │ Defined in `GHC.Internal.Classes'
|
|
| 68 | +| └
|
|
| 69 | +|
|
|
| 70 | +`- ┌
|
|
| 71 | + │ $fEqList at T25709.hs:1:1, of type: forall a. Eq a => Eq [a]
|
|
| 72 | + │ is a usage of an external evidence variable
|
|
| 73 | + │ Defined in `GHC.Internal.Classes'
|
|
| 74 | + └
|
|
| 75 | + |
|
| 76 | +==========================
|
|
| 77 | +At point (32,13), we found:
|
|
| 78 | +==========================
|
|
| 79 | +┌
|
|
| 80 | +│ $dShow at T25709.hs:32:1-16, of type: Show a
|
|
| 81 | +│ is an evidence variable bound by a let, depending on: [df, irred]
|
|
| 82 | +│ with scope: LocalScope T25709.hs:32:1-16
|
|
| 83 | +│ bound at: T25709.hs:32:1-16
|
|
| 84 | +│ Defined at <no location info>
|
|
| 85 | +└
|
|
| 86 | +|
|
|
| 87 | ++- ┌
|
|
| 88 | +| │ df at T25709.hs:32:1-16, of type: forall x. c x => Show x
|
|
| 89 | +| │ is an evidence variable bound by a HsWrapper
|
|
| 90 | +| │ with scope: LocalScope T25709.hs:32:1-16
|
|
| 91 | +| │ bound at: T25709.hs:32:1-16
|
|
| 92 | +| │ Defined at <no location info>
|
|
| 93 | +| └
|
|
| 94 | +|
|
|
| 95 | +`- ┌
|
|
| 96 | + │ irred at T25709.hs:32:1-16, of type: c a
|
|
| 97 | + │ is an evidence variable bound by a let, depending on: [irred]
|
|
| 98 | + │ with scope: LocalScope T25709.hs:32:1-16
|
|
| 99 | + │ bound at: T25709.hs:32:1-16
|
|
| 100 | + │ Defined at <no location info>
|
|
| 101 | + └
|
|
| 102 | + |
|
|
| 103 | + `- ┌
|
|
| 104 | + │ irred at T25709.hs:32:1-16, of type: c a
|
|
| 105 | + │ is an evidence variable bound by a HsWrapper
|
|
| 106 | + │ with scope: LocalScope T25709.hs:32:1-16
|
|
| 107 | + │ bound at: T25709.hs:32:1-16
|
|
| 108 | + │ Defined at <no location info>
|
|
| 109 | + └
|
|
| 110 | + |
| ... | ... | @@ -8,4 +8,5 @@ test('HieVdq', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUti |
| 8 | 8 | test('T23540', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info'])
|
| 9 | 9 | test('T23120', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info'])
|
| 10 | 10 | test('T24544', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info'])
|
| 11 | -test('HieGadtConSigs', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) |
|
| \ No newline at end of file | ||
| 11 | +test('HieGadtConSigs', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info'])
|
|
| 12 | +test('T25709', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) |
| ... | ... | @@ -288,10 +288,6 @@ instance HasTrailing [TrailingAnn] where |
| 288 | 288 | trailing a = a
|
| 289 | 289 | setTrailing _ ts = ts
|
| 290 | 290 | |
| 291 | -instance HasTrailing AnnPragma where
|
|
| 292 | - trailing _ = []
|
|
| 293 | - setTrailing a _ = a
|
|
| 294 | - |
|
| 295 | 291 | instance HasTrailing AnnParen where
|
| 296 | 292 | trailing _ = []
|
| 297 | 293 | setTrailing a _ = a
|
| ... | ... | @@ -1559,22 +1555,22 @@ instance ExactPrint (WarningTxt GhcPs) where |
| 1559 | 1555 | getAnnotationEntry _ = NoEntryVal
|
| 1560 | 1556 | setAnnotationAnchor a _ _ _ = a
|
| 1561 | 1557 | |
| 1562 | - exact (WarningTxt (src, AnnPragma o c (os,cs) l1 l2 t m) mb_cat ws) = do
|
|
| 1558 | + exact (WarningTxt (src, AnnWarningTxt o c (os,cs)) mb_cat ws) = do
|
|
| 1563 | 1559 | o' <- markAnnOpen'' o src "{-# WARNING"
|
| 1564 | 1560 | mb_cat' <- markAnnotated mb_cat
|
| 1565 | 1561 | os' <- markEpToken os
|
| 1566 | 1562 | ws' <- mapM markAnnotated ws
|
| 1567 | 1563 | cs' <- markEpToken cs
|
| 1568 | 1564 | c' <- markEpToken c
|
| 1569 | - return (WarningTxt (src, AnnPragma o' c' (os',cs') l1 l2 t m) mb_cat' ws')
|
|
| 1565 | + return (WarningTxt (src, AnnWarningTxt o' c' (os',cs')) mb_cat' ws')
|
|
| 1570 | 1566 | |
| 1571 | - exact (DeprecatedTxt (src, AnnPragma o c (os,cs) l1 l2 t m) ws) = do
|
|
| 1567 | + exact (DeprecatedTxt (src, AnnWarningTxt o c (os,cs)) ws) = do
|
|
| 1572 | 1568 | o' <- markAnnOpen'' o src "{-# DEPRECATED"
|
| 1573 | 1569 | os' <- markEpToken os
|
| 1574 | 1570 | ws' <- mapM markAnnotated ws
|
| 1575 | 1571 | cs' <- markEpToken cs
|
| 1576 | 1572 | c' <- markEpToken c
|
| 1577 | - return (DeprecatedTxt (src, AnnPragma o' c' (os',cs') l1 l2 t m) ws')
|
|
| 1573 | + return (DeprecatedTxt (src, AnnWarningTxt o' c' (os',cs')) ws')
|
|
| 1578 | 1574 | |
| 1579 | 1575 | instance ExactPrint (InWarningCategory GhcPs) where
|
| 1580 | 1576 | getAnnotationEntry _ = NoEntryVal
|
| ... | ... | @@ -2251,35 +2247,35 @@ instance ExactPrint (OverlapMode GhcPs) where |
| 2251 | 2247 | setAnnotationAnchor a _ _ _ = a
|
| 2252 | 2248 | |
| 2253 | 2249 | -- NOTE: NoOverlap is only used in the typechecker
|
| 2254 | - exact (NoOverlap (src, AnnPragma o c s l1 l2 t m)) = do
|
|
| 2250 | + exact (NoOverlap (src, AnnOverlap o c)) = do
|
|
| 2255 | 2251 | o' <- markAnnOpen'' o src "{-# NO_OVERLAP"
|
| 2256 | 2252 | c' <- markEpToken c
|
| 2257 | - return (NoOverlap (src, AnnPragma o' c' s l1 l2 t m))
|
|
| 2253 | + return (NoOverlap (src, AnnOverlap o' c'))
|
|
| 2258 | 2254 | |
| 2259 | - exact (Overlappable (src, AnnPragma o c s l1 l2 t m)) = do
|
|
| 2255 | + exact (Overlappable (src, AnnOverlap o c)) = do
|
|
| 2260 | 2256 | o' <- markAnnOpen'' o src "{-# OVERLAPPABLE"
|
| 2261 | 2257 | c' <- markEpToken c
|
| 2262 | - return (Overlappable (src, AnnPragma o' c' s l1 l2 t m))
|
|
| 2258 | + return (Overlappable (src, AnnOverlap o' c'))
|
|
| 2263 | 2259 | |
| 2264 | - exact (Overlapping (src, AnnPragma o c s l1 l2 t m)) = do
|
|
| 2260 | + exact (Overlapping (src, AnnOverlap o c)) = do
|
|
| 2265 | 2261 | o' <- markAnnOpen'' o src "{-# OVERLAPPING"
|
| 2266 | 2262 | c' <- markEpToken c
|
| 2267 | - return (Overlapping (src, AnnPragma o' c' s l1 l2 t m))
|
|
| 2263 | + return (Overlapping (src, AnnOverlap o' c'))
|
|
| 2268 | 2264 | |
| 2269 | - exact (Overlaps (src, AnnPragma o c s l1 l2 t m)) = do
|
|
| 2265 | + exact (Overlaps (src, AnnOverlap o c)) = do
|
|
| 2270 | 2266 | o' <- markAnnOpen'' o src "{-# OVERLAPS"
|
| 2271 | 2267 | c' <- markEpToken c
|
| 2272 | - return (Overlaps (src, AnnPragma o' c' s l1 l2 t m))
|
|
| 2268 | + return (Overlaps (src, AnnOverlap o' c'))
|
|
| 2273 | 2269 | |
| 2274 | - exact (Incoherent (src, AnnPragma o c s l1 l2 t m)) = do
|
|
| 2270 | + exact (Incoherent (src, AnnOverlap o c)) = do
|
|
| 2275 | 2271 | o' <- markAnnOpen'' o src "{-# INCOHERENT"
|
| 2276 | 2272 | c' <- markEpToken c
|
| 2277 | - return (Incoherent (src, AnnPragma o' c' s l1 l2 t m))
|
|
| 2273 | + return (Incoherent (src, AnnOverlap o' c'))
|
|
| 2278 | 2274 | |
| 2279 | - exact (NonCanonical (src, AnnPragma o c s l1 l2 t m)) = do
|
|
| 2275 | + exact (NonCanonical (src, AnnOverlap o c)) = do
|
|
| 2280 | 2276 | o' <- markAnnOpen'' o src "{-# INCOHERENT"
|
| 2281 | 2277 | c' <- markEpToken c
|
| 2282 | - return (Incoherent (src, AnnPragma o' c' s l1 l2 t m))
|
|
| 2278 | + return (Incoherent (src, AnnOverlap o' c'))
|
|
| 2283 | 2279 | |
| 2284 | 2280 | -- ---------------------------------------------------------------------
|
| 2285 | 2281 | |
| ... | ... | @@ -2706,7 +2702,7 @@ instance ExactPrint (AnnDecl GhcPs) where |
| 2706 | 2702 | getAnnotationEntry _ = NoEntryVal
|
| 2707 | 2703 | setAnnotationAnchor a _ _ _ = a
|
| 2708 | 2704 | |
| 2709 | - exact (HsAnnotation (AnnPragma o c s l1 l2 t m, src) prov e) = do
|
|
| 2705 | + exact (HsAnnotation (AnnAnnDecl o c t m, src) prov e) = do
|
|
| 2710 | 2706 | o' <- markAnnOpen'' o src "{-# ANN"
|
| 2711 | 2707 | (t', m', prov') <-
|
| 2712 | 2708 | case prov of
|
| ... | ... | @@ -2723,7 +2719,7 @@ instance ExactPrint (AnnDecl GhcPs) where |
| 2723 | 2719 | |
| 2724 | 2720 | e' <- markAnnotated e
|
| 2725 | 2721 | c' <- markEpToken c
|
| 2726 | - return (HsAnnotation (AnnPragma o' c' s l1 l2 t' m',src) prov' e')
|
|
| 2722 | + return (HsAnnotation (AnnAnnDecl o' c' t' m',src) prov' e')
|
|
| 2727 | 2723 | |
| 2728 | 2724 | -- ---------------------------------------------------------------------
|
| 2729 | 2725 | |
| ... | ... | @@ -3146,11 +3142,11 @@ instance ExactPrint (HsPragE GhcPs) where |
| 3146 | 3142 | getAnnotationEntry HsPragSCC{} = NoEntryVal
|
| 3147 | 3143 | setAnnotationAnchor a _ _ _ = a
|
| 3148 | 3144 | |
| 3149 | - exact (HsPragSCC (AnnPragma o c s l1 l2 t m,st) sl) = do
|
|
| 3145 | + exact (HsPragSCC (AnnPragSCC o c l1,st) sl) = do
|
|
| 3150 | 3146 | o' <- markAnnOpen'' o st "{-# SCC"
|
| 3151 | 3147 | l1' <- printStringAtAA l1 (sourceTextToString (stringLitSourceText sl) (unpackHText $ sl_fs sl))
|
| 3152 | 3148 | c' <- markEpToken c
|
| 3153 | - return (HsPragSCC (AnnPragma o' c' s l1' l2 t m,st) sl)
|
|
| 3149 | + return (HsPragSCC (AnnPragSCC o' c' l1',st) sl)
|
|
| 3154 | 3150 | |
| 3155 | 3151 | instance ExactPrint (HsTypedSplice GhcPs) where
|
| 3156 | 3152 | getAnnotationEntry _ = NoEntryVal
|
| ... | ... | @@ -4408,7 +4404,7 @@ instance Typeable p => ExactPrint (CType (GhcPass p)) where |
| 4408 | 4404 | exact (CType ext mh ct) = do
|
| 4409 | 4405 | let stp = cTypeSourceText ext
|
| 4410 | 4406 | stct = cTypeOtherText ext
|
| 4411 | - AnnPragma o c s l1 l2 t m = cTypeAnn ext
|
|
| 4407 | + AnnCType o c l1 l2 = cTypeAnn ext
|
|
| 4412 | 4408 | o' <- markAnnOpen'' o stp "{-# CTYPE"
|
| 4413 | 4409 | l1' <- case mh of
|
| 4414 | 4410 | Nothing -> return l1
|
| ... | ... | @@ -4416,7 +4412,7 @@ instance Typeable p => ExactPrint (CType (GhcPass p)) where |
| 4416 | 4412 | printStringAtAA l1 (toSourceTextWithSuffix srcH "" "")
|
| 4417 | 4413 | l2' <- printStringAtAA l2 (toSourceTextWithSuffix stct (unpackHText ct) "")
|
| 4418 | 4414 | c' <- markEpToken c
|
| 4419 | - return (CType (ext { cTypeAnn = AnnPragma o' c' s l1' l2' t m }) mh ct)
|
|
| 4415 | + return (CType (ext { cTypeAnn = AnnCType o' c' l1' l2' }) mh ct)
|
|
| 4420 | 4416 | |
| 4421 | 4417 | -- ---------------------------------------------------------------------
|
| 4422 | 4418 |
| ... | ... | @@ -838,7 +838,7 @@ type instance Anno (HsSigType DocNameI) = SrcSpanAnnA |
| 838 | 838 | type instance Anno (BooleanFormula DocNameI) = SrcSpanAnnBF
|
| 839 | 839 | type instance Anno (OverlapMode DocNameI) = SrcSpanAnnA
|
| 840 | 840 | type instance Anno (CType DocNameI) = SrcSpanAnnA
|
| 841 | -type instance Anno (Header DocNameI) = EpAnn AnnPragma
|
|
| 841 | +type instance Anno (Header DocNameI) = SrcSpanAnnA
|
|
| 842 | 842 | type instance Anno (HsModifierOf (LocatedA (HsType DocNameI)) DocNameI) = SrcSpanAnnA
|
| 843 | 843 | type instance Anno (HsContextDetails DocNameI a) = SrcSpanAnnA
|
| 844 | 844 |