diff options
Diffstat (limited to 'compiler/typecheck/TcAnnotations.hs')
-rw-r--r-- | compiler/typecheck/TcAnnotations.hs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/compiler/typecheck/TcAnnotations.hs b/compiler/typecheck/TcAnnotations.hs index bdf6646b1a..2c587e213f 100644 --- a/compiler/typecheck/TcAnnotations.hs +++ b/compiler/typecheck/TcAnnotations.hs @@ -16,8 +16,8 @@ import DynFlags import Control.Monad ( when ) import HsSyn -import Annotations import Name +import Annotations import TcRnMonad import SrcLoc import Outputable @@ -26,13 +26,13 @@ import Outputable -- compilation on those platforms shouldn't fail just due to -- annotations #ifndef GHCI -tcAnnotations :: [LAnnDecl Name] -> TcM [Annotation] +tcAnnotations :: [LAnnDecl GhcRn] -> TcM [Annotation] tcAnnotations anns = do dflags <- getDynFlags case gopt Opt_ExternalInterpreter dflags of True -> tcAnnotations' anns False -> warnAnns anns -warnAnns :: [LAnnDecl Name] -> TcM [Annotation] +warnAnns :: [LAnnDecl GhcRn] -> TcM [Annotation] --- No GHCI; emit a warning (not an error) and ignore. cf Trac #4268 warnAnns [] = return [] warnAnns anns@(L loc _ : _) @@ -41,14 +41,14 @@ warnAnns anns@(L loc _ : _) <+> text "because this is a stage-1 compiler without -fexternal-interpreter or doesn't support GHCi") ; return [] } #else -tcAnnotations :: [LAnnDecl Name] -> TcM [Annotation] +tcAnnotations :: [LAnnDecl GhcRn] -> TcM [Annotation] tcAnnotations = tcAnnotations' #endif -tcAnnotations' :: [LAnnDecl Name] -> TcM [Annotation] +tcAnnotations' :: [LAnnDecl GhcRn] -> TcM [Annotation] tcAnnotations' anns = mapM tcAnnotation anns -tcAnnotation :: LAnnDecl Name -> TcM Annotation +tcAnnotation :: LAnnDecl GhcRn -> TcM Annotation tcAnnotation (L loc ann@(HsAnnotation _ provenance expr)) = do -- Work out what the full target of this annotation was mod <- getModule @@ -64,11 +64,12 @@ tcAnnotation (L loc ann@(HsAnnotation _ provenance expr)) = do safeHsErr = vcat [ text "Annotations are not compatible with Safe Haskell." , text "See https://ghc.haskell.org/trac/ghc/ticket/10826" ] -annProvenanceToTarget :: Module -> AnnProvenance Name -> AnnTarget Name +annProvenanceToTarget :: Module -> AnnProvenance Name + -> AnnTarget Name annProvenanceToTarget _ (ValueAnnProvenance (L _ name)) = NamedTarget name annProvenanceToTarget _ (TypeAnnProvenance (L _ name)) = NamedTarget name annProvenanceToTarget mod ModuleAnnProvenance = ModuleTarget mod -annCtxt :: (OutputableBndrId id) => AnnDecl id -> SDoc +annCtxt :: (SourceTextX p, OutputableBndrId p) => AnnDecl p -> SDoc annCtxt ann = hang (text "In the annotation:") 2 (ppr ann) |